Skip to content

Commit

Permalink
chore: Synced file(s) with honestbank/.github (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
honestbank-bot authored Dec 13, 2023
1 parent cfdf0f6 commit cf4f7d3
Show file tree
Hide file tree
Showing 13 changed files with 481 additions and 55 deletions.
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
# Pull Request Instructions
* All PRs should reference an issue in our issue tracker. If one doesn't exist, please create one!
* PR titles should follow https://www.conventionalcommits.org.
-->

### Pull Request Submission Checklist

Please confirm that you have done the following before requesting reviews:

- [ ] I have confirmed that the PR type is appropriate for the change I am making according to the [Honest Pull Request and Commit Message Naming Conventions](https://www.notion.so/honestbank/Pull-Request-and-Commit-Message-Naming-Conventions-bd97f2cbb34c4c73b1ff3a3e384b850c).
- [ ] I have typed an adequate description that explains **why** I am making this change.
- [ ] I have installed and run standard pre-commit hooks that lints and validates my code.
- [ ] All entities that I am working with are up-to-date in Backstage; if updates are needed, I have linked the relevant PRs. [Backstage guide](https://www.notion.so/honestbank/How-to-Write-a-Backstage-Service-Catalog-Entry-a-catalog-info-yaml-file-21845ff72e404b14aed2ac989fb202cf?pvs=4)

### Description

* <!-- WRITE A SHORT DESCRIPTION OF CHANGES -->

### Experiment Link

<!-- All code changes require an experiment - you can get started at https://www.notion.so/honestbank/How-to-create-a-feature-flag-ON-OFF-on-GrowthBook-0a11a156397d4eca89fb76dad0eb921c?pvs=4 -->

GrowthBook Experiment Link: https://app.growthbook.io/features/
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."git@github.com:".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."git@github.com:".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/git@10.0.1
@semantic-release/exec@6.0.2
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
}
}
}
21 changes: 18 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,33 @@

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' ]
- repo: local
hooks:
- id: generate-catalog
name: generate-catalog
entry: ./catalog-info.generator.sh
language: script
pass_filenames: false
Loading

0 comments on commit cf4f7d3

Please sign in to comment.