forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (136 loc) · 5.13 KB
/
e2e-tests-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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: e2e-tests-windows
on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
paths-ignore:
- "**/README.md"
pull_request:
paths-ignore:
- "**/README.md"
merge_group:
env:
# 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
jobs:
windows-file-changed:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Did windows files changed
run: echo "changed=$(./.github/workflows/scripts/is_changed_file_windows.sh )" >> "$GITHUB_OUTPUT"
- run: echo $(./.github/workflows/scripts/is_changed_file_windows.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} )
collector-build:
runs-on: windows-latest
needs: [windows-file-changed]
if: ${{ github.actor != 'dependabot[bot]' && ((contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') || needs.windows-file-changed.outputs.changed == 'true') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21.12"
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: Install dependencies
if: steps.go-mod-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Generate otelcontribcol files
run: make genotelcontribcol
- name: Build Collector
run: make otelcontribcol
- name: Upload Collector Binary
uses: actions/upload-artifact@v4
with:
name: collector-binary
path: ./bin/*
supervisor-test:
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') }}
needs: [collector-build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21.12"
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: Install dependencies
if: steps.go-mod-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Download Collector Binary
uses: actions/download-artifact@v4
with:
name: collector-binary
path: bin/
- name: Run opampsupervisor e2e tests
run: |
cd cmd/opampsupervisor
go test -v --tags=e2e
windows-supervisor-service-test:
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') }}
needs: [collector-build]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ~1.22.8
cache: false
- name: Cache Go
uses: actions/cache@v4
env:
cache-name: cache-go-modules
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: Download Collector Binary
uses: actions/download-artifact@v4
with:
name: collector-binary
path: bin/
- name: Build supervisor
run: cd cmd/opampsupervisor; go build
- name: Install supervisor as a service
run: |
New-Service -Name "opampsupervisor" -StartupType "Manual" -BinaryPathName "${PWD}\cmd\opampsupervisor --config ${PWD}\cmd\opampsupervisor\supervisor\testdata\supervisor_windows_service_test_config.yaml\"
eventcreate.exe /t information /id 1 /l application /d "Creating event provider for 'opampsupervisor'" /so opampsupervisor
- name: Test supervisor service
working-directory: ${{ github.workspace }}/cmd/opampsupervisor
run: |
go test -timeout 90s -run ^TestSupervisorAsService$ -v -tags=win32service
- name: Remove opampsupervisor service
if: always()
run: |
Remove-Service opampsupervisor
Remove-Item HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\opampsupervisor