-
-
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.
Merge pull request #98 from boozook/ci/codemagic
Tests on ARM 🎉
- Loading branch information
Showing
3 changed files
with
332 additions
and
6 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 |
---|---|---|
@@ -1,5 +1 @@ | ||
custom: | ||
- https://www.buymeacoffee.com/fzzr | ||
- ethereum://boozook.eth | ||
# ko_fi: boozook | ||
# lfx_crowdfunding: todo | ||
custom: https://www.buymeacoffee.com/fzzr |
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 |
---|---|---|
|
@@ -36,6 +36,7 @@ permissions: | |
|
||
jobs: | ||
new-branch: | ||
name: Branch | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
|
@@ -89,6 +90,81 @@ jobs: | |
working: ${{ steps.work_branch.outputs.value }} | ||
base: ${{ github.event.inputs.source || steps.base.outputs.value || github.event.repository.default_branch }} | ||
|
||
pre-gen-arm: | ||
# TODO: investigate how to trigger CM to use not default but specified workflow | ||
# Perhaps problem is in that config missed on master yet. | ||
if: false | ||
name: Gen (macos-arm64, all) | ||
defaults: | ||
run: | ||
shell: bash | ||
needs: new-branch | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
sdk: | ||
- ${{ github.event.inputs.sdk || 'latest' }} | ||
|
||
steps: | ||
- name: Inputs | ||
run: | | ||
echo "I: SDK version: ${{ github.event.inputs.sdk }}" | ||
echo "M: SDK version: ${{ matrix.sdk }}" | ||
echo "Base branch: ${{ needs.new-branch.outputs.base }}" | ||
echo "Working branch: ${{ needs.new-branch.outputs.working }}" | ||
- name: Trigger Codemagic | ||
id: build | ||
uses: codemagic-ci-cd/[email protected] | ||
with: | ||
app-id: 650d74df35face92bc95f717 | ||
workflow-id: 650d74df35face92bc95f716 | ||
token: ${{ secrets.CODEMAGIC_API_TOKEN }} | ||
branch: ${{ needs.new-branch.outputs.working }} | ||
xcode: latest | ||
# flutter: ${{ null }} | ||
# cocoapods: ${{ null }} | ||
# node: ${{ null }} | ||
# npm: ${{ null }} | ||
# ndk: ${{ null }} | ||
# java: ${{ null }} | ||
# ruby: ${{ null }} | ||
flutter: "" | ||
cocoapods: "" | ||
node: "" | ||
npm: "" | ||
ndk: "" | ||
java: "" | ||
ruby: "" | ||
env: | ||
CM_SPECIAL_REQUEST_BY_GHA: true | ||
|
||
- name: Build ID | ||
run: echo "${{ steps.build.outputs.build-id }}" | ||
|
||
- name: "Setup jq" | ||
uses: dcarbone/[email protected] | ||
with: | ||
version: "1.7" | ||
|
||
- name: Wait & Retry | ||
uses: nick-fields/[email protected] | ||
with: | ||
shell: bash | ||
timeout_seconds: 30 | ||
retry_wait_seconds: 30 | ||
max_attempts: 10 | ||
on_retry_command: echo "Retry..." | ||
command: >- | ||
curl -s | ||
-H "Content-Type: application/json" | ||
-H "x-auth-token: ${{ secrets.CODEMAGIC_API_TOKEN }}" | ||
--request GET https://api.codemagic.io/builds/${{ steps.build.outputs.build-id }} | | ||
jq -R 'fromjson | .build.buildActions.[] | select(.type == "finishing") | .status == "success"' --exit-status - | ||
pre-gen: | ||
name: Gen (${{ matrix.os }}, ${{ matrix.features.name }}) | ||
defaults: | ||
|
@@ -224,7 +300,7 @@ jobs: | |
pr: | ||
name: Make PR | ||
needs: [pre-gen, new-branch] | ||
needs: [new-branch, pre-gen] | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
|
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,254 @@ | ||
scripts: | ||
- &rustup_minimal | ||
name: Rustup | ||
script: >- | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal | ||
--default-toolchain nightly | ||
-c rustfmt | ||
- &rustup_full | ||
name: Rustup | ||
script: >- | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal | ||
--default-toolchain nightly | ||
-c rustfmt | ||
-c rust-src | ||
-t thumbv7em-none-eabihf | ||
- &install_sdk | ||
name: SDK | ||
script: | | ||
URL="https://download.panic.com/playdate_sdk/PlaydateSDK-latest.zip" | ||
curl -L -sS --show-error --fail "${URL?}" -o sdk.zip | ||
unzip sdk.zip | ||
sudo installer -store -pkg "PlaydateSDK.pkg" -target / | ||
echo "CFG: $(cat ~/.Playdate/config)" | ||
export PLAYDATE_SDK_PATH="$(grep -E '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | awk '{print $2}')" | ||
echo "SDK root: $PLAYDATE_SDK_PATH" | ||
echo "SDK version=$(cat $PLAYDATE_SDK_PATH/VERSION.txt)" | ||
echo "PLAYDATE_SDK_PATH=$PLAYDATE_SDK_PATH" >> $CM_ENV | ||
# clean | ||
rm -rf sdk.zip | ||
rm -rf PlaydateSDK.pkg | ||
rm -rf __MACOSX | ||
workflows: | ||
pre-gen: | ||
name: Build | ||
max_build_duration: 120 | ||
instance_type: mac_mini_m1 | ||
# when: | ||
# condition: | ||
|
||
environment: | ||
groups: | ||
- github_credentials | ||
vars: | ||
FEATURES_MIN: >- | ||
bindings-documentation | ||
bindings-derive-debug | ||
FEATURES_MAX: >- | ||
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 | ||
PLAYDATE_SDK_PATH: ~/Developer/PlaydateSDK | ||
# allow modify source for bindings generator: | ||
PD_BUILD_PREBUILT: 1 | ||
xcode: latest | ||
|
||
cache: | ||
cache_paths: | ||
- ~/.rustup | ||
- ~/.cargo | ||
# TODO: cache SDK installer | ||
|
||
triggering: | ||
events: | ||
- push | ||
branch_patterns: | ||
- pattern: api/sys/pre-build/** | ||
include: true | ||
source: true | ||
cancel_previous_builds: true | ||
|
||
scripts: | ||
- *rustup_minimal | ||
- *install_sdk | ||
|
||
- name: Input | ||
script: | | ||
echo "X: $CM_SPECIAL_REQUEST_BY_GHA" | ||
- name: Build | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo build -p=playdate-sys --features="${FEATURES_MIN?}" | ||
cargo build -p=playdate-sys --features="${FEATURES_MIN?}" --release | ||
cargo build -p=playdate-sys --features="${FEATURES_MAX?}" | ||
cargo build -p=playdate-sys --features="${FEATURES_MAX?}" --release | ||
- name: Status | ||
script: git status -u | ||
|
||
publishing: | ||
scripts: | ||
- name: Push | ||
ignore_failure: true | ||
script: | | ||
#!/usr/bin/env bash | ||
set -e # exit on first failed command | ||
set -x # print all executed commands to the log | ||
git pull | ||
git config --global user.name 'Alex Koz' | ||
git config --global user.email '[email protected]' | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN?}@github.com/$CM_REPO_SLUG.git | ||
git add ./api/sys/gen/*.rs | ||
git commit -m "Automated build pre-built bindings" && git push | ||
- name: Report | ||
script: | | ||
echo "TODO: report to gh" | ||
# if [ "$CM_GH_JOB" = "success" ] | ||
# then | ||
# fi | ||
test: | ||
name: Test | ||
max_build_duration: 120 | ||
instance_type: mac_mini_m1 | ||
environment: | ||
groups: | ||
- github_credentials | ||
vars: | ||
FEATURES_MIN: >- | ||
bindgen-runtime | ||
bindings-derive-debug | ||
FEATURES_MAX: >- | ||
bindgen-runtime | ||
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 | ||
PLAYDATE_SDK_PATH: ~/Developer/PlaydateSDK | ||
xcode: latest | ||
|
||
cache: | ||
cache_paths: | ||
- ~/.rustup | ||
- ~/.cargo | ||
- ./target | ||
|
||
triggering: | ||
events: | ||
- pull_request | ||
cancel_previous_builds: true | ||
# when: condition: not event.pull_request.draft | ||
|
||
scripts: | ||
- *rustup_full | ||
- *install_sdk | ||
|
||
- name: Default features | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo test \ | ||
-p=playdate-sys \ | ||
-p=playdate-fs \ | ||
-p=playdate-sound \ | ||
-p=playdate-color \ | ||
-p=playdate-controls \ | ||
-p=playdate-menu \ | ||
-p=playdate-graphics \ | ||
-p=playdate-display \ | ||
-p=playdate-system \ | ||
-p=playdate-sprite \ | ||
-p=playdate \ | ||
--lib --no-default-features --features="${FEATURES_MIN?}" -- --nocapture | ||
- name: All features | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo test \ | ||
-p=playdate-sys \ | ||
-p=playdate-fs \ | ||
-p=playdate-sound \ | ||
-p=playdate-color \ | ||
-p=playdate-controls \ | ||
-p=playdate-menu \ | ||
-p=playdate-graphics \ | ||
-p=playdate-display \ | ||
-p=playdate-system \ | ||
-p=playdate-sprite \ | ||
-p=playdate \ | ||
--lib --no-default-features --features="${FEATURES_MAX?}" -- --nocapture | ||
- name: Build Examples | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo build --target=thumbv7em-none-eabihf -p=playdate-fs --examples --features="${FEATURES_MIN?}" -Zbuild-std | ||
cargo build --target=thumbv7em-none-eabihf -p=playdate-controls --examples --features="${FEATURES_MIN?}" -Zbuild-std | ||
cargo build --target=thumbv7em-none-eabihf -p=playdate-color --examples --features="${FEATURES_MIN?}" -Zbuild-std | ||
cargo build --target=thumbv7em-none-eabihf -p=playdate-sound --examples --features="${FEATURES_MIN?}" -Zbuild-std | ||
cargo build --target=thumbv7em-none-eabihf -p=playdate-menu --examples --features="${FEATURES_MIN?}" -Zbuild-std | ||
cargo build --target=thumbv7em-none-eabihf -p=playdate-graphics --examples --features="${FEATURES_MIN?}" -Zbuild-std | ||
- name: Check Tool | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo check --tests -p=cargo-playdate --all-features | ||
- name: Test Tool | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo test -p=cargo-playdate -- --nocapture | ||
rm -rf ./target/tmp | ||
- name: Executions | ||
script: | | ||
source "$HOME/.cargo/env" | ||
RUSTFLAGS="--cfg exec_tests" cargo test -p=cargo-playdate run -- --nocapture | ||
sudo killall "Playdate Simulator" | ||
- name: Clean | ||
script: rm -rf ./target/tmp || true | ||
|
||
- name: Install | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo install --path=./cargo --debug | ||
- name: Pack Examples | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo playdate package --simulator --device -p=playdate-sys --examples --features="${FEATURES_MIN?}" | ||
cargo playdate package --simulator --device -p=playdate-fs --examples --features="${FEATURES_MIN?}" | ||
cargo playdate package --simulator --device -p=playdate-controls --examples --features="${FEATURES_MIN?}" | ||
cargo playdate package --simulator --device -p=playdate-color --examples --features="${FEATURES_MIN?}" | ||
cargo playdate package --simulator --device -p=playdate-sound --examples --features="${FEATURES_MIN?}" | ||
cargo playdate package --simulator --device -p=playdate-menu --examples --features="${FEATURES_MIN?}" | ||
cargo playdate package --simulator --device -p=playdate-graphics --examples --features="${FEATURES_MIN?}" | ||
- name: Clean | ||
script: | | ||
source "$HOME/.cargo/env" | ||
cargo uninstall cargo-playdate | ||
rm -rf ./target/tmp || true | ||
rm -rf ./target/playdate || true |