-
-
Notifications
You must be signed in to change notification settings - Fork 110
196 lines (177 loc) · 5.72 KB
/
ci.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
name: CI
permissions:
contents: read
on: [push, pull_request, workflow_dispatch]
jobs:
build-linux:
name: Build and test Linux executable
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, armv7, aarch64, ppc64le, riscv64, i386]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare
run: chmod u+x .github/workflows/*.sh
- name: Build for matrix.arch == amd64
if: ${{ matrix.arch == 'amd64' }}
run: |
sudo .github/workflows/generic-build.sh ${{ matrix.arch }}
sudo .github/workflows/ci-run-tests.sh
wget https://codecov.io/bash || true
bash bash -s /tmp/kcov-kcov || true
- name: Build for matrix.arch == i386
if: ${{ matrix.arch == 'i386' }}
run: |
chmod u+x ./.github/workflows/setup-i386.sh
sudo .github/workflows/setup-i386.sh
sudo schroot -c mychroot -- ./.github/workflows/generic-build.sh ${{ matrix.arch }}
- name: Build for matrix.arch == armv7, aarch64, ppc64le
if: ${{ matrix.arch == 'armv7' || matrix.arch == 'aarch64' || matrix.arch == 'ppc64le' || matrix.arch == 'riscv64' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
distro: ubuntu22.04
run: |
.github/workflows/generic-build.sh ${{ matrix.arch }}
.github/workflows/ci-run-tests.sh --no-ptrace
build-osx:
name: Build OSX executable (macos-latest)
runs-on: macos-latest
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare
run: |
chmod u+x .github/workflows/osx-build.sh .github/workflows/ci-run-tests.sh
brew install zlib bash cmake pkgconfig [email protected] [email protected] dwarfutils
- name: Build for OSX
run: |
sudo .github/workflows/osx-build.sh
sudo .github/workflows/ci-run-tests.sh
build-freebsd:
runs-on: ubuntu-22.04
name: Build and test FreeBSD executable
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: pkg install -y binutils cmake elfutils python bash git python2
run: |
chmod u+x .github/workflows/freebsd-build.sh .github/workflows/ci-run-tests.sh
.github/workflows/freebsd-build.sh x86_64
.github/workflows/ci-run-tests.sh
build-alpine:
runs-on: ubuntu-22.04
container:
image: alpine:3.20
# Needed to attach to a binary
options: --security-opt seccomp=unconfined
name: Build and test Alpine executable
steps:
- uses: actions/checkout@v4
- name: Install tools and dependencies
run: |
apk add --update --no-cache \
libcurl \
libdw \
zlib \
libgcc \
libstdc++ \
\
bash \
patchelf \
binutils \
python3 \
coreutils-env \
\
binutils-dev \
build-base \
cmake \
git \
curl-dev \
curl-static \
libdw \
openssl-dev \
ninja-build \
python3 \
zlib-dev \
elfutils-dev \
libstdc++-dev
- name: Run the tests
run: |
chmod u+x .github/workflows/freebsd-build.sh .github/workflows/ci-run-tests.sh
.github/workflows/freebsd-build.sh x86_64
.github/workflows/ci-run-tests.sh
build-and-push-docker-image:
name: Build and push to Docker Hub
needs: [build-linux, build-osx, build-freebsd]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {
BUILD_OS: "alpine",
IMAGE_TAG_SUFFIX: "-alpine",
PLATFORM: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/riscv64"
}
- {
BUILD_OS: "debian",
IMAGE_TAG_SUFFIX: "",
PLATFORM: "linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8"
}
environment:
name: "Docker Hub"
url: https://hub.docker.com/r/kcov/kcov
if: ${{ github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Docker Hub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push the docker image (latest/${{ matrix.BUILD_OS }})
run: .github/workflows/docker-build.sh ${{ matrix.BUILD_OS }}
env:
ACTION: push
IMAGE_TAG: kcov/kcov:latest${{ matrix.IMAGE_TAG_SUFFIX }}
# All (built on the base image):
# - linux/386
# - linux/amd64
# - linux/arm/v6 -> Only Alpine
# - linux/arm/v5 -> Only Debian
# - linux/arm/v7
# - linux/arm64/v8
# - linux/ppc64le
# - linux/mips64le
# - linux/riscv64 -> Only Alpine
# - linux/s390x
# Does not build:
# - linux/s390x
# - linux/mips64le
# No users on this platform:
# - linux/ppc64le
PLATFORM: ${{ matrix.PLATFORM }}