Go #24
This file contains hidden or 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: | |
schedule: | |
# run every Sunday | |
- cron: '0 13 * * 0' | |
push: | |
branches: | |
- main | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install MySQL | |
run: | | |
sudo apt remove --purge mysql* -y | |
sudo apt autoremove -y | |
sudo apt autoclean | |
sudo DEBIAN_FRONTEND=noninteractive apt update | |
sudo DEBIAN_FRONTEND=noninteractive apt install -y mysql-server-8.0 | |
sudo systemctl start mysql.service | |
sudo systemctl status mysql.service | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Go | |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 | |
with: | |
go-version-file: ${{ github.workspace }}/go.mod | |
- name: Install development tools | |
run: make init | |
- name: Run checks/formatting | |
run: | | |
make check format | |
git diff --exit-code | |
- name: Run tests with code coverage | |
run: | | |
go clean -testcache | |
make test-cover | |
make test-race | |
- name: Upload coverage results | |
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 | |
with: | |
files: cover.out | |
flags: agent | |
fail_ci_if_error: false | |
- name: Run debug commands on failure | |
if: ${{ failure() }} | |
run: | | |
env | sort | |
go env | sort | |
git status |