reconcile/.github/workflows/check.yml
2025-03-16 21:15:36 +00:00

70 lines
1.7 KiB
YAML

name: Check
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4.2.0
with:
node-version: "22.x"
check-latest: true
- name: Setup rust
run: |
echo "github.ref: ${{ github.ref }}"
echo "github.ref_type: ${{ github.ref_type }}"
echo "github.event_name: ${{ github.event_name }}"
cargo install sqlx-cli
cd backend
sqlx database create --database-url sqlite://db.sqlite3
sqlx migrate run --source sync_server/src/database/migrations --database-url sqlite://db.sqlite3
- name: Build wasm
run: |
cd backend
cargo install wasm-pack
wasm-pack build --target web sync_lib
- name: Lint backend
run: |
cd backend
cargo clippy --all-targets --all-features
cargo fmt --all -- --check
- name: Test backend
run: |
cd backend
cargo test --verbose
cd sync_lib
wasm-pack test --node
- name: Lint frontend
run: |
cd frontend
npm ci
npm run build
npm run lint
if [[ $(git status --porcelain) ]]; then
git status --porcelain
echo "Failing CI because the working directory is not clean after linting."
exit 1
fi
- name: Test frontend
run: |
cd frontend
npm run test