name: Release on: push: branches: [main, dev] paths-ignore: - "docs/**" - "docusaurus.config.ts" - "sidebars.ts" - "static/**" pull_request: branches: [main, dev] paths-ignore: - "docs/**" - "docusaurus.config.ts" - "sidebars.ts" - "static/**" env: SQLX_OFFLINE: true jobs: build: runs-on: depot-ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Cache Rust build uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | rust-build-${{ runner.os }}- - name: Build all targets run: cargo build --all-targets unit-tests: needs: [build] runs-on: depot-ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Restore Rust build cache uses: actions/cache/restore@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | rust-build-${{ runner.os }}- - name: Run unit tests run: cargo test --lib e2e-tests: needs: [build] runs-on: depot-ubuntu-24.04 services: postgres: image: postgres:16-alpine env: POSTGRES_USER: happyview POSTGRES_PASSWORD: happyview POSTGRES_DB: happyview_test ports: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Restore Rust build cache uses: actions/cache/restore@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | rust-build-${{ runner.os }}- - name: Run e2e tests env: TEST_DATABASE_URL: postgres://happyview:happyview@localhost:5432/happyview_test run: cargo test --tests frontend: runs-on: depot-ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 24 - name: Build frontend working-directory: web run: npm ci && npm run build lint: needs: [build] runs-on: depot-ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Restore Rust build cache uses: actions/cache/restore@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | rust-build-${{ runner.os }}- - name: Check formatting run: cargo fmt -- --check - name: Clippy run: cargo clippy --all-targets -- -D warnings release: if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') needs: [unit-tests, e2e-tests, frontend, lint] runs-on: depot-ubuntu-24.04 permissions: contents: write steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22 - name: Release env: GITHUB_TOKEN: ${{ secrets.DISPATCH_GH_TOKEN }} run: npx semantic-release