-
Notifications
You must be signed in to change notification settings - Fork 215
139 lines (123 loc) · 4.75 KB
/
build-test.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
name: Go
on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
merge_group:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
env:
# renovate: datasource=docker depName=docker.io/multiarch/qemu-user-static versioning=regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-(?<build>\\d+)$
QEMU_VERSION: 7.0.0-7
# renovate: datasource=docker depName=docker.io/buildpack-deps versioning=ubuntu
BUILDPACK_DEPS_VERSION: '22.04'
# renovate: datasource=npm depName=pnpm versioning=npm
PNPM_VERSION: '8.15.9'
jobs:
build-and-test-multi-arch:
name: Test on ${{ matrix.arch }}
runs-on: ubuntu-latest
timeout-minutes: 90
# Run steps on a matrix of 2 arch.
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
continue-on-error: true
with:
do_not_skip: '["schedule", "workflow_dispatch"]'
paths: |-
[
"**.go",
".github/workflows/build-test.yml",
".go-version",
".node-version",
"go.mod",
"go.sum",
"ui/**"
]
skip_after_successful_duplicate: false
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: ${{ steps.skip-check.outputs.should_skip != 'true' }}
- name: Set up Go
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: .go-version
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
version: ${{ env.PNPM_VERSION }}
- name: Set up Node.js
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version-file: .node-version
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Build
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
run: |
make build
- name: Test
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
run: |
make test ENABLE_RACE=yes
- name: Benchmark
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
run: |
make go/bench
- name: Archive generated artifacts
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
with:
name: parca-bin
if-no-files-found: error
path: |
bin
- name: 'Run ${{ matrix.arch }}'
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch != 'amd64' }}
run: |
# Register QEMU
docker run --rm --privileged "docker.io/multiarch/qemu-user-static:${QEMU_VERSION}" --reset -p yes
# Run platform specific based buildpack-deps image. Run it as a daemon in the background.
# Sleep the container for 1 day so that it keeps running until
# other steps are completed and the steps below can use the same container.
docker run \
--name=buildpack-deps \
--detach \
--platform 'linux/${{ matrix.arch }}' \
--volume /home/runner/work:/home/runner/work \
--workdir "${PWD}" \
"docker.io/buildpack-deps:${BUILDPACK_DEPS_VERSION}" \
bash -c 'uname -m && sleep 1d'
# Install Golang, which will be used to build the code.
- name: 'Setup Go on ${{ matrix.arch }}'
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch != 'amd64' }}
shell: docker exec buildpack-deps bash -e {0}
run: |
GO_VERSION="$(<.go-version)"
wget --directory-prefix=/tmp "https://dl.google.com/go/go${GO_VERSION}.linux-${{ matrix.arch }}.tar.gz"
tar -C /usr/local/ -xzf "/tmp/go${GO_VERSION}.linux-${{ matrix.arch }}.tar.gz"
export PATH="${PATH}:/usr/local/go/bin"
go version
# Run Go Tests. This is a very slow operation on ARM container.
- name: 'Test on ${{ matrix.arch }}'
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch != 'amd64' }}
shell: docker exec buildpack-deps bash -e {0}
run: |
export PATH="${PATH}:/usr/local/go/bin"
mkdir -p ui/packages/app/web/build
touch ui/packages/app/web/build/index.html
go test -buildvcs=false -v ./...