diff --git a/.github/workflows/bors.yml b/.github/workflows/ci.yml similarity index 79% rename from .github/workflows/bors.yml rename to .github/workflows/ci.yml index 28e07540..a0f4bc07 100644 --- a/.github/workflows/bors.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,6 @@ -name: bors build +name: CI on: - push: - branches: - - try - - auto + merge_group: jobs: lint: @@ -122,29 +119,21 @@ jobs: aws_secret_access_key: "${{ secrets.aws_secret_access_key }}" if: github.ref == 'refs/heads/auto' - - # These jobs doesn't actually test anything, but they're only used to tell - # bors the build completed, as there is no practical way to detect when a - # workflow is successful listening to webhooks only. - # - # ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB! - - end-success: - name: bors build finished - if: success() - runs-on: ubuntu-latest + conclusion: needs: [docker-upload] - - steps: - - name: Mark the job as successful - run: exit 0 - - end-failure: - name: bors build finished - if: "!success()" + # 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. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + if: ${{ !cancelled() }} runs-on: ubuntu-latest - needs: [docker-upload] - steps: - - name: Mark the job as a failure - run: exit 1 + # 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/pr.yml b/.github/workflows/pr.yml index 4a203c32..a0f4748c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -38,3 +38,24 @@ jobs: run: | cargo run -- create-lists cargo test + + # Note: this job is used so that there is a job named "conclusion" both in the PR and merge queue + # CI. Otherwise, it would not be possible for PR CI to succeed. + conclusion: + needs: [lint, test] + # 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. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + 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/tests/minicrater/full/full.html.context.expected.json b/tests/minicrater/full/full.html.context.expected.json index 9332f320..ddb108a5 100644 --- a/tests/minicrater/full/full.html.context.expected.json +++ b/tests/minicrater/full/full.html.context.expected.json @@ -15,7 +15,7 @@ 0, { "RootResults": { - "count": 4, + "count": 3, "results": { "build ICE": [ { @@ -57,26 +57,6 @@ "url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code" } ], - "build compiler-error(E0658)": [ - { - "color_idx": 0, - "name": "error-code (local)", - "res": "regressed", - "runs": [ - { - "color_idx": 7, - "log": "stable/local/error-code", - "name_idx": 0 - }, - { - "color_idx": 0, - "log": "beta/local/error-code", - "name_idx": 2 - } - ], - "url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code" - } - ], "build failed (unknown)": [ { "color_idx": 0, diff --git a/tests/minicrater/full/index.html.context.expected.json b/tests/minicrater/full/index.html.context.expected.json index 9d4a83bc..18535b78 100644 --- a/tests/minicrater/full/index.html.context.expected.json +++ b/tests/minicrater/full/index.html.context.expected.json @@ -15,7 +15,7 @@ 0, { "RootResults": { - "count": 4, + "count": 3, "results": { "build ICE": [ { @@ -57,26 +57,6 @@ "url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code" } ], - "build compiler-error(E0658)": [ - { - "color_idx": 0, - "name": "error-code (local)", - "res": "regressed", - "runs": [ - { - "color_idx": 7, - "log": "stable/local/error-code", - "name_idx": 0 - }, - { - "color_idx": 0, - "log": "beta/local/error-code", - "name_idx": 2 - } - ], - "url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code" - } - ], "build failed (unknown)": [ { "color_idx": 0, diff --git a/tests/minicrater/full/markdown.md.context.expected.json b/tests/minicrater/full/markdown.md.context.expected.json index 8f0b3315..f7c639eb 100644 --- a/tests/minicrater/full/markdown.md.context.expected.json +++ b/tests/minicrater/full/markdown.md.context.expected.json @@ -62,7 +62,7 @@ }, { "log": "beta/local/error-code", - "res": "build-fail:compiler-error(E0015, E0658)" + "res": "build-fail:compiler-error(E0015)" } ], "url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code" diff --git a/tests/minicrater/full/results.expected.json b/tests/minicrater/full/results.expected.json index 77fa7374..d3f70a5f 100644 --- a/tests/minicrater/full/results.expected.json +++ b/tests/minicrater/full/results.expected.json @@ -157,7 +157,7 @@ }, { "log": "beta/local/error-code", - "res": "build-fail:compiler-error(E0015, E0658)" + "res": "build-fail:compiler-error(E0015)" } ], "url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"