WebView window event handling fixes #9633
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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [opened, synchronize] | |
| merge_group: | |
| types: [checks_requested] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/prod' }} | |
| jobs: | |
| skip-if-clean: | |
| name: Skip if merge_queue produces no diff | |
| runs-on: ubuntu-latest | |
| outputs: | |
| skip: ${{ steps.check.outputs.skip }} | |
| internal: ${{ steps.check-internal.outputs.internal }} | |
| if: ${{ always() }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Check if workflow runs on an internal branch | |
| id: check-internal | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| if [ "$EVENT_NAME" != "pull_request" ] || [ "$HEAD_REPO" = "$REPO" ]; then | |
| echo "internal=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "internal=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Merge Queue CI Check Skipper | |
| id: merge-queue-ci-skipper | |
| uses: ./.github/merge-queue-ci-skipper | |
| with: | |
| secret: ${{ secrets.GH_ACCESS_TOKEN }} | |
| - name: Check merge_group synthetic commit | |
| id: check | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| SKIP_CHECK: ${{ steps.merge-queue-ci-skipper.outputs.skip-check }} | |
| run: | | |
| if [ "$EVENT_NAME" != "merge_group" ]; then | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| if [ "$SKIP_CHECK" = "true" ]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| name: Lint and Test | |
| runs-on: ${{ needs.skip-if-clean.outputs.internal == 'true' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} | |
| needs: [skip-if-clean] | |
| if: ${{ needs.skip-if-clean.outputs.skip != 'true' }} | |
| env: | |
| # Ensure pnpm output is colored in GitHub Actions logs | |
| FORCE_COLOR: 3 | |
| # Make cargo nextest successfully ignore projects without tests | |
| NEXTEST_NO_TESTS: pass | |
| # Fail on warnings in CI | |
| # (but don't do this in the root `Cargo.toml`, | |
| # since we don't want warnings to become errors | |
| # while developing) | |
| RUSTFLAGS: -Dwarnings | |
| # sccache config (only populated for internal branches; secrets aren't | |
| # available to forked PRs, and blacksmith stickydisk requires a | |
| # blacksmith runner) | |
| SCCACHE_DIR: ${{ needs.skip-if-clean.outputs.internal == 'true' && '/mnt/sccache' || '' }} | |
| SCCACHE_CACHE_SIZE: ${{ needs.skip-if-clean.outputs.internal == 'true' && '10G' || '' }} | |
| SCCACHE_MULTILEVEL_CHAIN: ${{ needs.skip-if-clean.outputs.internal == 'true' && 'disk,s3' || '' }} | |
| SCCACHE_S3_KEY_PREFIX: ${{ needs.skip-if-clean.outputs.internal == 'true' && format('{0}/', github.repository) || '' }} | |
| SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }} | |
| SCCACHE_REGION: ${{ secrets.SCCACHE_REGION }} | |
| SCCACHE_ENDPOINT: ${{ secrets.SCCACHE_ENDPOINT }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_S3_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_S3_SECRET_ACCESS_KEY }} | |
| RUSTC_WRAPPER: ${{ needs.skip-if-clean.outputs.internal == 'true' && 'sccache' || '' }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 2 | |
| - name: Install build dependencies | |
| uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.6.0 | |
| with: | |
| packages: libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev | |
| version: v1 # cache key | |
| - name: Setup Node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| run: echo "store-path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - name: Restore pnpm cache | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.store-path }} | |
| key: pnpm-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-cache- | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0 | |
| with: | |
| rustflags: '' | |
| components: clippy, rustfmt | |
| cache: false | |
| - name: Cache Cargo registry and index | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| ~/.cargo/bin | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Mount sccache disk cache | |
| if: needs.skip-if-clean.outputs.internal == 'true' | |
| uses: useblacksmith/stickydisk@13af8883542ca949a717e70fef89d15edbb29d88 # v1.2.0 | |
| with: | |
| key: ${{ github.repository }}-turbo-sccache | |
| path: /mnt/sccache | |
| - name: Setup sccache | |
| if: needs.skip-if-clean.outputs.internal == 'true' | |
| uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 | |
| - name: Setup binstall | |
| uses: cargo-bins/cargo-binstall@dc19f1e48450eefe5a29b8da6c6b00a87d730b37 # v1.18.1 | |
| - name: Setup nextest | |
| run: cargo binstall --no-confirm --secure cargo-nextest@0.9.133 | |
| # cargo-binstall does not have pre-built binaries for sqlx-cli, so we fall | |
| # back to a cached cargo install | |
| - name: Setup cargo-sqlx | |
| uses: taiki-e/cache-cargo-install-action@f9eed3e4680f27610dc6d8c67be1b88593f7dade # v3.0.6 | |
| with: | |
| tool: sqlx-cli@0.8.6 | |
| locked: false | |
| no-default-features: true | |
| features: rustls,postgres | |
| - name: Setup Turbo cache | |
| uses: rharkor/caching-for-turbo@56219402aacc0d06b650d898c222996dbc1191ec # v2.3.14 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Set app environment | |
| working-directory: packages/app-lib | |
| run: cp .env.staging .env | |
| # check if labrinth tests will actually run (cache miss) | |
| - name: Check if labrinth tests need to run | |
| id: check-labrinth | |
| run: | | |
| LABRINTH_TEST_STATUS=$(pnpm turbo run test --filter=@modrinth/labrinth --dry-run=json | jq -r '.tasks[] | select(.task == "test") | .cache.status') | |
| echo "Labrinth test cache status: $LABRINTH_TEST_STATUS" | |
| if [ "$LABRINTH_TEST_STATUS" = "HIT" ]; then | |
| echo "needs_services=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "needs_services=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Start services | |
| if: steps.check-labrinth.outputs.needs_services == 'true' | |
| run: docker compose up --wait | |
| - name: Setup labrinth environment and database | |
| if: steps.check-labrinth.outputs.needs_services == 'true' | |
| working-directory: apps/labrinth | |
| run: | | |
| cp .env.local .env | |
| sqlx database setup | |
| - name: Lint and test | |
| run: pnpm run ci | |
| - name: Verify intl:extract has been run | |
| run: | | |
| pnpm turbo run intl:extract --force | |
| git diff --exit-code --color */*/src/locales/en-US/index.json |