build: update go versions #23
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
--- | |
# Github Actions build for swift | |
# -*- compile-command: "yamllint -f parsable build.yml" -*- | |
name: build | |
# Trigger the workflow on push or pull request | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
manual: | |
required: true | |
default: true | |
jobs: | |
build: | |
if: ${{ github.repository == 'ncw/swift' || github.event.inputs.manual }} | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
job_name: ['go1.22', 'go1.21', 'go1.20'] | |
include: | |
- job_name: go1.22 | |
os: ubuntu-latest | |
go: '1.22.x' | |
gotests: true | |
integrationtest: true | |
check: true | |
- job_name: go1.21 | |
os: ubuntu-latest | |
go: '1.21.x' | |
gotests: true | |
integrationtest: true | |
check: false | |
- job_name: go1.20 | |
os: ubuntu-latest | |
go: '1.20.x' | |
gotests: true | |
integrationtest: true | |
check: false | |
name: ${{ matrix.job_name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
stable: 'false' | |
go-version: ${{ matrix.go }} | |
- name: Print Go version and environment | |
shell: bash | |
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 | |
- name: Go module cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build | |
shell: bash | |
run: | | |
go build ./... | |
- name: Unit tests | |
shell: bash | |
run: | | |
go test -v | |
if: matrix.gotests | |
- name: Integration tests | |
shell: bash | |
run: | | |
./integration_test.sh | |
if: matrix.integrationtest | |
- name: Code quality test | |
uses: golangci/golangci-lint-action@v2 | |
with: | |
# Version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | |
version: latest | |
if: matrix.check |