-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (62 loc) · 1.82 KB
/
unit-tests.yaml
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
name: Unit Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 6 * * *'
permissions:
actions: write # Needed for skip-duplicate-jobs job
contents: read
jobs:
# Special job which automatically cancels old runs for the same branch, prevents runs for the
# same file set which has already passed, etc.
pre_job:
name: Skip Duplicate Jobs Pre Job
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
with:
cancel_others: 'true'
github_token: ${{ github.token }}
build:
strategy:
# keep in sync with https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/.github/workflows/build-and-test.yml#L237
matrix:
go: ['1.23', '1.22']
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.ref_name == 'main' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: |
go.sum
- name: Run go mod vendor
run: |
go mod vendor
- name: Code tests
timeout-minutes: 15
run: |
make test
- name: Run Tests Many Times
timeout-minutes: 30
# Run test multiple times to check for flaky tests
if: github.ref_name == 'main'
run: |
make test-many-times COUNT=2