Skip to content

Commit

Permalink
Merge pull request #462 from boozook/ci-update-impr
Browse files Browse the repository at this point in the history
CI: update workflow improvement
  • Loading branch information
boozook authored Jan 31, 2025
2 parents 69feebd + 76b2c9d commit 1d07795
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:
sha:
description: "Source SHA used to build bindings. Uses `github.sha`` by default."
required: false

# push:
# branches: [main, master]

Expand Down Expand Up @@ -98,7 +97,7 @@ jobs:
needs: new-branch
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
fail-fast: ${{ github.event.inputs.sdk != 'beta' }}
matrix:
os:
- macos-14
Expand Down Expand Up @@ -148,23 +147,25 @@ jobs:
uses: ./.github/actions/tools-deps

- name: Install Playdate SDK ${{ matrix.sdk }}
continue-on-error: ${{ github.event.inputs.sdk == 'beta' }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
with:
version: ${{ matrix.sdk }}
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }}

- name: SDK ${{ steps.sdk.outputs.version }} installed
if: steps.sdk.outcome == 'success'
run: which pdc && pdc --version

- name: Install targets (mac)
if: runner.os == 'macOS'
if: runner.os == 'macOS' && steps.sdk.outcome == 'success'
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Install targets (win)
if: runner.os == 'Windows'
if: runner.os == 'Windows' && steps.sdk.outcome == 'success'
run: |
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc
Expand All @@ -173,19 +174,21 @@ jobs:
run: git pull

- name: Host
if: steps.sdk.outcome == 'success'
run: >-
cargo build -p=playdate-sys --features="${{ matrix.features.v }}"
${{ runner.os == 'macOS' && '--target=aarch64-apple-darwin --target=x86_64-apple-darwin' || '' }}
${{ runner.os == 'Windows' && '--target=x86_64-pc-windows-msvc --target=aarch64-pc-windows-msvc' || '' }}
- name: Device
if: ${{ matrix.os == 'ubuntu-latest' }}
if: matrix.os == 'ubuntu-latest' && steps.sdk.outcome == 'success'
run: cargo build -p=playdate-sys --features="${{ matrix.features.v }}" --target=thumbv7em-none-eabihf

- name: Format
run: rustfmt api/sys/gen/*.rs

- name: Test (host)
if: steps.sdk.outcome == 'success'
# env: # uncomment when all bindings for min-supported-SDK will be there
# IGNORE_EXISTING_PLAYDATE_SDK: 1
# PLAYDATE_USE_PREBUILT_VERSION: ${{ steps.sdk.outputs.version }}
Expand All @@ -194,7 +197,7 @@ jobs:
cargo test -p=playdate-sys --features="lang-items ${{ matrix.features.v }}" --release
- name: Test (device)
if: ${{ matrix.os == 'ubuntu-latest' }}
if: matrix.os == 'ubuntu-latest' && steps.sdk.outcome == 'success'
# env: # uncomment when all bindings for min-supported-SDK will be there
# IGNORE_EXISTING_PLAYDATE_SDK: 1
# PLAYDATE_USE_PREBUILT_VERSION: ${{ steps.sdk.outputs.version }}
Expand All @@ -205,6 +208,7 @@ jobs:
- name: Commit
continue-on-error: true
id: commit
if: steps.sdk.outcome == 'success'
uses: EndBug/add-and-commit@v9
with:
add: ./api/sys/gen/*.rs
Expand Down Expand Up @@ -261,7 +265,6 @@ jobs:
changes: ${{ steps.changes.outputs.all_changed_files }}
changed: ${{ steps.changes.outputs.all_changed_files && 'true' || ' ' }}


bump:
name: Bump
needs: [new-branch, pre-gen, changes]
Expand Down Expand Up @@ -307,7 +310,7 @@ jobs:
pr:
name: PR
needs: [new-branch, pre-gen, bump, tests]
needs: [new-branch, pre-gen, bump] # +tests
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -329,32 +332,32 @@ jobs:
id: pr
uses: TreTuna/sync-branches@1.4.0
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{secrets.PR_GITHUB_TOKEN}}
FROM_BRANCH: refs/heads/${{ needs.new-branch.outputs.working }}
TO_BRANCH: ${{ needs.new-branch.outputs.base || github.event.repository.default_branch }}
PULL_REQUEST_TITLE: Update pre-built bindings
PULL_REQUEST_BODY: |
- [x] Pre-built bindings just updated.
- [${{ needs.bump.result == 'success' && 'x' || ' ' }}] Bump sys crate
- [${{ needs.tests.result == 'success' && 'x' || ' ' }}] Tests passed
# - [${{ needs.tests.result == 'success' && 'x' || ' ' }}] Tests passed
PULL_REQUEST_IS_DRAFT: false
CONTENT_COMPARISON: true
REVIEWERS: '["boozook"]'
# 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, changes]
if: needs.changes.outputs.changed == 'true'
uses: ./.github/workflows/tests.yml
secrets: inherit
permissions:
actions: read
contents: read
pull-requests: write
checks: write
issues: write
with:
ref: ${{ needs.new-branch.outputs.working }}
# tests:
# name: Tests
# needs: [new-branch, pre-gen, changes]
# if: needs.changes.outputs.changed == 'true'
# uses: ./.github/workflows/tests.yml
# secrets: inherit
# permissions:
# actions: read
# contents: read
# pull-requests: write
# checks: write
# issues: write
# with:
# ref: ${{ needs.new-branch.outputs.working }}

0 comments on commit 1d07795

Please sign in to comment.