Skip to content

Commit

Permalink
chore: synced file(s) with honestbank/.github
Browse files Browse the repository at this point in the history
  • Loading branch information
honestbank-bot committed Dec 7, 2023
1 parent cfdf0f6 commit 281617c
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 53 deletions.
66 changes: 50 additions & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.16"]
go: ["1.20"]
steps:
- name: Set up Golang
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure ssh-key for private modules
env:
SSH_KEY: ${{ secrets.ENGINEERING_SSH_KEY }}
run: mkdir -p ~/.ssh; echo "$SSH_KEY" > ~/.ssh/id_rsa; chmod 600 ~/.ssh/id_rsa; git config --global url."[email protected]:".insteadOf "https://github.com/"

- name: Setup go modules
run: go clean -modcache;go mod tidy; go mod download; go mod verify;

Expand All @@ -41,43 +46,72 @@ jobs:
skip-pkg-cache: true
skip-build-cache: true

- name: Test and generate code coverage
run: go test -v -race --tags=integration_test -coverprofile=coverage.txt -covermode=atomic ./...

- name: sonarcloud-scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true
trivy_scan:
name: trivy-scan

integration-tests:
name: integration-tests
runs-on: ubuntu-latest
steps:
- run: echo "add trivy scan" # todo
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Golang
uses: actions/setup-go@v4
with:
go-version: "1.20"
id: go

- name: Start docker containers for integration tests
run: docker-compose -f docker-compose.integration.yaml up -d

- name: Configure ssh-key for private modules
env:
SSH_KEY: ${{ secrets.ENGINEERING_SSH_KEY }}
run: mkdir -p ~/.ssh; echo "$SSH_KEY" > ~/.ssh/id_rsa; chmod 600 ~/.ssh/id_rsa; git config --global url."[email protected]:".insteadOf "https://github.com/"

- name: Setup go modules
run: go mod tidy

- name: Test and generate code coverage
run: go test -tags=integration_test -coverprofile=coverage.txt -covermode=atomic ./...

- name: sonarcloud-scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true

release:
name: semantic-release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Set up Golang
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: "1.16"
go-version: "1.20"
id: go
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '17'
node-version: '18'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
semantic_version: 18
semantic_version: 19
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/repository-experiment-verification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yamllint disable rule:line-length
# Use template from https://github.com/honestbank/workflows/tree/main/examples/repository-workflows
---
name: "repository-experiment-verification"
permissions: read-all

on: # yamllint disable-line rule:truthy
pull_request:
branches: [main]

jobs:
repository-experiment-verification:
name: repository-experiment-verification
uses: honestbank/workflows/.github/workflows/shared-experiment-verification.yaml@main
secrets: inherit
with:
experiment_required: false
22 changes: 13 additions & 9 deletions .github/workflows/semantic-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: "Semantic Pull Request"
# DO NOT CHANGE. This file is being managed from a central repository
# To know more simply visit https://github.com/honestbank/.github/blob/main/docs/about.md

on:
# yamllint disable rule:line-length
# Use template from https://github.com/honestbank/workflows/tree/main/examples/repository-workflows
---
name: "repository-semantic-pr"
permissions: read-all

on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repository-semantic-pr:
name: repository-semantic-pr
uses: honestbank/workflows/.github/workflows/shared-semantic-pr.yaml@main
secrets: inherit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

# NUCLEAR OPTION - EXCLUDES ALL JETBRAINS IDE FILES
**/.idea/**
.idea/**

# User-specific stuff
.idea/**/workspace.xml
Expand Down Expand Up @@ -458,3 +459,6 @@ mocks
# test log file
coverage.txt
coverage.tmp

# Grafana tempo files (https://grafana.com/oss/tempo/)
**/tempo-data/**
32 changes: 18 additions & 14 deletions .golangci.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,45 @@
"skip-dirs-use-default": true,
"tests": true
},
"issues": {
"exclude-rules": {
"path": "/",
"linters": ["errcheck"]
}
},
"linters": {
"enable": [
"deadcode",
"errcheck",
"gosimple",
"govet",
"ineffassign",
"staticcheck",
"structcheck",
"typecheck",
"unused",
"varcheck",
"gofmt",
"goimports",
"nestif",
"ifshort",
"asciicheck",
"errcheck",
"exhaustive",
"exportloopref",
"forbidigo",
"gocyclo",
"gofmt",
"goimports",
"gosimple",
"govet",
"ifshort",
"ineffassign",
"makezero",
"misspell",
"nakedret",
"nestif",
"nilerr",
"nlreturn",
"nolintlint",
"staticcheck",
"testpackage",
"typecheck",
"unconvert",
"unused",
"wastedassign",
"whitespace"
]
},
"linters-settings": {
"errcheck": {
"check-blank": true
}
}
}
14 changes: 11 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
args: [ '--allow-multiple-documents' ]
- id: detect-aws-credentials
args: [ '--allow-missing-credentials' ]
- repo: https://github.com/golangci/golangci-lint
rev: v1.39.0
rev: v1.54.2
hooks:
- id: golangci-lint
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v0.8.2
rev: v1.0.0-rc.1
hooks:
- id: go-imports
- repo: https://github.com/gitguardian/ggshield
rev: v1.19.1
hooks:
- id: ggshield
language: python
stages: [commit]
args: [ 'secret', 'scan', 'pre-commit' ]
63 changes: 63 additions & 0 deletions docker-compose.integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# DO NOT CHANGE. This file is being managed from a central repository
# To know more simply visit https://github.com/honestbank/.github/blob/main/docs/about.md

version: "3.0"
services:
db:
image: mysql:8
ports:
- "3306:3306"
environment:
- MYSQL_USER=dbuser
- MYSQL_PASSWORD=dbpass
- MYSQL_DATABASE=my_db
- MYSQL_RANDOM_ROOT_PASSWORD=true
zookeeper:
image: confluentinc/cp-zookeeper:7.3.2
hostname: zookeeper
container_name: zookeeper
restart: "always"
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:7.3.2
hostname: kafka
container_name: kafka
restart: "always"
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_SCHEMA_REGISTRY_URL: "http://schemaregistry:8082"
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_BROKER_ID: 1
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_JMX_PORT: 9999
KAFKA_JMX_HOSTNAME: ${DOCKER_HOST_IP:-127.0.0.1}
KAFKA_NUM_PARTITIONS: 1
depends_on:
- zookeeper
schemaregistry:
image: confluentinc/cp-schema-registry:7.3.2
restart: always
depends_on:
- kafka
environment:
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: "kafka:19092"
SCHEMA_REGISTRY_HOST_NAME: schemaregistry
SCHEMA_REGISTRY_LISTENERS: "http://0.0.0.0:8082"
ports:
- 8082:8082
gcs:
image: oittaa/gcp-storage-emulator:latest
ports:
- "8080:8080"
63 changes: 63 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# DO NOT CHANGE. This file is being managed from a central repository
# To know more simply visit https://github.com/honestbank/.github/blob/main/docs/about.md

version: "3.0"
services:
db:
image: mysql:8
ports:
- "3306:3306"
environment:
- MYSQL_USER=dbuser
- MYSQL_PASSWORD=dbpass
- MYSQL_DATABASE=my_db
- MYSQL_RANDOM_ROOT_PASSWORD=true
zookeeper:
image: confluentinc/cp-zookeeper:7.3.2
hostname: zookeeper
container_name: zookeeper
restart: "always"
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:7.3.2
hostname: kafka
container_name: kafka
restart: "always"
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_SCHEMA_REGISTRY_URL: "http://schemaregistry:8082"
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_BROKER_ID: 1
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_JMX_PORT: 9999
KAFKA_JMX_HOSTNAME: ${DOCKER_HOST_IP:-127.0.0.1}
KAFKA_NUM_PARTITIONS: 1
depends_on:
- zookeeper
schemaregistry:
image: confluentinc/cp-schema-registry:7.3.2
restart: always
depends_on:
- kafka
environment:
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: "kafka:19092"
SCHEMA_REGISTRY_HOST_NAME: schemaregistry
SCHEMA_REGISTRY_LISTENERS: "http://0.0.0.0:8082"
ports:
- 8082:8082
gcs:
image: oittaa/gcp-storage-emulator:latest
ports:
- "8080:8080"
Loading

0 comments on commit 281617c

Please sign in to comment.