Skip to content

Commit 93c0790

Browse files
authored
ci: make just the task source of truth (#134)
Unify the Rust, markdown, site, and release build entrypoints behind shared just recipes so local verification and GitHub workflows stay aligned. This also adds a dedicated CI shell and removes the old scripts/ci.sh shim.
1 parent e8354b6 commit 93c0790

7 files changed

Lines changed: 109 additions & 68 deletions

File tree

.github/workflows/nightly.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ jobs:
3232
artifact: vimdoc-language-server-macos-x86_64
3333
steps:
3434
- uses: actions/checkout@v4
35-
- uses: dtolnay/rust-toolchain@stable
36-
with:
37-
targets: ${{ matrix.target }}
38-
- uses: Swatinem/rust-cache@v2
39-
- run: cargo build --release --target ${{ matrix.target }}
35+
- uses: cachix/install-nix-action@v31
36+
- run: nix develop .#ci --command just build-target ${{ matrix.target }}
4037
- name: Rename binary
4138
run:
4239
cp target/${{ matrix.target }}/release/vimdoc-language-server ${{

.github/workflows/quality.yaml

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
rust: ${{ steps.filter.outputs.rust }}
1515
markdown: ${{ steps.filter.outputs.markdown }}
1616
site: ${{ steps.filter.outputs.site }}
17+
infra: ${{ steps.filter.outputs.infra }}
1718
steps:
1819
- uses: actions/checkout@v4
1920
- uses: dorny/paths-filter@v3
@@ -27,78 +28,79 @@ jobs:
2728
- 'rust-toolchain.toml'
2829
- 'rustfmt.toml'
2930
markdown:
30-
- '*.md'
31+
- '**/*.md'
3132
site:
3233
- 'site/**'
34+
infra:
35+
- 'justfile'
36+
- 'flake.nix'
37+
- 'flake.lock'
38+
- '.github/workflows/**'
3339
3440
fmt:
3541
name: Rust Format Check
3642
needs: changes
37-
if: needs.changes.outputs.rust == 'true'
43+
if:
44+
needs.changes.outputs.rust == 'true' || needs.changes.outputs.infra ==
45+
'true'
3846
runs-on: ubuntu-latest
3947
steps:
4048
- uses: actions/checkout@v4
41-
- uses: dtolnay/rust-toolchain@stable
42-
with:
43-
components: rustfmt
44-
- uses: Swatinem/rust-cache@v2
45-
- run: cargo fmt --all -- --check
49+
- uses: cachix/install-nix-action@v31
50+
- run: nix develop .#ci --command just rust-format
4651

4752
clippy:
4853
name: Rust Lint Check
4954
needs: changes
50-
if: needs.changes.outputs.rust == 'true'
55+
if:
56+
needs.changes.outputs.rust == 'true' || needs.changes.outputs.infra ==
57+
'true'
5158
runs-on: ubuntu-latest
5259
steps:
5360
- uses: actions/checkout@v4
54-
- uses: dtolnay/rust-toolchain@stable
55-
with:
56-
components: clippy
57-
- uses: Swatinem/rust-cache@v2
58-
- run: cargo clippy --all-targets -- -D warnings
61+
- uses: cachix/install-nix-action@v31
62+
- run: nix develop .#ci --command just rust-lint
5963

6064
markdown:
6165
name: Markdown Format Check
6266
needs: changes
63-
if: needs.changes.outputs.markdown == 'true'
67+
if:
68+
needs.changes.outputs.markdown == 'true' || needs.changes.outputs.infra ==
69+
'true'
6470
runs-on: ubuntu-latest
6571
steps:
6672
- uses: actions/checkout@v4
6773
- uses: cachix/install-nix-action@v31
68-
- run: nix develop --command prettier --check "**/*.md"
74+
- run: nix develop .#ci --command just markdown-format
75+
76+
flake-check:
77+
name: Nix Flake Check
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
- uses: cachix/install-nix-action@v31
82+
- run: nix develop .#ci --command just flake-check
6983

7084
site-check:
7185
name: Astro Type Check
7286
needs: changes
73-
if: needs.changes.outputs.site == 'true'
87+
if:
88+
needs.changes.outputs.site == 'true' || needs.changes.outputs.infra ==
89+
'true'
7490
runs-on: ubuntu-latest
7591
steps:
7692
- uses: actions/checkout@v4
77-
- uses: actions/setup-node@v4
78-
with:
79-
node-version: 22
80-
- uses: pnpm/action-setup@v4
81-
with:
82-
version: latest
83-
- run: pnpm install --frozen-lockfile
84-
working-directory: site
85-
- run: pnpm check
86-
working-directory: site
93+
- uses: cachix/install-nix-action@v31
94+
- run: nix develop .#ci --command just site-check
8795

8896
site-format:
8997
name: Site Format Check
9098
needs: changes
91-
if: needs.changes.outputs.site == 'true'
99+
if:
100+
needs.changes.outputs.site == 'true' || needs.changes.outputs.infra ==
101+
'true'
92102
runs-on: ubuntu-latest
93103
steps:
94104
- uses: actions/checkout@v4
95-
- uses: actions/setup-node@v4
96-
with:
97-
node-version: 22
98-
- uses: pnpm/action-setup@v4
99-
with:
100-
version: latest
101-
- run: pnpm install --frozen-lockfile
102-
working-directory: site
103-
- run: pnpm format:check
104-
working-directory: site
105+
- uses: cachix/install-nix-action@v31
106+
- run: nix develop .#ci --command just site-format

.github/workflows/release.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ jobs:
3333
artifact: vimdoc-language-server-macos-x86_64
3434
steps:
3535
- uses: actions/checkout@v4
36-
- uses: dtolnay/rust-toolchain@stable
37-
with:
38-
targets: ${{ matrix.target }}
39-
- uses: Swatinem/rust-cache@v2
40-
- run: cargo build --release --target ${{ matrix.target }}
36+
- uses: cachix/install-nix-action@v31
37+
- run: nix develop .#ci --command just build-target ${{ matrix.target }}
4138
- name: Rename binary
4239
run: |
4340
cp target/${{ matrix.target }}/release/vimdoc-language-server ${{ matrix.artifact }}

.github/workflows/test.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ jobs:
1515
os: [ubuntu-latest, macos-latest]
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: dtolnay/rust-toolchain@stable
19-
- uses: Swatinem/rust-cache@v2
20-
- run: cargo test --all
18+
- uses: cachix/install-nix-action@v31
19+
- run: nix develop .#ci --command just test

flake.nix

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
overlays = [ (import rust-overlay) ];
1515
pkgs = import nixpkgs { inherit system overlays; };
1616
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
17+
ciToolchain = toolchain.override {
18+
targets = [
19+
"x86_64-unknown-linux-gnu"
20+
"aarch64-apple-darwin"
21+
"x86_64-apple-darwin"
22+
];
23+
};
24+
commonBuildInputs = [
25+
pkgs.cargo-edit
26+
pkgs.cargo-watch
27+
pkgs.nodejs_22
28+
pkgs.pnpm
29+
pkgs.prettier
30+
pkgs.just
31+
];
1732
in
1833
{
1934
packages.default = pkgs.rustPlatform.buildRustPackage {
@@ -24,14 +39,11 @@
2439
};
2540

2641
devShells.default = pkgs.mkShell {
27-
buildInputs = [
28-
toolchain
29-
pkgs.cargo-edit
30-
pkgs.cargo-watch
31-
pkgs.nodejs_22
32-
pkgs.pnpm
33-
pkgs.prettier
34-
];
42+
buildInputs = [ toolchain ] ++ commonBuildInputs;
43+
};
44+
45+
devShells.ci = pkgs.mkShell {
46+
buildInputs = [ ciToolchain ] ++ commonBuildInputs;
3547
};
3648
}
3749
);

justfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
default:
2+
@just --list
3+
4+
format: rust-format markdown-format site-format
5+
@:
6+
7+
lint: rust-lint site-check flake-check
8+
@:
9+
10+
test:
11+
cargo test --all
12+
13+
build:
14+
cargo build --release
15+
16+
rust-format:
17+
cargo fmt --all -- --check
18+
19+
rust-lint:
20+
cargo clippy --all-targets -- -D warnings
21+
22+
markdown-format:
23+
prettier --check .
24+
25+
site-install:
26+
cd site && pnpm install --frozen-lockfile
27+
28+
site-check: site-install
29+
cd site && pnpm check
30+
31+
site-format: site-install
32+
cd site && pnpm format:check
33+
34+
site-build: site-install
35+
cd site && pnpm build
36+
37+
flake-check:
38+
nix flake check --no-build
39+
40+
build-target target:
41+
cargo build --release --target {{target}}
42+
43+
ci: format lint test
44+
@:

scripts/ci.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)