Skip to content

Commit

Permalink
gha: add basic test
Browse files Browse the repository at this point in the history
Test against the "oldest" supported version and the current version
of go. Go 1.17 is kept in this matrix as it is the minimum version
specified in go.mod, and maintaining compatibility with go 1.17 is
currently not much of a burden. Most projects using this module are
using newer versions than that, so we can drop the old version if
it becomes too much of a burden.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah authored and jeffwidman committed Jan 18, 2023
1 parent 8590eae commit 4ed9170
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: test
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
test:
permissions:
contents: read # for actions/checkout to fetch code
timeout-minutes: 10

strategy:
matrix:
# test against the "oldest" supported version and the current version
# of go. Go 1.17 is kept in this matrix as it is the minimum version
# specified in go.mod, and maintaining compatibility with go 1.17 is
# currently not much of a burden. Most projects using this module are
# using newer versions than that, so we can drop the old version if
# it becomes too much of a burden.
go-version: [1.17.x, stable]
os: [ubuntu-20.04, ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: go mod tidy
run: |
go mod tidy
git diff --exit-code
- name: Test
run: |
go test -exec "sudo -n" -v ./...

0 comments on commit 4ed9170

Please sign in to comment.