Handle assignments to global variables from the init function #705
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Check out repository | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.x | |
cache: false | |
- name: Read golangci-lint version from .golangci.version | |
id: golangci-version | |
run: echo "GOLANGCI_VERSION=$(cat .golangci.version)" > $GITHUB_OUTPUT | |
# We do not really run golangci-lint here (hence we use the -h flag). We just use the | |
# golangci-lint action to install it and reuses its internal caching infrastructure. | |
# The actual execution is done in the Lint job (together with other custom linting tasks). | |
- uses: golangci/golangci-lint-action@v4 | |
name: Install golangci-lint | |
with: | |
version: v${{ steps.golangci-version.outputs.GOLANGCI_VERSION }} | |
args: -h | |
- name: Symlink installed golangci-lint to bin directory | |
run: mkdir -p bin && ln -s $(which golangci-lint) bin/golangci-lint | |
- run: make lint | |
name: Lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ "1.21.x", "1.22.x" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: true | |
- name: Load cached dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Download dependencies | |
run: go mod download | |
- name: Build | |
run: make build | |
- name: Test and generate coverage report | |
run: make cover | |
- name: Upload coverage to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
integration-test: | |
name: Integration Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ "1.21.x", "1.22.x" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: true | |
- name: Load cached dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Download dependencies | |
run: go mod download | |
- name: Run integration tests | |
run: make integration-test |