Skip to content

Commit f26b5d3

Browse files
authored
perf(ci): implement granular steps with persistent workspace cache (#85)
* fix(devcontainer): switch base image to bookworm for glibc compatibility * refactor(ci): implement sequential Build & Verify jobs with granular steps * refactor(ci): use single-job sequential steps with local image reuse * perf(devcontainer): remove explicit CARGO_TARGET_DIR to enable incremental CI builds * perf(ci): persist CARGO_HOME in workspace for true incremental granular builds * debug(ci): add path and env logging to identify cache sharing issues * debug(ci): add persistence check for target directory across steps * perf(ci): use explicit CARGO_TARGET_DIR and CARGO_INCREMENTAL for granular steps * perf(ci): use persistent container via @devcontainers/cli for true incremental builds * debug(ci): Phase 1 diagnostic - verify build cache within single step * perf(ci): implement granular devcontainers/ci steps with persistent workspace paths
1 parent a230ae5 commit f26b5d3

2 files changed

Lines changed: 47 additions & 17 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/devcontainers/rust:1-bullseye
1+
FROM mcr.microsoft.com/devcontainers/rust:1-bookworm
22

33
# Install Node.js and other dependencies as root
44
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
@@ -21,12 +21,8 @@ RUN chown -R vscode:vscode /usr/local/cargo /usr/local/rustup
2121
# Switch to vscode user
2222
USER vscode
2323

24-
# Set CARGO_HOME to a location in user home to avoid permission issues in CI
25-
# and add it to PATH
26-
# ENV CARGO_HOME=/home/vscode/.cargo (Deferred until runtime)
27-
ENV PATH=$CARGO_HOME/bin:$PATH
28-
# Set CARGO_TARGET_DIR to a location in user home that is safe from volume mounts
29-
ENV CARGO_TARGET_DIR=/home/vscode/.cargo-target
24+
# Ensure pre-installed tools are always in PATH even if CARGO_HOME is overridden at runtime
25+
ENV PATH=/usr/local/cargo/bin:$PATH
3026

3127
# No pre-build (cache is disabled by user request)
3228

.github/workflows/ci.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
packages: read
1616

1717
jobs:
18-
build:
18+
verify:
1919
name: Build & Verify
2020
runs-on: ubuntu-latest
2121
steps:
@@ -33,10 +33,39 @@ jobs:
3333
username: ${{ github.actor }}
3434
password: ${{ secrets.GITHUB_TOKEN }}
3535

36+
- name: Build & Initialize Dev Container
37+
uses: devcontainers/ci@v0.3
38+
env:
39+
CI: true
40+
CARGO_HOME: ${{ github.workspace }}/.cargo
41+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
42+
CARGO_INCREMENTAL: 1
43+
with:
44+
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
45+
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
46+
push: never
47+
runCmd: cargo build
48+
49+
- name: Docgraph Check
50+
uses: devcontainers/ci@v0.3
51+
env:
52+
CI: true
53+
CARGO_HOME: ${{ github.workspace }}/.cargo
54+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
55+
CARGO_INCREMENTAL: 1
56+
with:
57+
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
58+
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
59+
push: never
60+
runCmd: cargo run -- check ./doc
61+
3662
- name: Rust Format Check
3763
uses: devcontainers/ci@v0.3
3864
env:
3965
CI: true
66+
CARGO_HOME: ${{ github.workspace }}/.cargo
67+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
68+
CARGO_INCREMENTAL: 1
4069
with:
4170
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
4271
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
@@ -47,6 +76,9 @@ jobs:
4776
uses: devcontainers/ci@v0.3
4877
env:
4978
CI: true
79+
CARGO_HOME: ${{ github.workspace }}/.cargo
80+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
81+
CARGO_INCREMENTAL: 1
5082
with:
5183
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
5284
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
@@ -57,6 +89,9 @@ jobs:
5789
uses: devcontainers/ci@v0.3
5890
env:
5991
CI: true
92+
CARGO_HOME: ${{ github.workspace }}/.cargo
93+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
94+
CARGO_INCREMENTAL: 1
6095
with:
6196
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
6297
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
@@ -69,6 +104,9 @@ jobs:
69104
uses: devcontainers/ci@v0.3
70105
env:
71106
CI: true
107+
CARGO_HOME: ${{ github.workspace }}/.cargo
108+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
109+
CARGO_INCREMENTAL: 1
72110
with:
73111
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
74112
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
@@ -82,21 +120,15 @@ jobs:
82120
uses: devcontainers/ci@v0.3
83121
env:
84122
CI: true
123+
CARGO_HOME: ${{ github.workspace }}/.cargo
124+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
125+
CARGO_INCREMENTAL: 1
85126
with:
86127
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
87128
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
88129
push: never
89130
runCmd: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
90131

91-
- name: Docgraph Check
92-
uses: devcontainers/ci@v0.3
93-
env:
94-
CI: true
95-
with:
96-
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
97-
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
98-
push: never
99-
runCmd: cargo run -- check ./doc
100132

101133
- name: Upload coverage report
102134
uses: actions/upload-artifact@v6
@@ -105,3 +137,5 @@ jobs:
105137
path: lcov.info
106138

107139

140+
141+

0 commit comments

Comments
 (0)