Skip to content

fix action use

fix action use #38

Workflow file for this run

name: Update
on:
workflow_dispatch:
# schedule:
# - cron: "0 0 * * 1"
push:
branches: [main, master, ci/update-prebuild]
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: Checkout Master
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
- name: Create Branch
id: branch
uses: peterjgrainger/action-create-branch@v2.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: refs/heads/api/sys/pre-build
# ${{ github.event.pull_request.head.sha }}
- name: Created
run: 'echo "Created: ${{ steps.branch.outputs.created }}"'
# if not created => rebase to master
# TODO: do not reset, just rebase to master
# just try `git pull origin ${{github.event.repository.default_branch}}`
# and if failed => run ReSync
- name: ReSync Branch
if: ${{ steps.branch.outputs.created == 'false' }}
uses: Joao208/resync-branch@1.5.0
with:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: api/sys/pre-build
DEFAULT_BRANCH: ${{github.event.repository.default_branch}}
pre-gen:
name: Gen (${{ matrix.os }}, ${{ matrix.features.v }})
defaults:
run:
shell: bash
needs: new-branch
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest
sdk:
- latest
features:
- {
v: --features=bindings-documentation,
bindings-derive-debug,
name: default,
}
- {
v: --features=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/rust-cache@v2.6.2
- 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 ${{ matrix.features.v }} -vv
cargo build -p=playdate-sys ${{ matrix.features.v }} --release
- name: Device
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cargo build -p=playdate-sys ${{ matrix.features.v }} --target=thumbv7em-none-eabihf
cargo build -p=playdate-sys ${{ 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 ${{ matrix.features.v }}
# cargo test -p=playdate-sys ${{ 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 ${{ matrix.features.v }} --target=thumbv7em-none-eabihf -Zbuild-std=core,alloc
# cargo build -p=playdate-sys ${{ 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: boozook@users.noreply.github.com
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 }}"
# run: |
# git pull
# git config --global user.name 'Alex Koz'
# git config --global user.email 'boozook@users.noreply.github.com'
# git add ./api/sys/gen/*.rs
# git commit -am "Automated build pre-built bindings"
# git push
pr:
needs: pre-gen
runs-on: ubuntu-latest
defaults:
run:
shell: bash
permissions:
pull-requests: write
contents: write
steps:
# checkout branch from pre-gen job
- uses: actions/checkout@v4
with:
ref: api/sys/pre-build
- name: Create PR
# uses: sudoStatus200/create-sync-pr@0.3.1
# with:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# SOURCE_BRANCH: refs/heads/api/sys/pre-build
# TARGET_BRANCH: ${{ github.event.repository.default_branch }}
uses: TreTuna/sync-branches@1.4.0
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: refs/heads/api/sys/pre-build
TO_BRANCH: ${{ github.event.repository.default_branch }}
PULL_REQUEST_TITLE: Update pre-built bindings
PULL_REQUEST_BODY: ""
PULL_REQUEST_IS_DRAFT: false
CONTENT_COMPARISON: true
REVIEWERS: '["boozook"]'
# PULL_REQUEST_AUTO_MERGE_METHOD: merge
# uses: lenra-io/create-or-update-pr-action@v1.1.0
# with:
# name: Update pre-built bindings
# # token: ${{ secrets.WORKFLOW_GITHUB_TOKEN }}
# # Don't use the `secrets.GITHUB_TOKEN` here because this token can't trigger workflow event if we push something or create a PR.
# token: ${{ secrets.GITHUB_TOKEN }}
# message: Automated update pre-built bindings
# uses: peter-evans/create-pull-request@v5
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# title: Update pre-built bindings
# branch: api/sys/pre-build
# base: ${{ github.event.repository.default_branch }}
# commit-message: Automated update pre-built bindings
# # committer: Update Workflow
# # author: Alex Koz <boozook@users.noreply.github.com>
# # branch-suffix: short-commit-hash
# delete-branch: false
# assignees: boozook
# reviewers: boozook
# uses: technote-space/create-pr-action@v2
# with:
# PR_BRANCH_NAME: api/sys/pre-build
# PR_TITLE: Update pre-built bindings