-
Notifications
You must be signed in to change notification settings - Fork 42
188 lines (176 loc) · 6.6 KB
/
ci.yml
File metadata and controls
188 lines (176 loc) · 6.6 KB
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
name: CI
on:
workflow_dispatch:
push:
branches: [devel, cloud]
tags: [v**]
pull_request:
branches: [main, cloud, devel]
env:
GITHUB_REGISTRY: ghcr.io
DEV_CONTAINER_DOCKER_IMAGE: bencher-dev-container
# Cancel in-progress runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Determine what changed
changes:
name: Detect Changes
runs-on: ubuntu-22.04
outputs:
rust: ${{ steps.filter.outputs.rust }}
console: ${{ steps.filter.outputs.console }}
action: ${{ steps.filter.outputs.action }}
api: ${{ steps.filter.outputs.api }}
cli: ${{ steps.filter.outputs.cli }}
docker: ${{ steps.filter.outputs.docker }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- 'Cargo.toml'
- 'Cargo.lock'
- 'lib/**'
- 'plus/**'
- 'services/api/**'
- 'services/cli/**'
- 'tasks/**'
- 'xtask/**'
console:
- 'services/console/**'
- 'lib/bencher_valid/**'
action:
- 'services/action/**'
- 'services/api/openapi.json'
api:
- 'services/api/**'
- 'lib/**'
- 'plus/**'
cli:
- 'services/cli/**'
- 'lib/**'
docker:
- 'services/api/Dockerfile'
- 'services/console/Dockerfile'
- 'docker/**'
lint:
name: Lint
uses: ./.github/workflows/lint.yml
with:
mold-version: "2.34.1"
typeshare-version: "1.13.2"
cli:
name: CLI
needs: changes
uses: ./.github/workflows/cli.yml
with:
bencher-version: "0.5.10"
mold-version: "2.34.1"
zig-build-version: "0.19.3"
zig-version: "0.13.0"
# Use minimum supported glibc version for Rust Tier 1
# https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-1-with-host-tools
glibc-version: "2.17"
check-cli: ${{ needs.changes.outputs.cli == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' }}
build-cli: ${{ needs.changes.outputs.cli == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') }}
secrets:
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
test:
name: Test
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') }}
uses: ./.github/workflows/test.yml
with:
mold-version: "2.34.1"
is-fork: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
secrets:
TEST_BILLING_KEY: ${{ secrets.TEST_BILLING_KEY }}
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
build:
name: Build
needs: changes
uses: ./.github/workflows/build.yml
with:
mold-version: "2.34.1"
wasm-pack-version: "0.12.1"
litestream-version: "0.3.13"
build-action: ${{ needs.changes.outputs.action == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') }}
build-docker: ${{ needs.changes.outputs.docker == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') }}
deploy:
name: Deploy
needs: [lint, cli, test, build]
if: ${{ github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) }}
uses: ./.github/workflows/deploy.yml
with:
mold-version: "2.34.1"
netlify-cli-version: "18.0.4"
deploy-dev: ${{ github.ref == 'refs/heads/devel' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) }}
deploy-test: ${{ github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' }}
deploy-prod: ${{ github.ref == 'refs/heads/cloud' }}
secrets:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
release:
name: Release
if: ${{ needs.changes.outputs.rust == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') }}
needs: [changes, lint, cli, test, build]
uses: ./.github/workflows/release.yml
with:
mold-version: "2.34.1"
ci-success:
name: CI Success
if: always()
needs: [lint, cli, test, build, deploy, release]
runs-on: ubuntu-22.04
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.lint.result }}" != "success" ]]; then
echo "Lint failed"
exit 1
fi
if [[ "${{ needs.cli.result }}" != "success" ]]; then
echo "CLI failed"
exit 1
fi
if [[ "${{ needs.test.result }}" != "success" && "${{ needs.test.result }}" != "skipped" ]]; then
echo "Test failed"
exit 1
fi
if [[ "${{ needs.build.result }}" != "success" ]]; then
echo "Build failed"
exit 1
fi
if [[ "${{ needs.deploy.result }}" != "success" && "${{ needs.deploy.result }}" != "skipped" ]]; then
echo "Deploy failed"
exit 1
fi
echo "All required jobs passed!"
build_dev_container:
name: Build dev container
if: ${{ github.ref == 'refs/heads/devel' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image
uses: devcontainers/ci@v0.3
with:
imageName: ${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.DEV_CONTAINER_DOCKER_IMAGE }}
cacheFrom: ${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.DEV_CONTAINER_DOCKER_IMAGE }}
push: always