Go CI #122
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 CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "0 0 1 * *" # run on the first of each month | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup gpg | |
run: | | |
gpg --batch --gen-key <<EOF | |
Key-Type: 1 | |
Key-Length: 2048 | |
Subkey-Type: 1 | |
Subkey-Length: 2048 | |
Name-Real: Package Manager | |
Name-Email: [email protected] | |
Expire-Date: 0 | |
%no-protection | |
EOF | |
- name: install go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 'stable' | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
# Rust is required to build some packages | |
- name: install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: install python dependencies | |
run: pip install twine build wheel | |
- name: install go dependencies | |
run: go install gotest.tools/gotestsum@latest | |
- name: run golangci-lint | |
uses: reviewdog/action-golangci-lint@v2 | |
- name: build | |
run: go build | |
- name: test | |
run: gotestsum --jsonfile unit-tests.json | |
- name: annotate tests | |
if: always() | |
uses: guyarb/[email protected] | |
with: | |
test-results: unit-tests.json | |
- name: notify slack on failure | |
uses: craftech-io/slack-action@v1 | |
if: failure() && github.event_name == 'schedule' | |
with: | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} |