-
Notifications
You must be signed in to change notification settings - Fork 8
115 lines (93 loc) · 3.07 KB
/
snapshot.yaml
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
name: Build PR Snapshots
on:
pull_request:
branches: [main]
env:
# renovate: datasource=golang-version depName=go
GO_VERSION: "1.23.3"
jobs:
build:
name: Build
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- uses: anchore/sbom-action/[email protected]
- name: Cache tools
id: cache-tools
uses: actions/cache@v4
with:
path: .tools
key: snapshot-tools-${{ runner.os }}-${{ hashFiles('internal/tools/go.sum') }}
- name: Install tools
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
mkdir -p .tools
touch .tools/*
make install-tools
- name: Generate source files
run: make generate
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: snapshot-mods-${{ runner.os }}-${{ hashFiles('build/go.sum') }}
- name: Create Snapshot for Pull Request
run: make snapshot
- name: Upload Pull Request Preview
uses: actions/upload-artifact@v4
with:
name: otelcol_dynatrace_${{ github.event.pull_request.number }}_${{ github.run_number }}
path: dist/*
- name: Upload linux service packages
uses: actions/upload-artifact@v4
with:
name: linux-packages
path: |
dist/dynatrace-otel-collector_*_Linux_x86_64.deb
dist/dynatrace-otel-collector_*_Linux_x86_64.rpm
dist/dynatrace-otel-collector_*_Linux_arm64.deb
dist/dynatrace-otel-collector_*_Linux_arm64.rpm
dist/metadata.json
linux-package-tests:
name: Test Linux Packages
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
os: ["deb", "rpm"]
arch: ["x86_64", "arm64"]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- name: Download linux service packages
uses: actions/download-artifact@v4
with:
name: linux-packages
path: linux-packages
- name: Parse metadata file
id: parse-metadata
run: |
metadata=`cat ./linux-packages/metadata.json`
echo "metadata=$metadata" >> "$GITHUB_OUTPUT"
- name: Extract version number
id: extract-version
run: echo "version=${{ fromJson(steps.parse-metadata.outputs.metadata).version }}" >> "$GITHUB_OUTPUT"
- name: Test
run: make package-test ARCH=${{ matrix.arch }} PACKAGE_PATH=linux-packages/dynatrace-otel-collector_${{ steps.extract-version.outputs.version }}_Linux_${{ matrix.arch }}.${{ matrix.os }}