Skip to content

Call login API endpoint #2183

Call login API endpoint

Call login API endpoint #2183

Workflow file for this run

name: Build, lint & test
on:
workflow_dispatch:
pull_request:
merge_group:
types: [checks_requested]
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
ASSET_DIR: ${{ github.workspace }}/frontend/dist
SQLX_OFFLINE: "true"
jobs:
backend:
name: Backend (${{ matrix.target.os }})
strategy:
matrix:
target:
- os: ubuntu-latest
name: x86_64-unknown-linux-musl
binary: backend/target/x86_64-unknown-linux-musl/debug/abacus
- os: macos-latest
name: aarch64-apple-darwin
binary: backend/target/aarch64-apple-darwin/debug/abacus
- os: windows-latest
name: x86_64-pc-windows-msvc
binary: backend/target/x86_64-pc-windows-msvc/debug/abacus.exe
runs-on: ${{ matrix.target.os }}
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
# Build frontend so that it can be included in the backend build
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
working-directory: ./frontend
- name: Build
run: npm run build
working-directory: ./frontend
# Compile and test backend
- name: Setup Rust
shell: bash
run: >
rustup update stable &&
rustup default stable &&
echo RUST_VERSION=$(rustc --version | cut -d' ' -f2) >> $GITHUB_ENV
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./backend/target/
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-
- name: Install musl
run: sudo apt-get update && sudo apt-get install -y musl-tools
if: matrix.target.os == 'ubuntu-latest'
- name: Install target
run: rustup target add ${{ matrix.target.name }}
- name: Check rustfmt
run: cargo --verbose --locked fmt --all -- --check
- name: Check Clippy with all features
run: cargo --verbose --locked clippy --target=${{ matrix.target.name }} --all-targets --all-features -- -D warnings
- name: Check Clippy without default features
run: cargo --verbose --locked clippy --target=${{ matrix.target.name }} --all-targets --no-default-features -- -D warnings
- name: Run tests
run: cargo --verbose --locked test --target=${{ matrix.target.name }} -- --nocapture
- name: Build
run: cargo --verbose --locked build --features memory-serve --target=${{ matrix.target.name }}
- uses: actions/upload-artifact@v4
with:
name: abacus-${{ matrix.target.os }}
path: ${{ matrix.target.binary }}
frontend:
name: Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Check formatting
run: npx prettier --check .
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
- uses: actions/upload-artifact@v4
with:
name: frontend-build
path: frontend/dist
playwright-ladle:
name: Playwright ladle tests
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps --no-shell
- name: Run ladle playwright tests
run: npm run test:ladle
playwright-e2e:
name: Playwright e2e tests (${{ matrix.os }})
needs:
- backend
- frontend # for the tests, frontend build is included in backend job
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps --no-shell
- name: Download abacus
uses: actions/download-artifact@v4
with:
name: abacus-${{ matrix.os }}
path: builds/backend
- name: make backend build executable
run: chmod a+x ../builds/backend/abacus
if: runner.os != 'Windows'
- name: Run e2e playwright tests
run: npm run test:e2e
deploy:
name: Deploy to abacus-test.nl
needs:
- backend
- frontend # for the tests, frontend build is included in backend job
environment:
name: test
url: https://${{ github.sha }}.abacus-test.nl
permissions:
contents: read
deployments: write
runs-on: ubuntu-latest
steps:
- name: Download abacus
uses: actions/download-artifact@v4
with:
name: abacus-ubuntu-latest
- name: Upload binary to test server
run: |
curl -s \
-H "Authorization: Bearer ${{ secrets.ABACUS_TEST_API_KEY }}" \
-T ./abacus \
https://abacus-test.nl/etes/api/v1/executable/${{ github.event.pull_request.head.sha || github.sha }}/${{ github.sha }}