Skip to content

chore: Synced file(s) with honestbank/.github #295

chore: Synced file(s) with honestbank/.github

chore: Synced file(s) with honestbank/.github #295

Workflow file for this run

# This is managed workflow, do not change this file in downstream repo
name: go-tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
GOPRIVATE: github.com/honestbank
jobs:
build:
name: go-tests
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.20"]
steps:
- name: Set up Golang
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
id: go
- name: Check out code into the Go module directory
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;
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
args: --timeout=5m --modules-download-mode=readonly
skip-pkg-cache: true
skip-build-cache: true
- name: sonarcloud-scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true
integration-tests:
name: integration-tests
runs-on: ubuntu-latest
steps:
- 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@v4
with:
go-version: "1.20"
id: go
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: release
uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
semantic_version: 19
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
@semantic-release/[email protected]