feat: add pre-commit hook and enhance pre-push checks #98
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: write | |
checks: write | |
pull-requests: write | |
env: | |
CARGO_TERM_COLOR: always | |
SQLX_OFFLINE: true | |
LANG: en_US.UTF-8 | |
jobs: | |
build: | |
name: Build and Test | |
container: | |
image: rust:latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prep OS | |
run: | | |
apt-get update && apt-get install -y jq | |
- name: Create .env file | |
run: | | |
cp .env.template .env | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Install Cargo Tools | |
run: | | |
rustup target add wasm32-unknown-unknown | |
# Install tools in parallel without version pinning | |
cargo install --locked --jobs "$(nproc)" trunk & | |
cargo install --locked --jobs "$(nproc)" wasm-bindgen-cli & | |
cargo install --locked --jobs "$(nproc)" wasm-opt & | |
cargo install --locked --jobs "$(nproc)" sqlx-cli --no-default-features --features native-tls,postgres & | |
wait | |
- name: Build | |
run: cargo build | |
- name: Run tests | |
run: cargo test | |
- name: Build frontend | |
working-directory: frontend | |
run: | | |
echo "Building with PATH=$PATH" | |
trunk build --release | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: frontend/dist/ | |
retention-days: 7 |