Skip to content

Commit

Permalink
ci: proper schema attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
djdv committed May 30, 2021
1 parent 36d2928 commit 4bc5f9b
Showing 1 changed file with 45 additions and 28 deletions.
73 changes: 45 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,52 @@
on: [push, pull_request]
name: Checks
on:
push:
branches:
- master
pull_request:
types:
- synchronize
jobs:
test:
setup:
name: Setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Parse Go mod file
id: go_mod_parse
run: echo "::set-output name=go_mod_version::$(go mod edit -json | jq --raw-output .Go)"
- name: Setup specific Go version
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go_mod_parse.outputs.go_mod_version }}
- name: Restore cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
test:
name: Run tests
needs: setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Restore cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch Go version from mod file
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- name: Test
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- if: matrix.os == 'windows-latest'
run: go test -v -tags system .\...
- if: matrix.os != 'windows-latest'
# The CI has an old version of Go by default.
# setup-go installs the version we want, but
# root won't have that binary in its `secure_path`.
run: sudo $(which go) test -v -tags system ./...
- name: Windows
if: matrix.os == 'windows-latest'
run: go test -v -tags system .\...
- name: '*nix'
if: matrix.os != 'windows-latest'
# The CI has an old version of Go by default.
# setup-go installs the version we want, but
# root won't have that binary in its `secure_path`.
run: sudo $(which go) test -v -tags system ./...

0 comments on commit 4bc5f9b

Please sign in to comment.