Skip to content

Commit 02fb0c4

Browse files
Everything is CI
1 parent f6ec3a2 commit 02fb0c4

5 files changed

Lines changed: 94 additions & 42 deletions

File tree

.github/workflows/builds.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ jobs:
7171
- name: Pull LFS files
7272
run: git lfs pull
7373

74+
# Cargo's freshness check is mtime-based. A fresh `actions/checkout`
75+
# stamps every submodule source file with the checkout time, which is
76+
# newer than the cached target/ artifacts — so cargo rebuilds the whole
77+
# client-sdk-rust workspace (~6 min) even on an exact cargo-target cache
78+
# hit. Pin all submodule source files to a fixed, deterministic
79+
# timestamp (older than any cached artifact) so cargo treats them as
80+
# unchanged across runs and reuses the cached FFI build. Runs before the
81+
# cargo target cache is restored, so target/ does not yet exist and is
82+
# never touched. shell: bash so this also runs under Git Bash on Windows.
83+
- name: Stabilize Rust source mtimes for cargo freshness
84+
shell: bash
85+
run: |
86+
find client-sdk-rust -type f -not -path '*/.git/*' -exec touch -t 202001010000 {} +
87+
7488
# ---------- vcpkg caching for Windows ----------
7589
- name: Export GitHub Actions cache environment variables
7690
if: runner.os == 'Windows'

.github/workflows/ci.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
builds: ${{ steps.filter.outputs.builds }}
4343
tests: ${{ steps.filter.outputs.tests }}
4444
docs: ${{ steps.filter.outputs.docs }}
45+
docker_images: ${{ steps.filter.outputs.docker_images }}
4546
steps:
4647
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4748
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
@@ -51,44 +52,64 @@ jobs:
5152
builds:
5253
- src/**
5354
- include/**
55+
- benchmarks/**
5456
- cpp-example-collection/**
5557
- client-sdk-rust/**
5658
- cmake/**
57-
- scripts/**
59+
- docker/**
60+
- scripts/clang-format.sh
61+
- scripts/clang-tidy.sh
5862
- CMakeLists.txt
63+
- CMakePresets.json
5964
- build.sh
6065
- build.cmd
66+
- build.h.in
6167
- .build-info.json.in
6268
- vcpkg.json
63-
- CMakePresets.json
64-
- docker/Dockerfile.base
65-
- docker/Dockerfile.sdk
6669
- .clang-format
70+
- .clang-tidy
6771
- .github/workflows/ci.yml
6872
- .github/workflows/builds.yml
6973
tests:
7074
- src/**
7175
- include/**
7276
- client-sdk-rust/**
77+
- cmake/**
78+
- .token_helpers/**
7379
- CMakeLists.txt
7480
- CMakePresets.json
7581
- build.sh
7682
- build.cmd
83+
- build.h.in
84+
- .build-info.json.in
7785
- vcpkg.json
78-
- .token_helpers/**
7986
- .github/workflows/ci.yml
8087
- .github/workflows/tests.yml
8188
docs:
82-
# Quoted because YAML treats a leading `*` as an alias
83-
# reference and would otherwise reject this scalar.
84-
- "**/*.md"
89+
- README.md
8590
- include/**
86-
- src/**
8791
- docs/**
8892
- scripts/generate-docs.sh
8993
- .github/workflows/ci.yml
9094
- .github/workflows/generate-docs.yml
9195
- .github/workflows/publish-docs.yml
96+
docker_images:
97+
- src/**
98+
- include/**
99+
- client-sdk-rust/**
100+
- cmake/**
101+
- data/**
102+
- docker/Dockerfile.base
103+
- docker/Dockerfile.sdk
104+
- CMakeLists.txt
105+
- CMakePresets.json
106+
- build.sh
107+
- build.cmd
108+
- build.h.in
109+
- .build-info.json.in
110+
- .github/workflows/ci.yml
111+
- .github/workflows/docker-images.yml
112+
- .github/workflows/docker-validate.yml
92113
93114
builds:
94115
name: Builds
@@ -104,9 +125,8 @@ jobs:
104125
uses: ./.github/workflows/tests.yml
105126
secrets: inherit
106127

107-
# license-check and pin-check are cheap (seconds) and have no meaningful
108-
# path scope (any source change can affect license headers; any action
109-
# bump can affect pinning), so they always run.
128+
# license-check and pin-check are cheap (seconds) and broad enough that they
129+
# should run on every PR.
110130
license-check:
111131
name: License Check
112132
uses: ./.github/workflows/license_check.yml
@@ -120,3 +140,23 @@ jobs:
120140
needs: changes
121141
if: ${{ needs.changes.outputs.docs == 'true' || github.event_name != 'pull_request' }}
122142
uses: ./.github/workflows/generate-docs.yml
143+
144+
docker-images:
145+
name: Docker Images
146+
needs: changes
147+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changes.outputs.docker_images == 'true' }}
148+
permissions:
149+
contents: read
150+
packages: write
151+
uses: ./.github/workflows/docker-images.yml
152+
secrets: inherit
153+
154+
docker-validate:
155+
name: Docker Validate
156+
needs: docker-images
157+
if: ${{ needs.docker-images.result == 'success' }}
158+
permissions:
159+
contents: read
160+
packages: read
161+
uses: ./.github/workflows/docker-validate.yml
162+
secrets: inherit

.github/workflows/docker-images.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
name: Docker Images
22

33
on:
4-
push:
5-
branches: ["main"]
6-
paths:
7-
- src/**
8-
- include/**
9-
- client-sdk-rust/**
10-
- CMakeLists.txt
11-
- build.sh
12-
- build.cmd
13-
- build.h.in
14-
- .build-info.json.in
15-
- CMakePresets.json
16-
- cmake/**
17-
- data/**
18-
- docker/Dockerfile.base
19-
- docker/Dockerfile.sdk
4+
workflow_call: {}
205

216
permissions:
227
contents: read
@@ -89,7 +74,7 @@ jobs:
8974
fi
9075
9176
case "${path}" in
92-
docker/Dockerfile.sdk|src/*|include/*|client-sdk-rust/*|cmake/*|data/*|CMakeLists.txt|build.sh|build.cmd|build.h.in|.build-info.json.in|CMakePresets.json)
77+
docker/Dockerfile.sdk|src/*|include/*|client-sdk-rust/*|cmake/*|data/*|CMakeLists.txt|build.sh|build.cmd|build.h.in|.build-info.json.in|CMakePresets.json|.github/workflows/ci.yml|.github/workflows/docker-images.yml|.github/workflows/docker-validate.yml)
9378
sdk_changed=true
9479
;;
9580
esac

.github/workflows/docker-validate.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Docker Validate
22

33
on:
4-
workflow_run:
5-
workflows: ["Docker Images"]
6-
types: [completed]
4+
workflow_call: {}
75

86
permissions:
97
contents: read
@@ -17,10 +15,6 @@ jobs:
1715
validate-x64:
1816
name: Validate Docker image (linux-x64)
1917
runs-on: ubuntu-latest
20-
if: |
21-
github.event.workflow_run.conclusion == 'success' &&
22-
github.event.workflow_run.event == 'push' &&
23-
github.event.workflow_run.head_branch == 'main'
2418

2519
steps:
2620
- name: Resolve image name
@@ -29,7 +23,7 @@ jobs:
2923
run: |
3024
set -euo pipefail
3125
owner="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
32-
echo "sdk_image=ghcr.io/${owner}/client-sdk-cpp:sha-${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
26+
echo "sdk_image=ghcr.io/${owner}/client-sdk-cpp:sha-${{ github.sha }}" >> "$GITHUB_OUTPUT"
3327
3428
- name: Login to GHCR
3529
shell: bash
@@ -65,10 +59,6 @@ jobs:
6559
validate-arm64:
6660
name: Validate Docker image (linux-arm64)
6761
runs-on: ubuntu-24.04-arm
68-
if: |
69-
github.event.workflow_run.conclusion == 'success' &&
70-
github.event.workflow_run.event == 'push' &&
71-
github.event.workflow_run.head_branch == 'main'
7262

7363
steps:
7464
- name: Resolve image name
@@ -77,7 +67,7 @@ jobs:
7767
run: |
7868
set -euo pipefail
7969
owner="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
80-
echo "sdk_image=ghcr.io/${owner}/client-sdk-cpp:sha-${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
70+
echo "sdk_image=ghcr.io/${owner}/client-sdk-cpp:sha-${{ github.sha }}" >> "$GITHUB_OUTPUT"
8171
8272
- name: Login to GHCR
8373
shell: bash

.github/workflows/tests.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ jobs:
6767
- name: Pull LFS files
6868
run: git lfs pull
6969

70+
# Cargo's freshness check is mtime-based. A fresh `actions/checkout`
71+
# stamps every submodule source file with the checkout time, which is
72+
# newer than the cached target/ artifacts — so cargo rebuilds the whole
73+
# client-sdk-rust workspace (~6 min) even on an exact cargo-target cache
74+
# hit. Pin all submodule source files to a fixed, deterministic
75+
# timestamp (older than any cached artifact) so cargo treats them as
76+
# unchanged across runs and reuses the cached FFI build. Runs before the
77+
# cargo target cache is restored, so target/ does not yet exist and is
78+
# never touched. shell: bash so this also runs under Git Bash on Windows.
79+
- name: Stabilize Rust source mtimes for cargo freshness
80+
shell: bash
81+
run: |
82+
find client-sdk-rust -type f -not -path '*/.git/*' -exec touch -t 202001010000 {} +
83+
7084
# ---------- vcpkg caching for Windows (mirrors builds.yml) ----------
7185
- name: Export GitHub Actions cache environment variables
7286
if: runner.os == 'Windows'
@@ -308,6 +322,15 @@ jobs:
308322
- name: Pull LFS files
309323
run: git lfs pull
310324

325+
# See the test job for why this exists: pin submodule source mtimes to a
326+
# fixed timestamp so cargo treats the workspace as unchanged across runs
327+
# and reuses the cached FFI build instead of recompiling it (~6 min).
328+
# Runs before the cargo target cache is restored, so target/ is untouched.
329+
- name: Stabilize Rust source mtimes for cargo freshness
330+
shell: bash
331+
run: |
332+
find client-sdk-rust -type f -not -path '*/.git/*' -exec touch -t 202001010000 {} +
333+
311334
# Reclaim ~30GB on the runner. The debug+coverage object tree plus gcov
312335
# data is large; prior runs died mid-build from disk/memory pressure.
313336
- name: Free disk space

0 commit comments

Comments
 (0)