Update pre-built bindings #388
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
name: Tests | |
on: | |
pull_request: | |
push: | |
branches: [main, master] | |
env: | |
CARGO_INCREMENTAL: 1 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
CARGO_TERM_COLOR: always | |
CARGO_TERM_PROGRESS_WHEN: never | |
# logging: | |
RUST_LOG: trace | |
CARGO_PLAYDATE_LOG: trace | |
# crates lists: | |
API_CRATES: >- | |
-p=playdate-color | |
-p=playdate-controls | |
-p=playdate-display | |
-p=playdate-fs | |
-p=playdate-graphics | |
-p=playdate-menu | |
-p=playdate-scoreboards | |
-p=playdate-sound | |
-p=playdate-sprite | |
-p=playdate-system | |
-p=playdate | |
PD_BUILD_BINDINGS_ONCE: 1 | |
jobs: | |
api: | |
name: API | |
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 | |
needs: format | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
# - windows-latest | |
sdk: | |
# - beta | |
- latest | |
- 2.3.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
target/ | |
~/.cargo | |
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }} | |
- name: Config | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Cache LLVM | |
id: cache-llvm | |
if: runner.os == 'Windows' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ runner.temp }}/llvm | |
key: llvm-14.0 | |
# 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/[email protected] | |
with: | |
version: "14.0" | |
directory: ${{ runner.temp }}/llvm | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
env: true | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
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 | |
run: which pdc && pdc --version | |
# - name: Install Bindgen | |
# # id: pdbindgen | |
# # continue-on-error: true | |
# if: runner.os == 'Windows' | |
# env: | |
# # LLVM_CONFIG_PATH: ${{ env.LLVM_PATH }}\\bin\\llvm-config | |
# LIBCLANG_PATH: ${{ env.LLVM_PATH }}\\bin | |
# run: >- | |
# cargo install playdate-bindgen --path ./support/bindgen | |
# --features=cli | |
# --debug | |
# # --features=cli,static --no-default-features | |
- name: Test Sys (host) | |
run: | | |
cargo test -p=playdate-sys --features=lang-items -- --nocapture | |
cargo test -p=playdate-sys --features=lang-items,$FEATURES_1 | |
cargo test -p=playdate-sys --features=lang-items,$FEATURES_2 | |
- name: Build Sys (device) | |
# env: | |
## add env if step.pdbindgen.failed | |
# DOCS_RS: ${{ runner.os == 'Windows' && 1 || 0 }} | |
# IGNORE_EXISTING_PLAYDATE_SDK: ${{ runner.os == 'Windows' && 1 || 0 }} | |
run: | | |
cargo build -p=playdate-sys ${{ env.BUILD_STD_ARGS }} | |
cargo build -p=playdate-sys --features=lang-items,$FEATURES_1 ${{ env.BUILD_STD_ARGS }} --examples | |
cargo build -p=playdate-sys --features=lang-items,$FEATURES_2 ${{ env.BUILD_STD_ARGS }} --examples | |
- name: Test Crates (host) | |
run: | | |
cargo test ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_1 -- --nocapture | |
cargo test ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_2 | |
# cargo test ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_3 | |
- name: Check Crates (device) | |
run: cargo check ${{ env.API_CRATES }} --target=thumbv7em-none-eabihf | |
- name: Build Crates (device) | |
run: | | |
cargo build ${{ env.API_CRATES }} --features=sys/lang-items,$FEATURES_1 ${{ env.BUILD_STD_ARGS }} --examples --lib | |
cargo build ${{ env.API_CRATES }} --features=sys/lang-items,$FEATURES_2 ${{ env.BUILD_STD_ARGS }} --examples --lib | |
cargo build ${{ env.API_CRATES }} --features=sys/lang-items,$FEATURES_3 ${{ env.BUILD_STD_ARGS }} --examples --lib | |
# Imitate docs.rs environment | |
- name: Test in no-sdk environment | |
env: | |
DOCS_RS: 1 | |
PLAYDATE_SDK_PATH: 0 | |
IGNORE_EXISTING_PLAYDATE_SDK: 1 | |
run: | | |
cargo doc -p=playdate-sys --target=thumbv7em-none-eabihf --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 | |
utils: | |
name: Utils | |
defaults: | |
run: | |
shell: bash | |
needs: format | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
# - windows-latest | |
sdk: | |
- latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
target/ | |
~/.cargo | |
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }} | |
- name: Config | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Install Deps | |
if: runner.os == 'Windows' | |
run: | | |
# mingw-w64-x86_64-libusb | |
choco install pkgconfiglite | |
pkg-config --cflags --libs libusb-1.0 | |
pkg-config --cflags --libs libusb | |
- 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 | |
- name: Test | |
run: | | |
cargo test -p=playdate-build-utils --all-features | |
cargo test -p=playdate-build --all-features | |
cargo test -p=playdate-tool --all-features | |
tool: | |
name: Tool | |
defaults: | |
run: | |
shell: bash | |
needs: format | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
# - windows-latest | |
sdk: | |
# - beta | |
- latest | |
- 2.3.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
target/ | |
~/.cargo | |
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }} | |
- name: Config | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Cache LLVM | |
id: cache-llvm | |
if: runner.os == 'Windows' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ runner.temp }}/llvm | |
key: llvm-14.0 | |
# 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/[email protected] | |
with: | |
version: "14.0" | |
directory: ${{ runner.temp }}/llvm | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
env: true | |
- name: Install Deps | |
if: runner.os == 'Windows' | |
run: | | |
# mingw-w64-x86_64-libusb | |
choco install pkgconfiglite | |
pkg-config --cflags --libs libusb-1.0 | |
pkg-config --cflags --libs libusb | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
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 | |
run: which pdc && pdc --version | |
- name: Check | |
run: cargo check --tests -p=cargo-playdate --all-features | |
# Simulator doesn't works in headless mode | |
# - name: Install Sim Deps | |
# if: ${{ runner.os == 'Linux' }} | |
# run: | | |
# sudo apt update | |
# sudo apt -y install libwebkit2gtk-4.0-dev | |
- name: Test | |
run: | | |
cargo test -p=cargo-playdate -- --nocapture | |
rm -rf ./target/tmp | |
# This test is flickering on GH CI 🤷🏻♂️ | |
- name: Execution | |
if: runner.os == 'macOS' && contains(github.event.head_commit.message, 'execution') | |
env: | |
RUSTFLAGS: --cfg exec_tests | |
run: | | |
cargo test -p=cargo-playdate run -- --nocapture --test-threads=1 | |
sudo killall "Playdate Simulator" || true | |
rm -rf ./target/tmp | |
use-tool: | |
name: Examples | |
defaults: | |
run: | |
shell: bash | |
needs: format | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
# - windows-latest | |
sdk: | |
# - beta | |
- latest | |
- 2.3.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo | |
key: ${{ runner.os }}-cargo-tests-examples-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-tests-examples-${{ hashFiles('Cargo.lock') }} | |
${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }} | |
- name: Config | |
run: | | |
rm -rf ./target/tmp || true | |
rm -rf ./target/playdate || true | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
cargo clean | |
- name: Cache LLVM | |
id: cache-llvm | |
if: runner.os == 'Windows' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ runner.temp }}/llvm | |
key: llvm-14.0 | |
# 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/[email protected] | |
with: | |
version: "14.0" | |
directory: ${{ runner.temp }}/llvm | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
env: true | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
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 | |
run: which pdc && pdc --version | |
- name: Install | |
run: cargo install --path=./cargo --debug | |
- name: Examples | |
run: | | |
FEATURES=sys/lang-items,sys/entry-point | |
cargo playdate package --features=lang-items --examples --device --simulator -p=playdate-sys | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-color | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-controls | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-display | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-fs | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-graphics | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-menu | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-scoreboards | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-sound | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-sprite | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-system | |
cargo playdate package --features=lang-items,entry-point --examples --device --simulator -p=playdate | |
# TODO: build crankstart with examples for compatibility test | |
format: | |
name: Format | |
defaults: | |
run: | |
shell: bash | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Check | |
# if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} | |
# uses: clechasseur/[email protected] | |
# # with: | |
# # toolchain: nightly | |
- name: Check | |
# if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }} | |
run: cargo fmt -- --check |