Skip to content

Commit

Permalink
ci: Improve PR debugging (#2779)
Browse files Browse the repository at this point in the history
* ci: Improve PR debugging

* touchup

* Fix coverage conditional

* Release touchups

* Explicit conditional matching

* fixup! Explicit conditional matching
  • Loading branch information
olix0r authored Mar 12, 2024
1 parent 7b5c173 commit bde6151
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: coverage
name: Coverage

on:
push:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:

codecov:
needs: meta
if: github.event_name == 'push' || needs.meta.outputs.any_changed
if: github.event_name == 'push' || needs.meta.outputs.any_changed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
container:
Expand Down
43 changes: 27 additions & 16 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,29 @@ jobs:
**/*.rs
Cargo.lock
outputs:
is_dependabot: ${{ github.actor == 'dependabot[bot]' && 'true' || '' }}
any_changed: ${{ steps.build.outputs.any_changed || steps.cargo.outputs.any_changed || steps.rust.outputs.any_changed }}
is_dependabot: ${{ github.actor == 'dependabot[bot]' }}
any_changed: ${{ steps.build.outputs.any_changed == 'true' || steps.cargo.outputs.any_change == 'true' || steps.rust.outputs.any_changed == 'true' }}
build_changed: ${{ steps.build.outputs.any_changed }}
cargo_changed: ${{ steps.cargo.outputs.any_changed }}
cargo_crates: ${{ steps.cargo-crates.outputs.crates }}
rust_changed: ${{ steps.rust.outputs.any_changed }}

info:
timeout-minutes: 3
needs: meta
runs-on: ubuntu-latest
steps:
- name: Info
run: |
echo 'github.actor: ${{ github.actor }}'
echo 'github.event_name: ${{ github.event_name }}'
echo 'github.event.pull_request.number: ${{ github.event.pull_request.number }}'
echo 'needs.meta.outputs.is_dependabot: ${{ needs.meta.outputs.is_dependabot }}'
echo 'needs.meta.outputs.any_changed: ${{ needs.meta.outputs.any_changed }}'
echo 'needs.meta.outputs.cargo_changed: ${{ needs.meta.outputs.cargo_changed }}'
echo 'needs.meta.outputs.cargo_crates: ${{ needs.meta.outputs.cargo_crates }}'
echo 'needs.meta.outputs.rust_changed: ${{ needs.meta.outputs.rust_changed }}'
rust:
needs: meta
if: needs.meta.outputs.any_changed == 'true'
Expand Down Expand Up @@ -110,34 +126,29 @@ jobs:

ok:
timeout-minutes: 3
needs: [meta, rust, rust-crates, linkerd-install]
needs: [rust, rust-crates, linkerd-install]
if: always()
runs-on: ubuntu-latest
steps:
- name: Info
- name: Results
run: |
echo 'github.actor: ${{ github.actor }}'
echo 'github.event_name: ${{ github.event_name }}'
echo 'github.event.pull_request.number: ${{ github.event.pull_request.number }}'
echo 'needs.rust.result: ${{ needs.rust.result }}'
echo 'needs.rust-crates.result: ${{ needs.rust-crates.result }}'
echo 'needs.linkerd-install.result: ${{ needs.linkerd-install.result }}'
echo 'needs.meta.outputs.is_dependabot: ${{ needs.meta.outputs.is_dependabot }}'
echo 'needs.meta.outputs.any_changed: ${{ needs.meta.outputs.any_changed }}'
echo 'needs.meta.outputs.cargo_changed: ${{ needs.meta.outputs.cargo_changed }}'
echo 'needs.meta.outputs.cargo_crates: ${{ needs.meta.outputs.cargo_crates }}'
echo 'needs.meta.outputs.rust_changed: ${{ needs.meta.outputs.rust_changed }}'
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
- name: Verify jobs
# All jobs must succeed or be skipped.
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1

auto-merge:
merge-dependabot:
needs: [meta, ok]
if: needs.meta.outputs.is_dependabot == 'true'
if: needs.meta.outputs.any_changed == 'true' && needs.meta.outputs.is_dependabot == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- run: gh pr merge '${{ github.event.pull_request.number }}' --auto --squash
- name: 'Merge PR #${{ github.event.pull_request.number }}'
run: gh pr merge '${{ github.event.pull_request.number }}' --auto --squash
env:
GH_TOKEN: ${{ github.token }}
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: Release

on:
pull_request: {}
Expand Down Expand Up @@ -50,10 +50,9 @@ jobs:
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188
with:
files: |
.github/actions/package/*
.github/workflows/release.yml
justfile
Cargo.toml # For release build settings
Cargo.toml
outputs:
changed: ${{ steps.changed.outputs.any_changed }}
archs: ${{ steps.meta.outputs.archs }}
Expand Down Expand Up @@ -100,7 +99,7 @@ jobs:
with:
path: artifacts
- run: du -h artifacts/**/*
- if: needs.meta.outputs.publish
- if: needs.meta.outputs.publish == 'true'
uses: softprops/action-gh-release@d99959edae48b5ffffd7b00da66dcdb0a33a52ee
with:
name: v${{ needs.meta.outputs.version }}
Expand Down

0 comments on commit bde6151

Please sign in to comment.