Make changes to support testing individual commands, add a few tests #8
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: "Build and test" | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
merge_group: | |
push: | |
branches: | |
- 'main' | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GOPROXY: https://goproxy.githubapp.com/mod,https://proxy.golang.org/,direct | |
GOPRIVATE: "" | |
GONOPROXY: "" | |
GONOSUMDB: github.com/github/* | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Go private module access | |
run: | | |
echo "machine goproxy.githubapp.com login nobody password ${{ secrets.GOPROXY_TOKEN }}" >> $HOME/.netrc | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ vars.GOVERSION }} | |
check-latest: true | |
- name: Verify go.sum is up to date | |
run: | | |
go mod tidy | |
git diff --exit-code go.sum | |
if [ $? -ne 0 ]; then | |
echo "Error: go.sum has changed, please run `go mod tidy` and commit the result" | |
exit 1 | |
fi | |
- name: Build program | |
run: go build -v ./... | |
- name: Run tests | |
run: go test -race -cover ./... |