Skip to content

Commit a230ae5

Browse files
authored
fix(devcontainer): propagate CI env var for startup optimization (#84)
* fix(devcontainer): propagate CI env var and add workflow_dispatch to CI * refactor(ci): merge jobs into single sequential build with granular steps
1 parent 95d133b commit a230ae5

2 files changed

Lines changed: 47 additions & 21 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"remoteUser": "vscode",
99
"containerUser": "vscode",
1010
"remoteEnv": {
11-
"Z_AI_API_KEY": "${localEnv:Z_AI_API_KEY}"
11+
"Z_AI_API_KEY": "${localEnv:Z_AI_API_KEY}",
12+
"CI": "${localEnv:CI}"
1213
},
1314
"customizations": {
1415
"vscode": {

.github/workflows/ci.yml

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ "main" ]
66
pull_request:
77
branches: [ "main" ]
8+
workflow_dispatch:
89

910
env:
1011
CARGO_TERM_COLOR: always
@@ -14,8 +15,8 @@ permissions:
1415
packages: read
1516

1617
jobs:
17-
lint:
18-
name: Lint & Security
18+
build:
19+
name: Build & Verify
1920
runs-on: ubuntu-latest
2021
steps:
2122
- name: Set git default branch
@@ -32,7 +33,27 @@ jobs:
3233
username: ${{ github.actor }}
3334
password: ${{ secrets.GITHUB_TOKEN }}
3435

35-
- name: Build and Run Dev Container (Lint)
36+
- name: Rust Format Check
37+
uses: devcontainers/ci@v0.3
38+
env:
39+
CI: true
40+
with:
41+
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
42+
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
43+
push: never
44+
runCmd: cargo fmt -- --check
45+
46+
- name: Cargo Clippy
47+
uses: devcontainers/ci@v0.3
48+
env:
49+
CI: true
50+
with:
51+
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
52+
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
53+
push: never
54+
runCmd: cargo clippy -- -D warnings
55+
56+
- name: Security Audit (Rust)
3657
uses: devcontainers/ci@v0.3
3758
env:
3859
CI: true
@@ -41,42 +62,46 @@ jobs:
4162
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
4263
push: never
4364
runCmd: |
44-
cargo fmt -- --check
45-
cargo clippy -- -D warnings
4665
cargo audit
4766
(cd zed-extension && cargo audit)
67+
68+
- name: VSIX Lint & Audit
69+
uses: devcontainers/ci@v0.3
70+
env:
71+
CI: true
72+
with:
73+
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
74+
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
75+
push: never
76+
runCmd: |
4877
npm install --prefix vsix
4978
npm run lint --prefix vsix
5079
npm audit --prefix vsix
5180
52-
test:
53-
name: Test & Coverage
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: actions/checkout@v6
57-
58-
- name: Log in to GitHub Container Registry
59-
uses: docker/login-action@v3
81+
- name: Tests & Coverage
82+
uses: devcontainers/ci@v0.3
83+
env:
84+
CI: true
6085
with:
61-
registry: ghcr.io
62-
username: ${{ github.actor }}
63-
password: ${{ secrets.GITHUB_TOKEN }}
86+
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
87+
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
88+
push: never
89+
runCmd: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
6490

65-
- name: Build and Run Dev Container (Test)
91+
- name: Docgraph Check
6692
uses: devcontainers/ci@v0.3
6793
env:
6894
CI: true
6995
with:
7096
imageName: ghcr.io/${{ github.repository }}/docgraph-dev
7197
cacheFrom: ghcr.io/${{ github.repository }}/docgraph-dev
7298
push: never
73-
runCmd: |
74-
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
75-
cargo run -- check ./doc
99+
runCmd: cargo run -- check ./doc
76100

77101
- name: Upload coverage report
78102
uses: actions/upload-artifact@v6
79103
with:
80104
name: coverage-report
81105
path: lcov.info
82106

107+

0 commit comments

Comments
 (0)