Split CI into PR smoke + workspace integration via reusable workflow … #55
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: | |
| pull_request: | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| - '.gitignore' | |
| - 'LICENSE*' | |
| - '.github/ISSUE_TEMPLATE/**' | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| - '.gitignore' | |
| - 'LICENSE*' | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| SQLX_OFFLINE: "true" | |
| CARGO_INCREMENTAL: "0" | |
| FORGE_TEST_ARTIFACT_DIR: /tmp/forge-test-artifacts | |
| jobs: | |
| validate: | |
| name: Validate | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| cache-on-failure: true | |
| - name: fmt | |
| run: cargo fmt --all --check | |
| - run: scripts/ci/create-env-stubs.sh | |
| - name: clippy | |
| run: cargo clippy --all-targets --all-features --workspace -- -D warnings | |
| - name: test | |
| run: cargo test --workspace | |
| workspace-integration: | |
| name: Workspace integration | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| postgres: | |
| image: postgres:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: forge_ci | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/forge_ci | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: "false" | |
| - run: cargo test -p forge-svelte-demo-template --features testcontainers | |
| - run: cargo test -p todo --features testcontainers | |
| pr-smoke: | |
| name: PR Smoke | |
| needs: validate | |
| if: github.event_name == 'pull_request' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| template: | |
| - with-svelte/demo | |
| - with-dioxus/demo | |
| uses: ./.github/workflows/template-smoke.yml | |
| with: | |
| template: ${{ matrix.template }} | |
| timeout-minutes: 20 | |
| integration: | |
| name: Integration | |
| needs: validate | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| template: | |
| - with-svelte/minimal | |
| - with-svelte/demo | |
| - with-svelte/realtime-todo-list | |
| - with-dioxus/minimal | |
| - with-dioxus/demo | |
| - with-dioxus/realtime-todo-list | |
| uses: ./.github/workflows/template-smoke.yml | |
| with: | |
| template: ${{ matrix.template }} | |
| timeout-minutes: 20 |