-
Notifications
You must be signed in to change notification settings - Fork 2.4k
98 lines (96 loc) · 3.39 KB
/
build-and-test-windows.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
name: build-and-test-windows
on:
push:
branches:
- "main"
- "releases/**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
merge_group:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
env:
TEST_RESULTS: testbed/tests/results/junit/results.xml
# Make sure to exit early if cache segment download times out after 2 minutes.
# We limit cache download as a whole to 5 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
# Do not cancel this workflow on main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
windows-unittest-matrix:
strategy:
fail-fast: false
matrix:
group:
- receiver-0
- receiver-1
- receiver-2
- receiver-3
- processor-0
- processor-1
- exporter-0
- exporter-1
- exporter-2
- exporter-3
- extension
- connector
- internal
- pkg
- cmd-0
- cmd-1
- other
runs-on: windows-latest
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }}
env:
# Limit memory usage via GC environment variables to avoid OOM on GH runners, especially for `cmd/otelcontribcol`,
# see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/28682#issuecomment-1802296776
GOGC: 50
GOMEMLIMIT: 2GiB
steps:
- uses: actions/checkout@v4
- name: install IIS
run: Install-WindowsFeature -name Web-Server -IncludeManagementTools
- uses: actions/setup-go@v5
with:
go-version: "1.22.8"
cache: false
- name: Cache Go
id: go-mod-cache
timeout-minutes: 25
uses: actions/cache@v4
with:
path: |
~\go\pkg\mod
~\AppData\Local\go-build
key: go-build-cache-${{ runner.os }}-${{ matrix.group }}-go-${{ hashFiles('**/go.sum') }}
- name: Ensure required ports in the dynamic range are available
run: |
& ${{ github.workspace }}\.github\workflows\scripts\win-required-ports.ps1
- name: Build shared test tools
# If component tests share Makefile targets they need to be added here to avoid
# concurrent component tests clashing when building such targets. This applies
# specifically to Windows, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34691
run: make "$(${PWD} -replace '\\', '/')/.tools/gotestsum"
- name: Run Unit tests
run: make -j2 gotest GROUP=${{ matrix.group }}
windows-unittest:
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }}
runs-on: windows-latest
needs: [windows-unittest-matrix]
steps:
- name: Print result
run: echo ${{ needs.windows-unittest-matrix.result }}
- name: Interpret result
shell: bash
run: |
if [[ success == ${{ needs.windows-unittest-matrix.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi