-
Notifications
You must be signed in to change notification settings - Fork 42
51 lines (50 loc) · 1.44 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.18.x, 1.22.x, 1.23.x]
platform: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-latest, macos-12, macos-14]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Find go.sum files
id: gosum
shell: bash
run: |
echo 'files<<EOF' >> "$GITHUB_OUTPUT"
git ls-files '*/go.sum' >> "$GITHUB_OUTPUT"
echo 'EOF' >> "$GITHUB_OUTPUT"
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: ${{ steps.gosum.outputs.files }}
- name: Set PACKAGES env
if: ${{ matrix.go-version == '1.18.x' }}
run: |
# This corresponds with the list in Makefile:1, but omits the "userns"
# and "capability" modules, which require go1.21 as minimum.
echo 'PACKAGES=mountinfo mount sequential signal symlink user' >> $GITHUB_ENV
- name: go mod tidy
run: |
make foreach CMD="go mod tidy"
git diff --exit-code
- name: go fix
run: |
make foreach CMD="go fix"
git diff --exit-code
- name: Lint
run: make lint
- name: Cross build
if: ${{ runner.os == 'Linux' }}
run: make cross
- name: Test
run: |
uname -a
make test