Skip to content

Commit

Permalink
Merge pull request #347 from boozook/win/package-examples-tests
Browse files Browse the repository at this point in the history
* Package examples on windows
* Fix: ensure boundary exists when `ensure_dir_exists`
* Tests for `check_top_boundary`
  • Loading branch information
boozook authored May 5, 2024
2 parents 28d376f + fd4083c commit e893117
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 50 deletions.
133 changes: 116 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,62 @@ jobs:
- 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

- name: Test (init::)
- name: Clean tmp
run: rm -rf ./target/tmp

tool-init:
name: 'Tool: Init'
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-14
- ubuntu-latest
- windows-latest
sdk:
# - beta
- latest
- 2.4.0

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}

- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Deps
uses: ./.github/actions/tools-deps

- 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: Test
env:
RUSTFLAGS: --cfg init_tests
run: |
Expand All @@ -268,18 +310,75 @@ jobs:
- name: Clean tmp
run: rm -rf ./target/tmp

# This test is flickering on GH CI 🤷🏻‍♂️
tool-execution:
# This tests are flickering on GH CI 🤷🏻‍♂️
if: contains(github.event.head_commit.message, 'test execution')
name: 'Tool: Run'
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-14
sdk:
# - beta
- latest
- 2.4.0

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}

- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Deps
uses: ./.github/actions/tools-deps

- 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

# 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: Clean tmp
run: rm -rf ./target/tmp

- name: Test 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
cargo test -p=cargo-playdate run:: -- --nocapture --test-threads=1
sudo killall "Playdate Simulator" || true
rm -rf ./target/tmp
use-tool:
name: Examples
tool-package:
name: 'Tool: Package'
defaults:
run:
shell: bash
Expand All @@ -290,7 +389,7 @@ jobs:
os:
- macos-14
- ubuntu-latest
# - windows-latest
- windows-latest
sdk:
# - beta
- latest
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ scripts:
workflows:
test:
name: Tests / Execution
name: 'Tests / Tool: Run'
max_build_duration: 20
instance_type: mac_mini_m1
environment:
Expand Down Expand Up @@ -67,7 +67,7 @@ workflows:
- name: Execution
script: |
source "$HOME/.cargo/env"
RUSTFLAGS="--cfg exec_tests" cargo test -p=cargo-playdate run -- --nocapture
RUSTFLAGS="--cfg exec_tests" cargo test -p=cargo-playdate run:: -- --nocapture
sudo killall "Playdate Simulator"
- name: Reset manifests
Expand Down
2 changes: 1 addition & 1 deletion support/build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "playdate-build"
version = "0.2.7"
version = "0.2.8"
readme = "README.md"
description = "Utils that help to build package for Playdate"
keywords = ["playdate", "package", "encoding", "manifest", "assets"]
Expand Down
6 changes: 2 additions & 4 deletions support/build/src/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ pub fn apply_build_plan<'l, 'r, P: AsRef<Path>>(plan: BuildPlan<'l, 'r>,
ensure_dir_exists(&into, target_root)?;
let filename =
source.file_name().ok_or_else(|| {
IoError::new(
IoErrorKind::InvalidFilename,
format!("Filename not found for {}", into.display()),
)
let msg = format!("Filename not found for {}", into.display());
IoError::new(IoErrorKind::InvalidFilename, msg)
})?;
let into = into.join(filename);
soft_link_checked(source, into, overwrite, target_root)
Expand Down
Loading

0 comments on commit e893117

Please sign in to comment.