-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (99 loc) · 3.05 KB
/
go-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
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
98
99
100
101
102
103
104
105
---
# Test built docker images by building simple projects inside them
name: go-test
on:
pull_request:
pull_request_review:
types: ['submitted']
merge_group:
push:
branches: ['main']
tags: ['v*']
permissions:
contents: read
jobs:
# Status check for all jobs below
# This is to allow SKIPPED be considered as SUCCESS
status-check-go-test:
runs-on: ubuntu-latest
if: always()
needs:
- go-test-resource-hogs
- go-test
steps:
- name: Check status
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
# Check we jobs should be ran or skipped
skip-check:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
changes:
- '.github/workflows/go-test.yml'
- 'action/**'
go-test-resource-hogs:
# Run tests that take up a lot of system resources separately
runs-on: ubuntu-latest
needs: skip-check
strategy:
matrix:
testregex: ['TestLinux', 'TestEdk2', 'TestCoreboot', 'TestStitching', 'TestURoot']
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install Taskfile
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
- name: Install go dependencies
run: |
cd action
go get -d ./...
- name: Run go test
run: |
cd action
go test -race -v -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out -run ${{ matrix.testregex }} ./...
go-test:
# Run all remaining light tests
runs-on: ubuntu-latest
needs: skip-check
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install Taskfile
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
- name: Install go dependencies
run: |
cd action
go get -d ./...
- name: Run go test
run: |
cd action
go test -race -v -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out -skip '(TestLinux|TestEdk2|TestCoreboot|TestStitching)' ./...