-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bindgen is not default from now (#474) * api-tests refactoring * implement nearest applicable match for bindings feature-set, sys-build-script refactoring * docs.rs-like-env tests (no sdk) * fix scoreboards features for docs.rs * fix unstable-options of rustdoc usage, bump crates * bump crates * add `bindgen-cfg` & `bindgen` tests * add finalisation step for complex/dynamic matrixes
- Loading branch information
Showing
27 changed files
with
1,475 additions
and
629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Prepare Cargo Config | ||
description: -- | ||
author: Alex Koz | ||
branding: | ||
icon: package | ||
color: yellow | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Config | ||
shell: bash | ||
run: | | ||
mkdir -p .cargo | ||
cp -rf .github/config.toml .cargo/config.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Install playdate-bindgen | ||
description: Install playdate-bindgen with caching | ||
author: Alex Koz | ||
branding: | ||
icon: package | ||
color: yellow | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache (LLVM) | ||
id: cache-llvm | ||
if: runner.os == 'Windows' | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ runner.temp }}/llvm | ||
key: llvm-14.0-${{ runner.os }}-${{ runner.arch }} | ||
|
||
# See: | ||
# https://github.com/rust-lang/rust-bindgen/issues/1797 | ||
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows | ||
- name: Install LLVM | ||
if: runner.os == 'Windows' | ||
uses: KyleMayes/install-llvm-action@v2 | ||
with: | ||
version: "14.0" | ||
directory: ${{ runner.temp }}/llvm | ||
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | ||
|
||
- name: Cache (bindgen) | ||
uses: actions/cache/restore@v4 | ||
id: cache | ||
with: | ||
path: ~/.cargo/bin/pdbindgen${{ runner.os == 'Windows' && '.exe' || '' }} | ||
key: bindgen-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('./support/bindgen/Cargo.toml') }} | ||
|
||
- name: Install playdate-bindgen | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
cargo install playdate-bindgen --path ./support/bindgen --debug --locked --features=cli --features=runtime | ||
- name: Installed | ||
shell: bash | ||
run: pdbindgen -V | ||
|
||
- uses: actions/cache/save@v4 | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ~/.cargo/bin/pdbindgen${{ runner.os == 'Windows' && '.exe' || '' }} | ||
key: bindgen-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('./support/bindgen/Cargo.toml') }} | ||
|
||
- name: debug | ||
shell: bash | ||
run: ls ~/.cargo/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Install Playdate SDK | ||
description: Install Playdate SDK with custom-url | ||
author: Alex Koz | ||
branding: | ||
icon: package | ||
color: yellow | ||
inputs: | ||
version: | ||
default: latest | ||
description: Version of the SDK | ||
mac: | ||
default: '' | ||
required: false | ||
description: URL for Mac (uni) | ||
win: | ||
default: '' | ||
required: false | ||
description: URL for Windows (uni) | ||
linux: | ||
default: '' | ||
required: false | ||
description: URL for Linux (x64) | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Playdate SDK ${{ inputs.version }} | ||
id: sdk | ||
uses: pd-rs/get-playdate-sdk@main | ||
with: | ||
version: ${{ inputs.version }} | ||
custom-url: ${{ inputs.version == 'beta' && ((runner.os == 'macOS' && inputs.mac) || (runner.os == 'Linux' && inputs.linux) || (runner.os == 'Windows' && inputs.win)) || '' }} | ||
|
||
- name: SDK ${{ steps.sdk.outputs.version }} installed | ||
shell: bash | ||
run: which pdc && pdc --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Api | ||
on: | ||
workflow_call: | ||
inputs: | ||
sdk: | ||
description: "Version of Playdate SDK" | ||
default: latest | ||
type: string | ||
required: true | ||
ref: | ||
description: git branch, tag or SHA to checkout. | ||
type: string | ||
required: true | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
RUSTUP_MAX_RETRIES: 10 | ||
CARGO_TERM_COLOR: always | ||
CARGO_TERM_PROGRESS_WHEN: never | ||
|
||
jobs: | ||
# Final no-op job as result of all deps-jobs, needed as finalisation step of complex/dynamic matrix. | ||
success: | ||
needs: sys | ||
name: Done | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: success | ||
run: "true" | ||
|
||
sys: | ||
name: >- | ||
Sys (${{ matrix.os.name }}${{ matrix.bindgen.install && ' +bindgen' || '' }}) | ||
${{ matrix.bindgen.features }} | ||
env: | ||
FEATURES_1: bindgen-runtime | ||
FEATURES_2: bindgen-runtime,bindings-derive-debug | ||
FEATURES_3: bindgen-runtime,bindings-derive-debug,sys/bindings-documentation,sys/error-ctx | ||
BUILD_STD_ARGS: -Zbuild-std=core,alloc --target=thumbv7em-none-eabihf | ||
defaults: | ||
run: | ||
shell: bash | ||
runs-on: ${{ matrix.os.key }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- { name: mac, key: macos-14 } | ||
- { name: win, key: windows-latest } | ||
- { name: linux, key: ubuntu-latest } | ||
sdk: | ||
- ${{ inputs.sdk || 'latest' }} | ||
bindgen: | ||
- install: false | ||
- install: false | ||
features: bindings-derive-debug | ||
- install: false | ||
features: bindgen-runtime | ||
- install: false | ||
features: bindgen-runtime,bindings-derive-debug | ||
- install: true | ||
- install: true | ||
features: bindings-derive-debug | ||
- install: true | ||
features: bindgen-runtime | ||
- install: true | ||
features: bindgen-runtime,bindings-derive-debug | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref || github.ref }} | ||
|
||
- name: Config | ||
uses: ./.github/actions/init-cfg | ||
|
||
- name: Install bindgen | ||
if: matrix.bindgen.install | ||
uses: ./.github/actions/install-bindgen | ||
|
||
- name: Install SDK (${{ matrix.sdk }}) | ||
uses: ./.github/actions/install-sdk | ||
with: | ||
version: ${{ matrix.sdk }} | ||
mac: ${{ secrets.SDK_BETA_MACOS }} | ||
win: ${{ secrets.SDK_BETA_WINDOWS }} | ||
linux: ${{ secrets.SDK_BETA_LINUX }} | ||
|
||
- name: SDK ${{ steps.sdk.outputs.version }} installed | ||
run: which pdc && pdc --version | ||
|
||
- name: Test (host) | ||
run: cargo test -p=playdate-sys --features=${{ matrix.bindgen.features }} -- --nocapture | ||
|
||
- name: Build (host) | ||
run: | | ||
cargo build -p=playdate-sys --features=${{ matrix.bindgen.features }} --example=hello-world --features=lang-items | ||
cargo build -p=playdate-sys --features=${{ matrix.bindgen.features }} --example=handler --features=lang-items,entry-point | ||
- name: Build (device) | ||
run: | | ||
cargo build -p=playdate-sys --features=${{ matrix.bindgen.features }} ${{ env.BUILD_STD_ARGS }} --example=hello-world --features=lang-items | ||
cargo build -p=playdate-sys --features=${{ matrix.bindgen.features }} ${{ env.BUILD_STD_ARGS }} --example=handler --features=lang-items,entry-point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Docs | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: git branch, tag or SHA to checkout. | ||
type: string | ||
required: true | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
RUSTUP_MAX_RETRIES: 10 | ||
CARGO_TERM_COLOR: always | ||
CARGO_TERM_PROGRESS_WHEN: never | ||
|
||
jobs: | ||
# Final no-op job as result of all deps-jobs, needed as finalisation step of complex/dynamic matrix. | ||
success: | ||
needs: docs | ||
name: Done | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: success | ||
run: "true" | ||
|
||
# Gets all workspace members, all and filtered by `package.publish` | ||
metadata: | ||
name: Preparation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref || github.ref }} | ||
|
||
# To get cargo metadata in the specified stable format we need just any stable cargo, | ||
# so delete toolchain cfg here to prevent rustup install required one. Existing is often. | ||
- name: Toolchain | ||
run: rm ./rust-toolchain.toml | ||
|
||
- name: Metadata | ||
id: metadata | ||
run: | | ||
META="$(cargo +stable metadata --format-version=1 -q --color=never)" | ||
MEMBERS="$(jq '(.workspace_members) as $wm | { packages: [.packages[] | select(.id as $id | $wm | index($id))] } | { crate:.packages }' <<< "$META")" | ||
echo "members<<EOF" >> $GITHUB_OUTPUT | ||
echo $MEMBERS >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
PUBLIC="$(jq '{ crate: [.crate[] | select(.publish == null or .publish == true)] }' <<< "$MEMBERS")" | ||
echo "public<<EOF" >> $GITHUB_OUTPUT | ||
echo $PUBLIC >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
outputs: | ||
members: ${{ steps.metadata.outputs.members }} | ||
public: ${{ steps.metadata.outputs.public }} | ||
|
||
# Imitate docs.rs, no-sdk environment | ||
docs: | ||
name: ${{ matrix.crate.name }} | ||
needs: metadata | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.metadata.outputs.public) }} | ||
env: | ||
LIBUDEV_DEPENDENTS: >- | ||
cargo-playdate | ||
playdate-device | ||
playdate-tool | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref || github.ref }} | ||
|
||
- name: Install Deps | ||
if: ${{ contains(env.LIBUDEV_DEPENDENTS, matrix.crate.name) }} | ||
uses: ./.github/actions/tools-deps | ||
|
||
- name: Test | ||
env: | ||
DOCS_RS: 1 | ||
PLAYDATE_SDK_PATH: 0 | ||
IGNORE_EXISTING_PLAYDATE_SDK: 1 | ||
FEATURES: ${{ join(matrix.crate.metadata.docs.rs.features.*, ',') }} | ||
ALL_FEATURES: ${{ matrix.crate.metadata.docs.rs.all-features && '--all-features' || '' }} | ||
NO_DEFAULT_FEATURES: ${{ matrix.crate.metadata.docs.rs.no-default-features && '--no-default-features' || '' }} | ||
DEFAULT_TARGET: ${{ matrix.crate.metadata.docs.rs.default-target && '--target=' || '' }}${{ matrix.crate.metadata.docs.rs.default-target || '' }} | ||
TARGETS: ${{ matrix.crate.metadata.docs.rs.targets && '--target=' || '' }}${{ join(matrix.crate.metadata.docs.rs.targets.*, ' --target=') }} | ||
CARGO_ARGS: ${{ join(matrix.crate.metadata.docs.rs.cargo-args.*, ' ') }} | ||
RUSTFLAGS: ${{ join(matrix.crate.metadata.docs.rs.rustc-args.*, ' ') }} | ||
RUSTDOCFLAGS: ${{ join(matrix.crate.metadata.docs.rs.rustdoc-args.*, ' ') }} | ||
# docs: | ||
# https://docs.rs/about/metadata | ||
# https://doc.rust-lang.org/cargo/reference/environment-variables.html | ||
run: cargo doc ${{ env.CARGO_ARGS }} ${{ env.NO_DEFAULT_FEATURES }} ${{ env.ALL_FEATURES }} -p=${{ matrix.crate.name }} ${{ env.DEFAULT_TARGET }} ${{ env.TARGETS }} --features="${{ env.FEATURES }}" |
Oops, something went wrong.