Skip to content

Commit 2caf1b3

Browse files
authored
Merge pull request #1613 from o1-labs/fix-docker-workflow-v0.18.0
Fix Docker workflow for v0.18.0 release
2 parents 72fd9e9 + 1b327a5 commit 2caf1b3

File tree

10 files changed

+199
-61
lines changed

10 files changed

+199
-61
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Load Versions
2+
description: Load version numbers from centralized config file
3+
4+
outputs:
5+
rust-stable:
6+
description: "Rust stable version"
7+
value: ${{ steps.load.outputs.rust-stable }}
8+
rust-nightly:
9+
description: "Rust nightly version"
10+
value: ${{ steps.load.outputs.rust-nightly }}
11+
ocaml-version:
12+
description: "OCaml version"
13+
value: ${{ steps.load.outputs.ocaml-version }}
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Load version configuration
19+
id: load
20+
shell: bash
21+
run: |
22+
VERSIONS_FILE="${{ github.action_path }}/../../config/versions.yaml"
23+
24+
# Read versions from YAML file using yq
25+
RUST_STABLE=$(yq eval '.rust.stable' "$VERSIONS_FILE")
26+
RUST_NIGHTLY=$(yq eval '.rust.nightly' "$VERSIONS_FILE")
27+
OCAML_VERSION=$(yq eval '.ocaml.version' "$VERSIONS_FILE")
28+
29+
# Set outputs
30+
echo "rust-stable=$RUST_STABLE" >> $GITHUB_OUTPUT
31+
echo "rust-nightly=$RUST_NIGHTLY" >> $GITHUB_OUTPUT
32+
echo "ocaml-version=$OCAML_VERSION" >> $GITHUB_OUTPUT
33+
34+
# Also set as environment variables for convenience
35+
echo "RUST_STABLE_VERSION=$RUST_STABLE" >> $GITHUB_ENV
36+
echo "RUST_NIGHTLY_VERSION=$RUST_NIGHTLY" >> $GITHUB_ENV
37+
echo "OCAML_VERSION=$OCAML_VERSION" >> $GITHUB_ENV
38+
39+
echo "Loaded versions:"
40+
echo " Rust stable: $RUST_STABLE"
41+
echo " Rust nightly: $RUST_NIGHTLY"
42+
echo " OCaml: $OCAML_VERSION"

.github/actions/setup-build-deps/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ runs:
1313
shell: bash
1414
run: |
1515
sudo apt update || true
16-
sudo apt install -y protobuf-compiler || true
16+
sudo apt install -y protobuf-compiler libpcap-dev || true
1717
1818
- name: Setup build dependencies (macOS)
1919
if: runner.os == 'macOS'
2020
shell: bash
2121
run: |
22-
brew install protobuf ocaml opam
22+
brew install protobuf ocaml opam libpcap
2323
2424
- name: Install cargo-nextest
2525
if: inputs.install-nextest == 'true'

.github/config/versions.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Centralized version definitions for CI workflows
2+
#
3+
# This file serves as the single source of truth for all version numbers
4+
# used across GitHub Actions workflows.
5+
#
6+
# When updating versions here, also update:
7+
# - rust-toolchain.toml (for rust.stable)
8+
# - Makefile (for rust.nightly as NIGHTLY_RUST_VERSION)
9+
# - website/scripts/setup/install-rust.sh
10+
# - website/docs/developers/getting-started.mdx
11+
12+
rust:
13+
stable: "1.84"
14+
nightly: "nightly"
15+
16+
ocaml:
17+
version: "4.14.2"

.github/workflows/build-reusable.yaml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ on:
77
required: true
88
type: string
99
description: "Operating system to build on"
10-
ocaml_version:
11-
required: false
12-
type: string
13-
default: "4.14.2"
14-
description: "OCaml version to use"
1510
cache-prefix:
1611
required: false
1712
type: string
@@ -45,18 +40,21 @@ jobs:
4540
- name: Git checkout
4641
uses: actions/checkout@v5
4742

43+
- name: Load versions
44+
uses: ./.github/actions/load-versions
45+
4846
- name: Setup build dependencies
4947
uses: ./.github/actions/setup-build-deps
5048

5149
- name: Use shared OCaml setting up steps
5250
uses: ./.github/actions/setup-ocaml
5351
with:
54-
ocaml_version: ${{ inputs.ocaml_version }}
52+
ocaml_version: ${{ env.OCAML_VERSION }}
5553

5654
- name: Setup Rust
5755
uses: ./.github/actions/setup-rust
5856
with:
59-
toolchain: 1.84
57+
toolchain: ${{ env.RUST_STABLE_VERSION }}
6058
cache-prefix: build-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
6159

6260
- name: Release build
@@ -88,18 +86,21 @@ jobs:
8886
- name: Git checkout
8987
uses: actions/checkout@v5
9088

89+
- name: Load versions
90+
uses: ./.github/actions/load-versions
91+
9192
- name: Setup build dependencies
9293
uses: ./.github/actions/setup-build-deps
9394

9495
- name: Use shared OCaml setting up steps
9596
uses: ./.github/actions/setup-ocaml
9697
with:
97-
ocaml_version: ${{ inputs.ocaml_version }}
98+
ocaml_version: ${{ env.OCAML_VERSION }}
9899

99100
- name: Setup Rust
100101
uses: ./.github/actions/setup-rust
101102
with:
102-
toolchain: 1.84
103+
toolchain: ${{ env.RUST_STABLE_VERSION }}
103104
cache-prefix: build-tests-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
104105

105106
- name: Build tests
@@ -114,18 +115,21 @@ jobs:
114115
- name: Git checkout
115116
uses: actions/checkout@v5
116117

118+
- name: Load versions
119+
uses: ./.github/actions/load-versions
120+
117121
- name: Setup build dependencies
118122
uses: ./.github/actions/setup-build-deps
119123

120124
- name: Use shared OCaml setting up steps
121125
uses: ./.github/actions/setup-ocaml
122126
with:
123-
ocaml_version: ${{ inputs.ocaml_version }}
127+
ocaml_version: ${{ env.OCAML_VERSION }}
124128

125129
- name: Setup Rust
126130
uses: ./.github/actions/setup-rust
127131
with:
128-
toolchain: 1.84
132+
toolchain: ${{ env.RUST_STABLE_VERSION }}
129133
cache-prefix: build-tests-webrtc-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
130134

131135
- name: Build tests
@@ -141,18 +145,21 @@ jobs:
141145
- name: Git checkout
142146
uses: actions/checkout@v5
143147

148+
- name: Load versions
149+
uses: ./.github/actions/load-versions
150+
144151
- name: Setup build dependencies
145152
uses: ./.github/actions/setup-build-deps
146153

147154
- name: Use shared OCaml setting up steps
148155
uses: ./.github/actions/setup-ocaml
149156
with:
150-
ocaml_version: ${{ inputs.ocaml_version }}
157+
ocaml_version: ${{ env.OCAML_VERSION }}
151158

152159
- name: Setup Rust
153160
uses: ./.github/actions/setup-rust
154161
with:
155-
toolchain: 1.84
162+
toolchain: ${{ env.RUST_STABLE_VERSION }}
156163
cache-prefix: build-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
157164

158165
- name: Build benchmarks
@@ -166,13 +173,16 @@ jobs:
166173
- name: Git checkout
167174
uses: actions/checkout@v5
168175

176+
- name: Load versions
177+
uses: ./.github/actions/load-versions
178+
169179
- name: Setup build dependencies
170180
uses: ./.github/actions/setup-build-deps
171181

172182
- name: Use shared OCaml setting up steps
173183
uses: ./.github/actions/setup-ocaml
174184
with:
175-
ocaml_version: ${{ inputs.ocaml_version }}
185+
ocaml_version: ${{ env.OCAML_VERSION }}
176186

177187
- name: Setup WebAssembly environment
178188
uses: ./.github/actions/setup-wasm

.github/workflows/doc-commands.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ concurrency:
2222
jobs:
2323
test-doc-commands:
2424
runs-on: ubuntu-22.04
25-
strategy:
26-
matrix:
27-
ocaml_version: [4.14.2]
2825
steps:
2926
- name: Git checkout
3027
uses: actions/checkout@v5
3128

29+
- name: Load versions
30+
uses: ./.github/actions/load-versions
31+
3232
- name: Setup build dependencies
3333
uses: ./.github/actions/setup-build-deps
3434

3535
- name: Setup Rust
3636
uses: ./.github/actions/setup-rust
3737
with:
3838
components: rustfmt
39-
toolchain: 1.84
39+
toolchain: ${{ env.RUST_STABLE_VERSION }}
4040
cache-prefix: test-doc-commands-v0
4141

4242
- name: Use shared OCaml setting up steps
4343
uses: ./.github/actions/setup-ocaml
4444
with:
45-
ocaml_version: ${{ matrix.ocaml_version }}
45+
ocaml_version: ${{ env.OCAML_VERSION }}
4646

4747
- name: Download circuits files
4848
uses: ./.github/actions/setup-circuits

.github/workflows/docker.yaml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,20 @@ jobs:
215215
- name: Git checkout
216216
uses: actions/checkout@v5
217217

218-
- name: Download frontend digest artifacts
219-
uses: actions/download-artifact@v6
220-
with:
221-
path: /tmp/digests
222-
pattern: frontend-digests-*
223-
merge-multiple: true
218+
- name: Set up environment variables
219+
run: |
220+
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
221+
echo "DOCKER_TAG=develop" >> $GITHUB_ENV
222+
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
223+
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
224+
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
225+
TAG="${GITHUB_REF#refs/tags/}"
226+
echo "DOCKER_TAG=${TAG}" >> $GITHUB_ENV
227+
elif [[ "${{ github.ref }}" == refs/heads/release/* ]]; then
228+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
229+
VERSION="${BRANCH_NAME#release/}"
230+
echo "DOCKER_TAG=${VERSION}" >> $GITHUB_ENV
231+
fi
224232
225233
- name: Set up Docker Buildx
226234
uses: docker/setup-buildx-action@v3
@@ -231,23 +239,13 @@ jobs:
231239
username: ${{ secrets.DOCKERHUB_USERNAME }}
232240
password: ${{ secrets.DOCKERHUB_TOKEN }}
233241

234-
- name: Get image digest
235-
id: digest
236-
run: |
237-
# Get the first digest from artifacts (we'll test with amd64)
238-
DIGEST=$(ls /tmp/digests | head -1)
239-
echo "digest=sha256:${DIGEST}" >> $GITHUB_OUTPUT
240-
241242
- name: Test frontend image with ${{ matrix.environment }} environment
242243
run: |
243-
# Pull the image by digest
244-
docker pull ${{ env.REGISTRY_FRONTEND_IMAGE }}@${{ steps.digest.outputs.digest }}
245-
246-
# Tag it for easier reference
247-
docker tag ${{ env.REGISTRY_FRONTEND_IMAGE }}@${{ steps.digest.outputs.digest }} test-frontend:${{ matrix.environment }}
244+
# Pull the image by tag
245+
docker pull ${{ env.REGISTRY_FRONTEND_IMAGE }}:${{ env.DOCKER_TAG }}
248246
249247
# Run the test script
250-
./.github/scripts/docker/test-frontend-docker.sh test-frontend:${{ matrix.environment }} ${{ matrix.environment }}
248+
./.github/scripts/docker/test-frontend-docker.sh ${{ env.REGISTRY_FRONTEND_IMAGE }}:${{ env.DOCKER_TAG }} ${{ matrix.environment }}
251249
252250
# Test Docker image build-info
253251
test-docker-build-info:

.github/workflows/lint.yaml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,66 @@ on:
88
jobs:
99
lint:
1010
timeout-minutes: 10
11-
name: Lint - ${{ matrix.os }} - Rust ${{ matrix.toolchain }}
11+
name: Lint - ${{ matrix.os }}
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
ocaml_version: [4.14.2]
1615
os: [ubuntu-24.04]
17-
toolchain: [1.84]
1816
steps:
1917
- uses: actions/checkout@v5
18+
19+
- name: Load versions
20+
uses: ./.github/actions/load-versions
21+
2022
- name: Setup build dependencies
2123
uses: ./.github/actions/setup-build-deps
24+
2225
- name: Use shared OCaml setting up steps
2326
uses: ./.github/actions/setup-ocaml
2427
with:
25-
ocaml_version: ${{ matrix.ocaml_version }}
28+
ocaml_version: ${{ env.OCAML_VERSION }}
29+
2630
- name: Setup Rust
2731
uses: ./.github/actions/setup-rust
2832
with:
29-
toolchain: ${{ matrix.toolchain }}
33+
toolchain: ${{ env.RUST_STABLE_VERSION }}
3034
components: clippy, rustfmt
31-
cache-prefix: lint-${{ matrix.toolchain }}-v0
35+
cache-prefix: lint-${{ env.RUST_STABLE_VERSION }}-v0
36+
3237
- name: Run make check
3338
run: make check
39+
3440
- name: Run make lint
3541
run: make lint
3642

3743
lint-tx-fuzzing:
3844
timeout-minutes: 10
39-
name: Lint transaction Fuzzing - ${{ matrix.os }} - Rust ${{ matrix.toolchain }}
45+
name: Lint transaction Fuzzing - ${{ matrix.os }}
4046
runs-on: ${{ matrix.os }}
4147
strategy:
4248
matrix:
4349
os: [ubuntu-24.04]
44-
# This should be in line with the verison in:
45-
# - Makefile
46-
# - ./github/workflows/docs.yaml
47-
# - ./github/workflows/fmt.yaml
48-
# - ./github/workflows/lint.yaml
49-
toolchain: [nightly]
50-
ocaml_version: [4.14.2]
5150
steps:
5251
- uses: actions/checkout@v5
52+
53+
- name: Load versions
54+
uses: ./.github/actions/load-versions
55+
5356
- name: Setup build dependencies
5457
uses: ./.github/actions/setup-build-deps
58+
5559
- name: Use shared OCaml setting up steps
5660
uses: ./.github/actions/setup-ocaml
5761
with:
58-
ocaml_version: ${{ matrix.ocaml_version }}
62+
ocaml_version: ${{ env.OCAML_VERSION }}
63+
5964
- name: Setup Rust
6065
uses: ./.github/actions/setup-rust
6166
with:
62-
toolchain: ${{ matrix.toolchain }}
67+
toolchain: ${{ env.RUST_NIGHTLY_VERSION }}
6368
components: clippy, rustfmt
64-
cache-prefix: lint-tx-fuzzing-${{ matrix.toolchain }}-v0
69+
cache-prefix: lint-tx-fuzzing-${{ env.RUST_NIGHTLY_VERSION }}-v0
70+
6571
- name: Run transaction Fuzzing check
6672
run: make check-tx-fuzzing
6773

@@ -74,10 +80,12 @@ jobs:
7480
os: [ubuntu-24.04]
7581
steps:
7682
- uses: actions/checkout@v5
83+
7784
- name: Install shellcheck
7885
run: |
7986
sudo apt update || true
8087
sudo apt install -y shellcheck || true
88+
8189
- name: Run shellcheck
8290
run: make lint-bash
8391

@@ -90,10 +98,12 @@ jobs:
9098
os: [ubuntu-24.04]
9199
steps:
92100
- uses: actions/checkout@v5
101+
93102
- name: Install hadolint
94103
run: |
95104
wget -O /tmp/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
96105
chmod +x /tmp/hadolint
97106
sudo mv /tmp/hadolint /usr/local/bin/hadolint
107+
98108
- name: Run hadolint
99109
run: make lint-dockerfiles

0 commit comments

Comments
 (0)