Skip to content

Update

Update #48

Workflow file for this run

name: Update
on:
workflow_dispatch:
inputs:
source:
description: "Source ref used to build bindings. Uses `github.ref`` by default."
required: false
sha:
description: "Source SHA used to build bindings. Uses `github.sha`` by default."
required: false
sdk:
description: "Version of Playdate SDK"
default: latest
required: false
push:
branches: [main, master]
schedule:
- cron: "0 0 * * 1"
env:
CARGO_INCREMENTAL: 1
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
CARGO_TERM_COLOR: always
CARGO_TERM_PROGRESS_WHEN: never
# logging:
CARGO_PLAYDATE_LOG: trace
# allow modify source for bindings generator:
PD_BUILD_PREBUILT: 1
permissions:
contents: write
jobs:
new-branch:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Input
run: |
echo "ref: ${{ github.ref }}, ${{ github.ref_name }}"
echo "inputs: ${{ github.event.inputs.source }}, ${{ github.event.inputs.sha }}"
echo "default branch: ${{ github.event.repository.default_branch }}"
echo "Will checkout ${{ github.event.inputs.source || github.ref }}"
- name: Checkout Master
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.source || github.ref || github.event.repository.default_branch }}
- name: Create Branch
id: branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: refs/heads/api/sys/pre-build
sha: ${{ github.event.inputs.sha || github.sha }}
- name: Created
run: 'echo "Created: ${{ steps.branch.outputs.created }}"'
- name: determine base branch
id: base
if: ${{ github.ref_type == 'branch' }}
run: echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
# if not created => rebase to master
- name: ReSync Branch
if: ${{ steps.branch.outputs.created == 'false' }}
uses: Joao208/[email protected]
with:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: api/sys/pre-build
DEFAULT_BRANCH: ${{ github.event.inputs.source || steps.base.outputs.value || github.event.repository.default_branch }}
pre-gen:
name: Gen (${{ matrix.os }}, ${{ matrix.features.name }})
defaults:
run:
shell: bash
needs: new-branch
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest
sdk:
- ${{ github.event.inputs.source || 'latest' }}
features:
- v: >-
bindings-documentation
bindings-derive-debug
name: default
- v: >-
bindings-documentation
bindings-derive-default
bindings-derive-eq
bindings-derive-copy
bindings-derive-debug
bindings-derive-hash
bindings-derive-ord
bindings-derive-partialeq
bindings-derive-partialord
name: full
steps:
- uses: actions/checkout@v4
with:
ref: api/sys/pre-build
- name: Cache
uses: Swatinem/[email protected]
- name: Install Playdate SDK ${{ matrix.sdk }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
with:
version: ${{ matrix.sdk }}
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version
# TODO: check & stop if there's no changes or mb. save SDK version cached
- name: Host
run: |
cargo build -p=playdate-sys --features="${{ matrix.features.v }}" -vv
cargo build -p=playdate-sys --features="${{ matrix.features.v }}" --release
- name: Device
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cargo build -p=playdate-sys --features="${{ matrix.features.v }}" --target=thumbv7em-none-eabihf
cargo build -p=playdate-sys --features="${{ matrix.features.v }}" --target=thumbv7em-none-eabihf --release
- name: Format
run: rustfmt api/sys/gen/*.rs
- name: Test (host)
# env: # uncomment when all bindings for min-supported-SDK will be there
# IGNORE_EXISTING_PLAYDATE_SDK: 1
run: |
cargo test -p=playdate-sys --features="${{ matrix.features.v }}"
cargo test -p=playdate-sys --features="${{ matrix.features.v }}" --release
- name: Test (device)
if: ${{ matrix.os == 'ubuntu-latest' }}
# env: # uncomment when all bindings for min-supported-SDK will be there
# IGNORE_EXISTING_PLAYDATE_SDK: 1
run: |
cargo build -p=playdate-sys --features="${{ matrix.features.v }}" --target=thumbv7em-none-eabihf -Zbuild-std=core,alloc
cargo build -p=playdate-sys --features="${{ matrix.features.v }}" --target=thumbv7em-none-eabihf -Zbuild-std=core,alloc --release
- name: Commit
id: commit
uses: EndBug/add-and-commit@v9
with:
add: ./api/sys/gen/*.rs
author_name: Alex Koz
author_email: [email protected]
committer_name: Update Workflow
message: Automated build pre-built bindings
pull: "--rebase --autostash"
push: true
- name: Committed
run: |
echo "Committed: ${{ steps.commit.outputs.committed }}"
echo "Pushed: ${{ steps.commit.outputs.pushed }}"
echo "SHA: ${{ steps.commit.outputs.commit_sha }}"
pr:
name: Make PR
needs: pre-gen
runs-on: ubuntu-latest
defaults:
run:
shell: bash
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: api/sys/pre-build
- name: Determine Base Branch
id: branch
if: ${{ github.ref_type == 'branch' }}
run: echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- name: Base
run: |
echo "determined: ${{ steps.branch.outputs.value }}"
echo "to: ${{ steps.branch.outputs.value || github.event.repository.default_branch }}"
- name: Create PR
uses: TreTuna/[email protected]
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: refs/heads/api/sys/pre-build
TO_BRANCH: ${{ steps.branch.outputs.value || github.event.repository.default_branch }}
PULL_REQUEST_TITLE: Update pre-built bindings
PULL_REQUEST_BODY: |
Pre-built bindings just updated.
Don't forget to bump version and make release.
PULL_REQUEST_IS_DRAFT: false
CONTENT_COMPARISON: true
REVIEWERS: '["boozook"]'
LABELS: '["pre-built bindings"]'