Context Management #34
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: ci | |
on: | |
push: | |
branches: | |
- main | |
- draft | |
pull_request: | |
branches: | |
- main | |
env: | |
CODECOV_TOKEN: 9640dcb9-e7ac-4292-94a0-47cc03dca390 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: . | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- name: Update packages list | |
run: sudo apt-get update | |
- name: Install dependencies | |
run: sudo apt-get install -y openssl libsodium-dev | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- id: go-cache-paths | |
run: | | |
echo "::set-output name=go-build::$(go env GOCACHE)" | |
echo "::set-output name=go-mod::$(go env GOMODCACHE)" | |
- name: Go Build Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-build }} | |
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | |
- name: Go Mod Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-mod }} | |
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3.3.0 | |
with: | |
args: "--out-${NO_FUTURE}format colored-line-number --timeout 5m" | |
working-directory: . | |
skip-pkg-cache: true | |
skip-build-cache: true | |
tidy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: zencargo/github-action-go-mod-tidy@v1 | |
with: | |
path: . | |
go-version: 1.22 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Update packages list | |
run: sudo apt-get update | |
- name: Install dependencies | |
run: sudo apt-get install -y openssl libsodium-dev | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- name: Set up Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Test | |
run: make test-cov | |
env: | |
GOPATH: /home/runner/work/go | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |