Respect telemetry configuration when running as a Windows service #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-and-test-windows | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
windows-unittest: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ~1.21.5 | |
cache: false | |
- name: Cache Go | |
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 | |
env: | |
cache-name: cache-go-modules | |
with: | |
path: | | |
~\go\pkg\mod | |
~\AppData\Local\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Run Unit Tests | |
run: make gotest | |
windows-service-test: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ~1.21.5 | |
cache: false | |
- name: Cache Go | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
env: | |
cache-name: cache-go-modules | |
with: | |
path: | | |
~\go\pkg\mod | |
~\AppData\Local\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Make otelcorecol | |
run: make otelcorecol | |
- name: Install otelcorecol as a service | |
run: | | |
New-Service -Name "otelcorecol" -StartupType "Manual" -BinaryPathName "${PWD}\bin\otelcorecol_windows_amd64 --config ${PWD}\examples\local\otel-config.yaml" | |
eventcreate.exe /t information /id 1 /l application /d "Creating event provider for 'otelcorecol'" /so otelcorecol | |
- name: Test otelcorecol service | |
working-directory: ${{ github.workspace }}/otelcol | |
run: | | |
go test -timeout 30s -run ^TestCollectorAsService$ -v -tags=win32service | |
- name: Remove otelcorecol service | |
if: always() | |
run: | | |
Remove-Service otelcorecol | |
Remove-Item HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\otelcorecol |