Merge pull request #10040 from Turbo87/async-test-builders #20963
This file contains 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 | |
- master | |
pull_request: | |
concurrency: | |
group: ci-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
# renovate: datasource=crate depName=cargo-deny versioning=semver | |
CARGO_DENY_VERSION: 0.16.2 | |
# renovate: datasource=crate depName=grcov versioning=semver | |
GRCOV_VERSION: 0.8.20 | |
# renovate: datasource=npm depName=pnpm | |
PNPM_VERSION: 9.14.2 | |
# renovate: datasource=docker depName=postgres | |
POSTGRES_VERSION: 16 | |
jobs: | |
changed-files: | |
name: Changed Files | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4 | |
id: changed-files-non-js | |
with: | |
files_ignore: | | |
app/** | |
e2e/** | |
mirage/** | |
public/** | |
tests/** | |
.eslintrc | |
.template-lintrc.js | |
ember-cli-build.js | |
package.json | |
pnpm-lock.yaml | |
testem.js | |
- uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4 | |
id: changed-files-non-rust | |
with: | |
files_ignore: | | |
crates/** | |
migrations/** | |
src/** | |
build.rs | |
Cargo.lock | |
Cargo.toml | |
rust-toolchain.toml | |
- uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4 | |
id: changed-files-rust-lockfile | |
with: | |
files: Cargo.lock | |
outputs: | |
non-js: ${{ steps.changed-files-non-js.outputs.any_modified }} | |
non-rust: ${{ steps.changed-files-non-rust.outputs.any_modified }} | |
rust-lockfile: ${{ steps.changed-files-rust-lockfile.outputs.any_modified }} | |
percy-nonce: | |
name: Frontend / Percy Nonce | |
runs-on: ubuntu-latest | |
needs: changed-files | |
if: needs.changed-files.outputs.non-rust == 'true' | |
# persist job results to other jobs in the workflow | |
outputs: | |
nonce: ${{ steps.percy-nonce.outputs.nonce }} | |
steps: | |
# persist step results to other steps in the job | |
- id: percy-nonce | |
# adding a timestamp makes the nonce more unique for re-runs | |
run: echo "nonce=${{ github.run_id }}-$(date +%s)" >> $GITHUB_OUTPUT | |
backend-lint: | |
name: Backend / Lint | |
runs-on: ubuntu-24.04 | |
needs: changed-files | |
if: needs.changed-files.outputs.non-js == 'true' | |
env: | |
RUSTFLAGS: "-D warnings" | |
RUSTDOCFLAGS: "-D warnings" | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- run: rustup component add rustfmt | |
- run: rustup component add clippy | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 | |
- run: cargo fmt --check --all | |
- run: cargo clippy --all-targets --all-features --workspace | |
- run: cargo doc --no-deps --document-private-items | |
backend-cargo-deny: | |
name: Backend / cargo-deny | |
runs-on: ubuntu-24.04 | |
needs: changed-files | |
if: github.event_name != 'pull_request' || needs.changed-files.outputs.rust-lockfile == 'true' | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 | |
- run: cargo install cargo-deny --vers ${{ env.CARGO_DENY_VERSION }} | |
- run: cargo deny check | |
backend-test: | |
name: Backend / Test | |
runs-on: ubuntu-24.04 | |
needs: changed-files | |
if: needs.changed-files.outputs.non-js == 'true' | |
env: | |
RUST_BACKTRACE: 1 | |
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/postgres | |
RUSTFLAGS: "-D warnings -Cinstrument-coverage" | |
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true" | |
CARGO_TARGET_DIR: /mnt/target | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 | |
with: | |
# Ensure that we cache from the right target directory. (See below | |
# for the details of how and when this gets created.) | |
workspaces: '. -> ${{ env.CARGO_TARGET_DIR }}' | |
# Update `pg_dump` to the same version as the running PostgreSQL server | |
- run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -v ${{ env.POSTGRES_VERSION }} -i -p | |
- run: sudo systemctl start postgresql.service | |
- run: sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres'" | |
# Create a working directory on /mnt, which is a larger temporary | |
# filesystem than /, that we can then point our later commands to. | |
- run: | | |
sudo mkdir ${{ env.CARGO_TARGET_DIR }} | |
sudo chown $(id -u):$(id -g) ${{ env.CARGO_TARGET_DIR }} | |
- run: cargo build --tests --workspace | |
- run: cargo test --workspace | |
- run: curl -sL https://github.com/mozilla/grcov/releases/download/v${{ env.GRCOV_VERSION }}/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar xjf - | |
- run: rustup component add llvm-tools | |
- run: ./grcov . --binary-path ${{ env.CARGO_TARGET_DIR }}/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" --ignore "${{ env.CARGO_TARGET_DIR }}/debug/build/**" -o ${{ env.CARGO_TARGET_DIR }}/coverage.lcov | |
- uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 | |
with: | |
files: ${{ env.CARGO_TARGET_DIR }}/coverage.lcov | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
frontend-lint: | |
name: Frontend / Lint | |
runs-on: ubuntu-24.04 | |
needs: changed-files | |
if: needs.changed-files.outputs.non-rust == 'true' | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version-file: package.json | |
- run: pnpm install | |
- run: pnpm lint:hbs | |
- run: pnpm lint:js | |
- run: pnpm lint:deps | |
- run: pnpm prettier:check | |
frontend-test: | |
name: Frontend / Test | |
runs-on: ubuntu-24.04 | |
needs: [changed-files, percy-nonce] | |
if: needs.changed-files.outputs.non-rust == 'true' | |
env: | |
JOBS: 1 # See https://git.io/vdao3 for details. | |
# Percy secrets are included here to enable Percy's GitHub integration | |
# on community-submitted PRs | |
PERCY_TOKEN: web_0a783d8086b6f996809f3e751d032dd6d156782082bcd1423b9b860113c75054 | |
PERCY_PARALLEL_NONCE: ${{ needs.percy-nonce.outputs.nonce }} | |
PERCY_PARALLEL_TOTAL: 2 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version-file: package.json | |
- run: pnpm install | |
- if: github.repository == 'rust-lang/crates.io' | |
run: pnpm percy exec --parallel -- pnpm test-coverage | |
- if: github.repository != 'rust-lang/crates.io' | |
run: pnpm test-coverage | |
e2e-test: | |
name: Frontend / Test (playwright) | |
runs-on: ubuntu-24.04 | |
needs: [changed-files, percy-nonce] | |
timeout-minutes: 60 | |
if: needs.changed-files.outputs.non-rust == 'true' | |
env: | |
JOBS: 1 # See https://git.io/vdao3 for details. | |
# Percy secrets are included here to enable Percy's GitHub integration | |
# on community-submitted PRs | |
PERCY_TOKEN: web_0a783d8086b6f996809f3e751d032dd6d156782082bcd1423b9b860113c75054 | |
PERCY_PARALLEL_NONCE: ${{ needs.percy-nonce.outputs.nonce }} | |
PERCY_PARALLEL_TOTAL: 2 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version-file: package.json | |
- run: pnpm install | |
- run: pnpm playwright install chromium | |
- if: github.repository == 'rust-lang/crates.io' | |
run: pnpm percy exec --parallel -- pnpm e2e | |
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 14 |