-
Notifications
You must be signed in to change notification settings - Fork 15
194 lines (188 loc) · 6.62 KB
/
ci-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
name: ci-build
on:
push:
branches: [ main, release/** ]
pull_request:
workflow_dispatch:
inputs:
divviup_ts_interop_container:
description: divviup-ts container image tag for use in integration tests
required: false
type: string
jobs:
janus_build:
strategy:
matrix:
rust-toolchain: [
# MSRV policy
"stable minus 2 releases",
"stable",
]
runs-on: ubuntu-latest
permissions:
id-token: "write"
contents: "read"
needs: janus_interop_docker # We rely on this populating our Docker cache backend
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
steps:
- name: Set default input values
id: default-input-values
run: |
DIVVIUP_TS_INTEROP_CONTAINER= ${{ inputs.divviup_ts_interop_container }}
echo "divviup_ts_interop_container=${DIVVIUP_TS_INTEROP_CONTAINER:-us-west2-docker.pkg.dev/divviup-artifacts-public/divviup-ts/divviup_ts_interop_client:dap-draft-07@sha256:3c7ee0bc6e82bd24c8502b7630ac3ff6eb9c87c91498d5765cff0403683231cc}" >> $GITHUB_OUTPUT
- name: Get OS version
id: os-version
run: echo "release=$(lsb_release --release --short)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Setup Go toolchain
uses: actions/setup-go@v5
- name: Install Kind
# We should always make sure that the `kind` CLI we install is from the
# same release as the node image version used by
# `janus_core::test_util::kubernetes::EphemeralCluster`
run: go install sigs.k8s.io/[email protected]
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-toolchain }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
use: true
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ steps.os-version.outputs.release }}
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build minimal janus_messages
run: cargo build --profile ci --package janus_messages --no-default-features
- name: Build janus_core
run: cargo build --profile ci --package janus_core
# Note: keep Build & Test steps consecutive, and match flags other than `--no-run`.
- name: Build
run: cargo test --profile ci --locked --all-targets --no-run
- name: Test
id: test
env:
RUST_LOG: info
JANUS_E2E_LOGS_PATH: ${{ github.workspace }}/test-logs
DIVVIUP_TS_INTEROP_CONTAINER: ${{ steps.default-input-values.outputs.divviup_ts_interop_container }}
run: cargo test --profile ci --locked --all-targets
# Continue on error so we can upload logs
continue-on-error: true
- name: Build (Docker-specific tests)
# This matches the `cargo test` command invoked by `cargo xtask test-docker`, except for `--no-run`.
run: cargo test --profile ci --locked --package=janus_interop_binaries --package=janus_integration_tests --features=testcontainer --no-run
- name: Test (Docker)
id: test-docker
env:
RUST_LOG: info
JANUS_E2E_LOGS_PATH: ${{ github.workspace }}/test-logs
DIVVIUP_TS_INTEROP_CONTAINER: ${{ steps.default-input-values.outputs.divviup_ts_interop_container }}
run: cargo run --package xtask --profile=ci -- test-docker --profile=ci --locked
# Continue on error so we can upload logs
continue-on-error: true
- name: Upload container logs
# Only get logs on test failure
if: steps.test.outcome == 'failure' || steps.test-docker.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: container-logs
path: ${{ github.workspace }}/test-logs/
# Not all test failures yield log files
if-no-files-found: ignore
# Force overall job to fail if tests fail
- name: test status
if: steps.test.outcome == 'failure' || steps.test-docker.outcome == 'failure'
run: exit 1
janus_lints:
strategy:
matrix:
rust-toolchain: [
# MSRV policy
"stable minus 2 releases",
"stable",
]
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
JANUS_INTEROP_CONTAINER: skip
RUSTDOCFLAGS: "-D warnings"
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-toolchain }}
components: clippy, rustfmt
- name: Format
run: cargo fmt --message-format human -- --check
- name: Clippy
run: cargo clippy --profile ci --workspace --all-targets
- name: Clippy (all features)
run: cargo clippy --profile ci --workspace --all-targets --all-features
- name: Document
run: cargo doc --profile ci --workspace
- name: cargo-deny
uses: EmbarkStudios/[email protected]
with:
command: check bans licenses sources -A unmatched-organization
janus_docker:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
- run: echo "GIT_REVISION=$(git describe --always --dirty=-modified)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
use: true
- name: Build
uses: docker/[email protected]
with:
files: docker-bake.hcl
workdir: .
targets: janus
load: true
- run: docker run --rm janus_aggregator --help
- run: docker run --rm janus_garbage_collector --help
- run: docker run --rm janus_aggregation_job_creator --help
- run: docker run --rm janus_aggregation_job_driver --help
- run: docker run --rm janus_collection_job_driver --help
- run: docker run --rm janus_cli --help
- run: docker run --rm janus_db_migrator --help
janus_interop_docker:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
use: true
- name: Build
uses: docker/[email protected]
with:
files: docker-bake.hcl
workdir: .
targets: interop_binaries_small
rustsec_advisories:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: cargo-deny
uses: EmbarkStudios/[email protected]
with:
command: check advisories