Repository navigation
feat(web): devices and sessions in settings #206
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
| # Continuous integration for piquel.fr. Every job runs the same `just` recipes | |
| # as local validation: | |
| # | |
| # checks -> Rust formatting and the Rust dependency audit, which compile nothing | |
| # web -> Prettier, svelte-check and tsc, ESLint, both builds, the piquel-web | |
| # server tests and the web dependency audit | |
| # rust -> Clippy, unit, database and doc tests against PostgreSQL | |
| # e2e -> the browser suite over HTTPS against the real binary, with the | |
| # auth pages embedded, the settings build and PostgreSQL | |
| # docker -> the deployment images | |
| # | |
| # Pull requests run only the jobs their changes can affect (see `changes`). | |
| # Pushes to main and manual runs run everything. `ci` is the single status to | |
| # require: it fails if any job failed and passes when the rest succeeded or | |
| # were skipped. audit.yml audits new advisories weekly. | |
| # | |
| # Rust caches are saved from main only. Pull requests restore main's caches, | |
| # so a branch never evicts them with copies no other branch can read. pnpm's | |
| # small store cache is saved whenever its lockfile hash is new. | |
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Incremental artifacts only bloat CI caches; restored dependency builds | |
| # make up for the lost reuse. | |
| CARGO_INCREMENTAL: '0' | |
| RUST_BACKTRACE: short | |
| jobs: | |
| # Decides which jobs a pull request needs from the paths it changes. A file | |
| # matches a filter only when it matches every pattern. `web` covers every | |
| # file Prettier, ESLint, tsc or the frontends can see, so it excludes file | |
| # types rather than directories. `app` covers everything the running | |
| # service and its images are built from. | |
| changes: | |
| name: changes | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| rust: ${{ github.event_name != 'pull_request' || steps.filter.outputs.rust == 'true' }} | |
| web: ${{ github.event_name != 'pull_request' || steps.filter.outputs.web == 'true' }} | |
| deps: ${{ github.event_name != 'pull_request' || steps.filter.outputs.deps == 'true' }} | |
| app: ${{ github.event_name != 'pull_request' || steps.filter.outputs.app == 'true' }} | |
| steps: | |
| - if: github.event_name == 'pull_request' | |
| id: filter | |
| uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 | |
| with: | |
| predicate-quantifier: every | |
| filters: | | |
| rust: | |
| - '{Cargo.toml,Cargo.lock,rust-toolchain.toml,justfile,just/**,apps/auth-service/**,apps/admin-web/**,packages/auth-sdk/src/style.css,crates/**,tests/sdk-vectors/**,.github/workflows/ci.yml}' | |
| - '!**/*.md' | |
| web: | |
| - '**' | |
| - '!**/*.{rs,sql,toml,md}' | |
| - '!Cargo.lock' | |
| - '!infra/*.{Dockerfile,conf,sh}' | |
| - '!.dockerignore' | |
| deps: | |
| - '{Cargo.toml,**/Cargo.toml,Cargo.lock,deny.toml,package.json,**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml,.github/workflows/ci.yml}' | |
| app: | |
| - '{Cargo.toml,Cargo.lock,rust-toolchain.toml,justfile,just/**,package.json,pnpm-lock.yaml,pnpm-workspace.yaml,playwright.config.ts,apps/**,crates/**,packages/**,tests/browser/**,infra/**,.dockerignore,.github/workflows/ci.yml}' | |
| - '!**/*.md' | |
| - '!infra/piqueld.toml' | |
| checks: | |
| name: checks | |
| needs: changes | |
| if: needs.changes.outputs.rust == 'true' || needs.changes.outputs.deps == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2 | |
| with: | |
| tool: just,cargo-deny | |
| - run: just rust fmt-check | |
| - if: needs.changes.outputs.deps == 'true' | |
| run: just rust audit | |
| web: | |
| name: web | |
| needs: changes | |
| if: needs.changes.outputs.web == 'true' || needs.changes.outputs.deps == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - &install-just | |
| uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2 | |
| with: | |
| tool: just | |
| # pnpm's version comes from package.json's packageManager. | |
| - &setup-pnpm | |
| uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 | |
| - &setup-node | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: '24' | |
| cache: pnpm | |
| - run: just install | |
| - run: just web fmt-check | |
| - run: just web check | |
| - run: just web lint | |
| - run: just web build | |
| - run: just web test | |
| - if: needs.changes.outputs.deps == 'true' | |
| run: just web audit | |
| # Clippy runs first so lint failures report early; the tests then reuse the | |
| # dependencies it compiled for build scripts and proc macros. | |
| rust: | |
| name: rust | |
| needs: changes | |
| if: needs.changes.outputs.rust == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable | |
| # A disposable server for the database tests, and for the browser suite. | |
| services: | |
| postgres: &postgres | |
| image: postgres:18-bookworm | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| ports: ['5432:5432'] | |
| options: >- | |
| --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2 | |
| with: | |
| tool: just,cargo-nextest | |
| - &rust-cache | |
| uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 | |
| with: | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - run: just rust lint | |
| - run: just test --workspace --run-ignored all | |
| - run: just doc | |
| - run: just doc-test | |
| e2e: | |
| name: e2e | |
| needs: changes | |
| if: needs.changes.outputs.app == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| postgres: *postgres | |
| env: | |
| E2E_AUTH_URL: https://localhost:3443 | |
| E2E_SETTINGS_URL: https://localhost:4443/settings | |
| E2E_ALLOW_SELF_SIGNED_TLS: '1' | |
| AUTH_DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable | |
| AUTH_PUBLIC_BASE_URL: https://localhost:3443 | |
| AUTH_PUBLIC_LISTENER: 127.0.0.1:3000 | |
| AUTH_SETTINGS_URL: https://localhost:4443/settings | |
| AUTH_INVITE_REQUIRED: 'false' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - *install-just | |
| - *setup-pnpm | |
| - *setup-node | |
| - *rust-cache | |
| - run: just install | |
| # Embeds the auth pages, as in the deployed image. | |
| - run: just rust build | |
| - run: just web build-settings | |
| # The service accepts only HTTPS origins, as in production. Caddy | |
| # terminates TLS for both servers with its local CA, which the suite is | |
| # told to accept. The suite signs in through the public OIDC client from | |
| # tests/browser/README.md. | |
| - name: Start the auth service and the settings frontend | |
| run: | | |
| just auth generate-key "$RUNNER_TEMP/key.pem" | |
| export AUTH_KEY_PROVIDER="file://$RUNNER_TEMP/key.pem" | |
| cat > "$RUNNER_TEMP/Caddyfile" <<'EOF' | |
| { | |
| auto_https disable_redirects | |
| skip_install_trust | |
| } | |
| localhost:3443 { | |
| reverse_proxy 127.0.0.1:3000 | |
| } | |
| localhost:4443 { | |
| reverse_proxy 127.0.0.1:4173 | |
| } | |
| EOF | |
| docker run --detach --name caddy --network host --volume "$RUNNER_TEMP/Caddyfile:/etc/caddy/Caddyfile:ro" caddy:2-alpine | |
| target/debug/auth-service migrate | |
| just web browser-client https://localhost:4443 | |
| target/debug/auth-service serve > "$RUNNER_TEMP/auth.log" 2>&1 & | |
| AUTH_ORIGIN="$E2E_AUTH_URL" ORIGIN=https://localhost:4443 HOST=127.0.0.1 PORT=4173 node apps/piquel-web/build > "$RUNNER_TEMP/settings.log" 2>&1 & | |
| curl -kfsS --retry 30 --retry-delay 1 --retry-all-errors "$E2E_AUTH_URL/health/ready" | |
| curl -kfsS --retry 30 --retry-delay 1 --retry-all-errors -o /dev/null "$E2E_SETTINGS_URL" | |
| # The headless build matching the pinned Playwright, so runner image | |
| # updates cannot change the browser under test. | |
| - run: pnpm exec playwright install --only-shell chromium | |
| - run: just web test-browser | |
| - if: failure() | |
| run: | | |
| cat "$RUNNER_TEMP"/*.log || true | |
| docker logs caddy || true | |
| docker: | |
| name: docker (${{ matrix.image }}) | |
| needs: changes | |
| if: needs.changes.outputs.app == 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: [auth, web, admin] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - run: docker build --file infra/${{ matrix.image }}.Dockerfile . | |
| ci: | |
| name: ci | |
| if: always() | |
| needs: | |
| - changes | |
| - checks | |
| - web | |
| - rust | |
| - e2e | |
| - docker | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0 | |
| with: | |
| allowed-skips: checks, web, rust, e2e, docker | |
| jobs: ${{ toJSON(needs) }} |