Skip to content

Commit 7df8eec

Browse files
ci: add GitHub Actions workflows for lints, tests, conventional commits, and docs
Added four workflow/action files modeled after hydro-project/hydro: - `.github/actions/use-sccache/action.yml` — composite action enabling sccache with GHA cache backend for Rust compilation caching. - `.github/workflows/ci.yml` — runs on push to main, PRs, and manual dispatch. Two jobs: `lint` (fmt, clippy, license/THIRD-PARTY check via generate-third-party.sh) and `test` (cargo test). Both use sccache and skip-duplicate-actions. Node.js is set up in lint for the npm license checker. - `.github/workflows/conventional_commits.yml` — validates PR titles match conventional commit types (feat, fix, docs, refactor, perf, test, chore, ci, revert) using amannn/action-semantic-pull-request. - `.github/workflows/docs.yml` — builds the documentation site by installing infinity-ui deps then docs deps and running `npm run build` in docs/. Uses Node 22 (current LTS) since the docs SSG requires `navigator.userAgent` which was added in Node 21+. Also ran `cargo fmt --all` to fix minor formatting issues. Co-authored-by: Infinity 🤖 <infinity@hydro.run> PR: #10
1 parent a5c612b commit 7df8eec

6 files changed

Lines changed: 162 additions & 2 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "use sccache"
2+
description: "enables sccache"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Run sccache-cache
7+
uses: mozilla-actions/sccache-action@65101d47ea8028ed0c98a1cdea8dd9182e9b5133 # v0.0.8
8+
9+
- name: Set Rust caching env vars
10+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
11+
with:
12+
script: |
13+
core.exportVariable('SCCACHE_GHA_ENABLED', 'true');
14+
core.exportVariable('RUSTC_WRAPPER', 'sccache');
15+
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on');

‎.github/workflows/ci.yml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions: {}
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
13+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
CARGO_INCREMENTAL: 0
18+
19+
jobs:
20+
pre_job:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
24+
steps:
25+
- id: skip_check
26+
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
27+
28+
lint:
29+
name: Lint
30+
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
31+
timeout-minutes: 30
32+
needs: pre_job
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout sources
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
37+
38+
- uses: ./.github/actions/use-sccache
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
42+
with:
43+
node-version: 20
44+
45+
- name: Check formatting
46+
run: cargo fmt --all --check
47+
48+
- name: Clippy
49+
run: cargo clippy --all-targets -- -D warnings
50+
51+
- name: Check licenses (THIRD-PARTY)
52+
run: |
53+
cargo install --locked cargo-about
54+
bash scripts/generate-third-party.sh
55+
git diff --exit-code THIRD-PARTY || (echo "THIRD-PARTY file is stale. Run 'bash scripts/generate-third-party.sh' and commit." && exit 1)
56+
57+
test:
58+
name: Test
59+
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
60+
timeout-minutes: 30
61+
needs: pre_job
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout sources
65+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
66+
67+
- uses: ./.github/actions/use-sccache
68+
69+
- name: Run tests
70+
run: cargo test --all-targets
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Conventional Commits
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- ready_for_review
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
main:
16+
name: Conventional Commits
17+
runs-on: ubuntu-latest
18+
if: ${{ !github.event.pull_request.draft }}
19+
steps:
20+
- uses: amannn/action-semantic-pull-request@e32d7e603df1aa1ba07e981f2a23455dee596825 # v5
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
with:
24+
types: |
25+
feat
26+
fix
27+
docs
28+
refactor
29+
perf
30+
test
31+
chore
32+
ci
33+
revert

‎.github/workflows/docs.yml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions: {}
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
13+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14+
15+
jobs:
16+
build:
17+
name: Build docs
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout sources
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
25+
with:
26+
node-version: 22
27+
cache: npm
28+
cache-dependency-path: |
29+
infinity-ui/package-lock.json
30+
docs/package-lock.json
31+
32+
- name: Install infinity-ui dependencies
33+
working-directory: infinity-ui
34+
run: npm ci
35+
36+
- name: Install docs dependencies
37+
working-directory: docs
38+
run: npm ci
39+
40+
- name: Build docs
41+
working-directory: docs
42+
run: npm run build

‎crates/infinity-agent-cli/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ async fn async_main(cli: Cli) -> Result<(), BoxError> {
178178
}
179179
install::run_update().await
180180
}
181-
},
181+
},
182182
Commands::Remote { action } => match action {
183183
RemoteCommands::Add { name, args } => {
184184
if args.first().map(|s| s.as_str()) != Some("ssh") {

‎crates/sandbox-core/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
pub mod git;
21
pub mod callback;
32
pub mod error;
3+
pub mod git;
44
pub mod jj;
55
pub mod metadata;
66
pub mod sandbox;

0 commit comments

Comments
 (0)