-
Notifications
You must be signed in to change notification settings - Fork 206
158 lines (129 loc) · 4.63 KB
/
test-linux.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: test-linux
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- '*.asciidoc'
- 'docs/**'
pull_request:
paths-ignore:
- '*.md'
- '*.asciidoc'
- 'docs/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
pack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
with:
rust: 'true'
- name: Format
run: ./build.sh format
- name: Package
run: ./build.sh pack
- uses: actions/upload-artifact@v3
if: github.event_name == 'push' && startswith(github.ref, 'refs/heads')
with:
name: snapshoty-linux
path: build/output/*
retention-days: 1
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- name: Build
shell: bash
run: dotnet build -c Release --verbosity minimal
- name: 'Tests: Unit'
uses: ./.github/workflows/test
with:
name: 'unit'
filter: 'FullyQualifiedName!~Elastic.Apm.StartupHook.Tests&FullyQualifiedName!~Elastic.Apm.Profiler.Managed.Tests&FullyQualifiedName!~Elastic.Apm.Azure'
azure-tests:
runs-on: ubuntu-latest
if: |
github.event_name != 'pull_request'
|| github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
with:
azure: 'true'
- name: Build
shell: bash
run: dotnet build -c Release --verbosity minimal
- name: 'Read credentials'
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
method: approle
secrets: |
secret/apm-team/ci/apm-agent-dotnet-azure client_id | ARM_CLIENT_ID ;
secret/apm-team/ci/apm-agent-dotnet-azure client_secret | ARM_CLIENT_SECRET ;
secret/apm-team/ci/apm-agent-dotnet-azure subscription_id | ARM_SUBSCRIPTION_ID ;
secret/apm-team/ci/apm-agent-dotnet-azure tenant_id | ARM_TENANT_ID
- name: 'Login to Azure'
run: |
az login --service-principal --username ${{ env.ARM_CLIENT_ID }} --password ${{ env.ARM_CLIENT_SECRET }} --tenant ${{ env.ARM_TENANT_ID }}
az account set --subscription ${{ env.ARM_SUBSCRIPTION_ID }}
echo "AZURE_RESOURCE_GROUP_PREFIX=ci-dotnet-${GITHUB_RUN_ID}" >> ${GITHUB_ENV}
- name: 'Tests: Azure'
uses: ./.github/workflows/test
with:
name: 'azure'
filter: 'FullyQualifiedName~Elastic.Apm.Azure'
- name: 'Teardown tests infra'
if: ${{ always() }}
run: |
for group in $(az group list --query "[?name | starts_with(@,'${{ env.AZURE_RESOURCE_GROUP_PREFIX }}')]" --out json | jq .[].name --raw-output); do
az group delete --name "${group}" --no-wait --yes
done
startup-hook-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- name: Build agent-zip
run: ./build.sh agent-zip
- name: 'Tests: StartupHooks'
uses: ./.github/workflows/test
with:
name: 'startuphooks'
project: 'test/startuphook/Elastic.Apm.StartupHook.Tests/Elastic.Apm.StartupHook.Tests.csproj'
profiler-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
id: bootstrap
uses: ./.github/workflows/bootstrap
with:
rust: 'true'
- name: Build profiler
run: ./build.sh profiler-zip
- name: 'Tests: Profiler'
uses: ./.github/workflows/test
with:
name: 'profiler'
project: 'test/profiler/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj'
- name: Build Profiler Docker Image
run: |
docker build . -t docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }} \
--build-arg AGENT_ZIP_FILE=build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip