add branch diff; fix bugs #39
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: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
workflow_dispatch: | |
jobs: | |
preflight: | |
runs-on: ubuntu-latest | |
outputs: | |
go_version: ${{ steps.get_go_version.outputs.go_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: get_go_version | |
name: Get Golang version | |
run: | | |
set -euo pipefail | |
go_version=$(sed -n 3p ${GITHUB_WORKSPACE}/go.mod | cut -d " " -f2) | |
echo "Golang version: ${go_version}" | |
echo "go_version=$go_version" >> "$GITHUB_OUTPUT" | |
build: | |
needs: preflight | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ needs.preflight.outputs.go_version }} | |
- name: Build | |
run: make build | |
- name: Test | |
run: make test |