Update Go version and GHA #18
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
ci: | |
name: Run CI | |
env: | |
# Setting GOTOOLCHAIN to local tells go | |
# to to use the bundled Go version rather | |
# than fetching the toolchain according to | |
# toolchain directive found in go.mod. | |
GOTOOLCHAIN: local | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
go: | |
- '1.22' | |
- '1.23' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
# copy-pasta from https://github.com/caddyserver/caddy/blob/master/.github/workflows/ci.yml | |
- name: Print Go version and environment | |
id: vars | |
run: | | |
printf "Using go at: $(which go)\n" | |
printf "Go version: $(go version)\n" | |
printf "\n\nGo environment:\n\n" | |
go env | |
printf "\n\nSystem environment:\n\n" | |
env | |
echo "go_cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
- name: Cache the build cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.go_cache }} | |
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum', '**/go.mod') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.go }}-go-ci- | |
- name: Get dependencies | |
run: | | |
go mod download | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
lint: | |
name: Run golangci linter | |
env: | |
# Setting GOTOOLCHAIN to local tells go | |
# to to use the bundled Go version rather | |
# than fetching the toolchain according to | |
# toolchain directive found in go.mod. | |
GOTOOLCHAIN: local | |
timeout-minutes: 5 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
go: | |
- '1.22' | |
- '1.23' | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.61 |