Skip to content

Commit

Permalink
Merge pull request #287 from boozook/ci/update-fix
Browse files Browse the repository at this point in the history
CI: fix update & test workflows
  • Loading branch information
github-actions[bot] authored Apr 9, 2024
2 parents d03286d + eea52c2 commit 886691f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 11 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ name: Auto-merge
on:
pull_request_target:
types: ready_for_review
workflow_call:
inputs:
pr:
description: "Pull Request number"
type: number
required: true
url:
description: "Pull Request URL (HTML, not API)"
type: string
required: false

permissions:
contents: write
Expand All @@ -11,7 +21,7 @@ jobs:
approve:
continue-on-error: true
runs-on: ubuntu-latest
if: ${{ github.actor_id == github.repository_owner_id }}
if: ${{ github.actor_id == github.repository_owner_id || inputs.pr }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
Expand All @@ -38,7 +48,7 @@ jobs:
}
}'
ISSUES=$(gh api graphql -f query="$QUERY" -F prNumber=${{ github.event.pull_request.number }} -F repositoryName=${{ github.event.repository.name }} -F repositoryOwner=${{ github.event.repository.owner.login }} -q '.data.repository.pullRequest.closingIssuesReferences.nodes[] | .number')
ISSUES=$(gh api graphql -f query="$QUERY" -F prNumber=${{ github.event.pull_request.number || inputs.pr }} -F repositoryName=${{ github.event.repository.name }} -F repositoryOwner=${{ github.event.repository.owner.login }} -q '.data.repository.pullRequest.closingIssuesReferences.nodes[] | .number')
echo "num=$ISSUES" >> "$GITHUB_OUTPUT"
if [ -z "$ISSUES" ]
Expand All @@ -54,12 +64,12 @@ jobs:
- name: Approve
# if there is no requested reviewers specified and PR don't have any linked issue's:
if: success() && steps.reviewers.outputs.value == '0'
run: gh pr review --approve "${{ github.event.pull_request.html_url }}"
run: gh pr review --approve "${{ github.event.pull_request.html_url || inputs.url || inputs.pr }}"

- name: Auto-merge
# only if no linked issue:
if: success() && steps.reviewers.outputs.value == '0' && steps.issues.outputs.have != 'true'
run: >-
gh pr merge --auto
--${{ github.event.pull_request.commits > 1 && 'squash' || 'merge' }}
"${{ github.event.pull_request.html_url }}"
"${{ github.event.pull_request.html_url || inputs.url || inputs.pr }}"
17 changes: 16 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Tests
on:
workflow_call:
inputs:
ref:
description: git branch, tag or SHA to checkout.
type: string
required: true
pull_request:
push:
branches: [main, master]
Expand Down Expand Up @@ -57,6 +62,8 @@ jobs:
steps:
- run: arch
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -157,6 +164,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -210,6 +219,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -290,6 +301,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -356,6 +369,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Check
id: check
Expand All @@ -373,5 +388,5 @@ jobs:
continue-on-error: true
if: success() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
# https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
uses: parkerbxyz/suggest-changes@v1
uses: parkerbxyz/suggest-changes@v1.0.4
# with: comment: Rustfmt suggested the formatting changes.
24 changes: 18 additions & 6 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ jobs:
matrix:
os:
- macos-14
# - macos-latest
- ubuntu-latest
# - windows-latest
- windows-latest
sdk:
- ${{ github.event.inputs.sdk || 'latest' }}
features:
Expand Down Expand Up @@ -244,11 +243,12 @@ jobs:
cargo build -p=playdate-sys --features="lang-items ${{ matrix.features.v }}" --target=thumbv7em-none-eabihf -Zbuild-std=core,alloc --release
- name: Commit
continue-on-error: true
id: commit
uses: EndBug/add-and-commit@v9
with:
add: ./api/sys/gen/*.rs
author_name: Alex Koz
author_name: Update Bot
author_email: [email protected]
committer_name: Update Workflow
message: Automated build pre-built bindings
Expand Down Expand Up @@ -290,7 +290,7 @@ jobs:
uses: EndBug/[email protected]
with:
add: ./api/sys/Cargo.toml
author_name: Alex Koz
author_name: Bump Bot
author_email: [email protected]
committer_name: Bump sys version
message: Automated bump sys crate version
Expand All @@ -305,7 +305,7 @@ jobs:
pr:
name: Make PR
needs: [new-branch, pre-gen, pre-gen-arm]
needs: [new-branch, pre-gen, pre-gen-arm, bump, tests]
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -324,6 +324,7 @@ jobs:
ref: ${{ needs.new-branch.outputs.working }}

- name: Create PR
id: pr
uses: TreTuna/[email protected]
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -332,12 +333,23 @@ jobs:
PULL_REQUEST_TITLE: Update pre-built bindings
PULL_REQUEST_BODY: |
- [x] Pre-built bindings just updated.
- [ ] Bump sys crate
- [${{ needs.bump.result == 'success' && 'x' || ' ' }}] Bump sys crate
- [${{ needs.tests.result == 'success' && 'x' || ' ' }}] Tests passed
PULL_REQUEST_IS_DRAFT: false
CONTENT_COMPARISON: true
REVIEWERS: '["boozook"]'
outputs:
number: ${{ steps.pr.outputs.PULL_REQUEST_NUMBER }}
url: ${{ steps.pr.outputs.PULL_REQUEST_URL }}

tests:
name: Tests
needs: [new-branch, pre-gen, pre-gen-arm]
uses: ./.github/workflows/tests.yml
secrets: inherit
permissions:
actions: read
contents: read
pull-requests: write
with:
ref: ${{ needs.new-branch.outputs.working }}

0 comments on commit 886691f

Please sign in to comment.