updated workflow of CI
This commit was merged in pull request #1.
This commit is contained in:
+63
-18
@@ -1,4 +1,7 @@
|
||||
# Runs on pull requests: unit tests plus a compile check.
|
||||
# Split into separate jobs (Odin, API, Infra) so they can run concurrently,
|
||||
# and gated by changed paths so each only runs when its code changes.
|
||||
# Infra always runs regardless of what changed.
|
||||
|
||||
name: CI
|
||||
|
||||
@@ -16,21 +19,38 @@ env:
|
||||
ODIN_VERSION: dev-2026-07
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Unit tests
|
||||
changes:
|
||||
name: Detect changed paths
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
outputs:
|
||||
odin: ${{ steps.filter.outputs.odin }}
|
||||
api: ${{ steps.filter.outputs.api }}
|
||||
steps:
|
||||
- uses: dorny/paths-filter@v4
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
odin:
|
||||
- 'src/**'
|
||||
- 'lib/**'
|
||||
- 'scripts/**'
|
||||
- 'odinfmt.json'
|
||||
api:
|
||||
- 'api/**'
|
||||
|
||||
odin:
|
||||
name: Odin unit tests and build
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.odin == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.26'
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install Odin ${{ env.ODIN_VERSION }}
|
||||
run: scripts/install_odin.sh
|
||||
|
||||
@@ -54,16 +74,18 @@ jobs:
|
||||
mkdir -p bin
|
||||
odin build src -collection:lib=lib/local -o:speed -out:bin/desi_explorer
|
||||
|
||||
- name: Run Go tests
|
||||
run: |
|
||||
cd infra
|
||||
go mod download
|
||||
go test ./...
|
||||
api:
|
||||
name: API unit tests and lint
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.api == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Vet Go code
|
||||
run: |
|
||||
cd infra
|
||||
go vet ./...
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Test Rust API
|
||||
run: |
|
||||
@@ -79,3 +101,26 @@ jobs:
|
||||
run: |
|
||||
cd api
|
||||
cargo fmt --all --check
|
||||
|
||||
infra:
|
||||
name: Infra unit tests and vet
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.26'
|
||||
|
||||
- name: Run Go tests
|
||||
run: |
|
||||
cd infra
|
||||
go mod download
|
||||
go test ./...
|
||||
|
||||
- name: Vet Go code
|
||||
run: |
|
||||
cd infra
|
||||
go vet ./...
|
||||
|
||||
Reference in New Issue
Block a user