-
Notifications
You must be signed in to change notification settings - Fork 8
245 lines (205 loc) · 7.72 KB
/
main_build.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: DotNet Instrumentation Main Build
on:
push:
branches:
- main
- "release/v*"
permissions:
id-token: write
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: Build on Linux
if: runner.os == 'Linux'
run: bash build.sh
- name: Build on Windows
if: runner.os == 'Windows'
run: .\build.cmd
- name: Build on macOS
if: runner.os == 'macOS'
run: bash build.sh
- name: Test on Linux
if: runner.os == 'Linux'
run: dotnet test
- name: Test on Windows
if: runner.os == 'Windows'
run: dotnet test
- name: Test on macOS
if: runner.os == 'macOS'
run: dotnet test
- name: Upload Artifact on X64 Linux
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-x64
path: bin/AWS-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip
- name: Upload Artifact on Windows
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-windows
path: bin/AWS-opentelemetry-dotnet-instrumentation-windows.zip
- name: Upload Artifact on macOS
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-macOS
path: bin/AWS-opentelemetry-dotnet-instrumentation-macos.zip
build-arm:
runs-on: codebuild-adot-dotnet-runner-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: Build on Linux
run: bash build.sh
- name: Test on Linux
run: dotnet test
- name: Upload Artifact on ARM Linux
uses: actions/upload-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-arm64
path: bin/AWS-opentelemetry-dotnet-instrumentation-linux-glibc-arm64.zip
build-x64-musl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Build in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/alpine.dockerfile" ./docker
docker run --rm --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project mybuildimage \
/bin/sh -c 'git config --global --add safe.directory /project && dotnet test && ./build.sh'
- name: Upload Artifact on MUSL X64 Linux
uses: actions/upload-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-x64-musl
path: bin/AWS-opentelemetry-dotnet-instrumentation-linux-musl-x64.zip
build-arm-musl:
runs-on: codebuild-adot-dotnet-runner-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Build in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/alpine.dockerfile" ./docker
docker run --rm --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project mybuildimage \
/bin/sh -c 'git config --global --add safe.directory /project && dotnet test && ./build.sh'
- name: Upload Artifact on MUSL ARM Linux
uses: actions/upload-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-arm64-musl
path: bin/AWS-opentelemetry-dotnet-instrumentation-linux-musl-arm64.zip
release:
if: startsWith(github.ref, 'refs/heads/main')
needs: [build, build-arm, build-x64-musl, build-arm-musl]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download Linux x64 Artifact
uses: actions/download-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-x64
path: ./artifacts/linux/x64
- name: Download Windows Artifact
uses: actions/download-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-windows
path: ./artifacts/windows
- name: Download macOS Artifact
uses: actions/download-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-macOS
path: ./artifacts/macOS
- name: Download Linux ARM Artifact
uses: actions/download-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-arm64
path: ./artifacts/linux/arm64
- name: Download Linux ARM MUSL Artifact
uses: actions/download-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-arm64-musl
path: ./artifacts/linux/arm64-musl
- name: Download Linux X64 MUSL Artifact
uses: actions/download-artifact@v3
with:
name: AWS-opentelemetry-dotnet-instrumentation-linux-x64-musl
path: ./artifacts/linux/x64-musl
- name: Get Commit ID
id: get_commit
run: |
short_commit_id=$(echo ${GITHUB_SHA} | cut -c1-7)
echo "::set-output name=commit_id::${short_commit_id}"
- name: Create GH release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create main-build-${{steps.get_commit.outputs.commit_id}}-pre-release \
--target "$GITHUB_REF_NAME" \
--title "Main Build Pre-Release Commit ${{ steps.get_commit.outputs.commit_id }}" \
--notes "Release and Pre-Release from Main build"
- name: Upload Linux x64 Artifact to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "main-build-${{steps.get_commit.outputs.commit_id}}-pre-release" \
./artifacts/linux/x64/*.zip \
--clobber
- name: Upload Windows Artifact to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "main-build-${{steps.get_commit.outputs.commit_id}}-pre-release" \
./artifacts/windows/*.zip \
--clobber
- name: Upload macOS Artifact to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "main-build-${{steps.get_commit.outputs.commit_id}}-pre-release" \
./artifacts/macOS/*.zip \
--clobber
- name: Upload Linux ARM Artifact to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "main-build-${{steps.get_commit.outputs.commit_id}}-pre-release" \
./artifacts/linux/arm64/*.zip \
--clobber
- name: Upload Linux ARM MUSL Artifact to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "main-build-${{steps.get_commit.outputs.commit_id}}-pre-release" \
./artifacts/linux/arm64-musl/*.zip \
--clobber
- name: Upload Linux X64 MUSL Artifact to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "main-build-${{steps.get_commit.outputs.commit_id}}-pre-release" \
./artifacts/linux/x64-musl/*.zip \
--clobber