-
-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (81 loc) · 1.98 KB
/
test-worker.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Run Tests
on:
push:
branches:
- main
- v*
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-latest
outputs:
test-source: ${{ steps.changed-files.outputs.test-source_any_modified == 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 50 # Assume PRs are less than 50 commits
- name: Find changed files
uses: tj-actions/changed-files@v45
id: changed-files
with:
files_yaml: |
common: &common
- .github/workflows/test-worker.yml
- Makefile
test-source:
- *common
- cmd/**
- go.*
- '*.go'
source:
name: "Test on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
needs: changed-files
if: ${{ needs.changed-files.outputs.test-source == 'true' }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- windows
- macos
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: go-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: go-${{ runner.os }}
- name: Test
run: |
set -xe
make test
check:
if: always()
name: Tests Successful
runs-on: ubuntu-latest
needs: [source]
steps:
- name: Whether the whole test suite passed
uses: re-actors/alls-green@v1.2.2
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}