diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0ef6a97b..20e6f5539 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,7 @@ name: CI on: - push: - branches: - - master - pull_request: { } + merge_group: + pull_request: schedule: - cron: "0 12 * * 1" # Every Monday at 12:00 UTC @@ -11,7 +9,7 @@ env: AWS_ACCESS_KEY_ID: AKIA46X5W6CZBLO3VBND jobs: - test_and_deploy: + test-linux: name: Test and deploy runs-on: ubuntu-22.04 env: @@ -52,35 +50,12 @@ jobs: - name: Formatting check run: cargo fmt --all -- --check - - uses: docker/setup-buildx-action@v2 - - name: Build Docker image - uses: docker/build-push-action@v4 - with: - context: . - # Export the image to Docker to make it available in the next step - load: true - tags: rustc-perf - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Check licenses run: | pip install reuse==4.0.3 reuse lint - - name: Deploy to production - uses: rust-lang/simpleinfra/github-actions/upload-docker-image@master - with: - image: rustc-perf - repository: rust-rustc-perf - region: us-west-1 - redeploy_ecs_cluster: rust-ecs-prod - redeploy_ecs_service: rustc-perf - aws_access_key_id: "${{ env.AWS_ACCESS_KEY_ID }}" - aws_secret_access_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/deploy' - - test_on_windows: + test-windows: name: Test on Windows runs-on: windows-latest steps: @@ -110,7 +85,7 @@ jobs: - name: Run unit tests run: cargo test --all - test_benchmarks: + test-benchmarks: strategy: matrix: # We split `bench_local` testing into four jobs that run in parallel, @@ -170,7 +145,7 @@ jobs: PROFILES: ${{ matrix.PROFILES }} SHELL: "/bin/bash" - test_backends: + test-backends: name: Test codegen backend benchmarks runs-on: ubuntu-22.04 steps: @@ -206,7 +181,7 @@ jobs: BACKENDS: Cranelift SHELL: "/bin/bash" - test_runtime_benchmarks: + test-runtime-benchmarks: name: Test runtime benchmarks runs-on: ubuntu-22.04 steps: @@ -239,7 +214,7 @@ jobs: env: SHELL: "/bin/bash" - test_profiling: + test-profiling: name: Test profiling runs-on: ubuntu-22.04 steps: @@ -415,3 +390,45 @@ jobs: run: | DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/postgres cargo run --bin site & python3 ci/check-site.py version1 version2 + + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout the source code + uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v2 + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: . + tags: rustc-perf + cache-from: type=gha + cache-to: type=gha,mode=max + + # Summary job for the merge queue. + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + conclusion: + needs: + - test-linux + - test-windows + - test-benchmarks + - test-backends + - test-runtime-benchmarks + - test-profiling + - database-check + - site-endpoint + - docker + # We need to ensure this job does *not* get skipped if its dependencies fail, + # because a skipped job is considered a success by GitHub. So we have to + # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run + # when the workflow is canceled manually. + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + steps: + # Manually check the status of all dependencies. `if: failure()` does not work. + - name: Conclusion + run: | + # Print the dependent jobs to see them in the CI log + jq -C <<< '${{ toJson(needs) }}' + # Check if all jobs that we depend on (in the needs array) were successful. + jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' diff --git a/.github/workflows/manual-deploy.yml b/.github/workflows/deploy.yml similarity index 94% rename from .github/workflows/manual-deploy.yml rename to .github/workflows/deploy.yml index c231171e0..c9754eaae 100644 --- a/.github/workflows/manual-deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,8 @@ name: Manual deploy on: + push: + branches: + - master workflow_dispatch: env: @@ -8,7 +11,7 @@ env: jobs: deploy: name: Deploy - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout the source code uses: actions/checkout@v4