Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check CI step to be run on PRs #35

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
push:
branches:
- main
pull_request: { }
merge_group:
types:
- checks_requested
permissions:
contents: read
jobs:
build:
name: Build and check database and frontend
runs-on: "ubuntu-latest"
steps:
- name: Checkout project
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- name: Install npm dependencies
run: npm ci
working-directory: frontend
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
with:
toolchain: "stable"
- name: Rust cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84
with:
shared-key: "check"
- name: Clippy
run: cargo clippy --locked --all-targets --all-features --workspace # TODO -- -Dwarnings
- name: Test rust
run: cargo test --locked
- name: Download db-dump
run: wget --no-verbose https://static.crates.io/db-dump.tar.gz
- name: Build database
run: cargo run --locked --release --bin read-driver-db
- name: Copy generated database to frontend
run: cp full-crate-db.json frontend/src/
- name: Check frontend
run: npm run check || echo "TODO"
working-directory: frontend
- name: Build frontend
run: npm run build
working-directory: frontend
21 changes: 14 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@ on:
- main
jobs:
build:
name: Build database and Frontend
name: Build database and frontend
runs-on: "ubuntu-latest"
steps:
- name: Checkout project
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- name: Install npm dependencies
run: npm ci
working-directory: frontend
- name: Install toolchain
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
with:
toolchain: "stable"
- name: Rust cache
Expand All @@ -24,14 +33,12 @@ jobs:
- name: Download db-dump
run: wget --no-verbose https://static.crates.io/db-dump.tar.gz
- name: Build database
run: cargo run --release --bin read-driver-db
run: cargo run --locked --release --bin read-driver-db
- name: Copy generated database to frontend
run: cp full-crate-db.json frontend/src/
- name: Build frontend
run: |
cd frontend
npm install
npm run build -- --base="https://tweedegolf.github.io/drive-rs/"
run: npm run build -- --base="/${{github.event.repository.name}}/"
working-directory: frontend
- name: Updload to gh-pages
uses: actions/upload-pages-artifact@v3
with:
Expand Down