-
Notifications
You must be signed in to change notification settings - Fork 15
171 lines (166 loc) · 5.43 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
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"
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-02@sha256:1fdcbea395465eeac1cb49f8bb65f419d9b5e147a993f8cf912310a8ea0b62e6}" >> $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@v4
- 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: Pre-build embedded container images
uses: docker/[email protected]
with:
files: docker-bake.hcl
workdir: .
targets: interop_binaries_small
load: true
- 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 --no-run --locked --all-targets
- name: Test
id: test
env:
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: Upload container logs
# Only get logs on test failure
if: steps.test.outcome == 'failure'
uses: actions/upload-artifact@v3
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'
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
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_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
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