From 432ea719663cf91a5607243ac5ac4a18b07e7d33 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Thu, 24 Feb 2022 21:32:11 +0000 Subject: [PATCH] Migrate build-example-gba-files to just --- .github/scripts/build-example-gba-files.sh | 35 ---------------------- .github/scripts/run-branch-build.sh | 23 -------------- .github/workflows/build-and-test.yml | 5 ++-- justfile | 2 +- 4 files changed, 3 insertions(+), 62 deletions(-) delete mode 100755 .github/scripts/build-example-gba-files.sh delete mode 100644 .github/scripts/run-branch-build.sh diff --git a/.github/scripts/build-example-gba-files.sh b/.github/scripts/build-example-gba-files.sh deleted file mode 100755 index beee0401..00000000 --- a/.github/scripts/build-example-gba-files.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -set -e # Fail if any command fails -set -x # print every command before it runs - -# Requires gbafix and arm-none-eabi-objcopy to already be installed - -function build_rom() { - local GAME_FOLDER="$1" - local INTERNAL_NAME="$2" - - local GAME_NAME - GAME_NAME="$(basename "$GAME_FOLDER")" - - local TARGET_FOLDER="${CARGO_TARGET_DIR:-$GAME_FOLDER/target}" - local GBA_FILE="$TARGET_FOLDER/$GAME_NAME.gba" - - (cd "$GAME_FOLDER" && cargo build --release --verbose --target thumbv4t-none-eabi) - - mkdir -p examples/target/examples - - arm-none-eabi-objcopy -O binary "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" "$GBA_FILE" - gbafix -p "-t${INTERNAL_NAME:0:12}" "-c${INTERNAL_NAME:0:4}" -mGC "$GBA_FILE" - - cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba" -} - -mkdir -p examples/target - -build_rom "examples/the-purple-night" "PURPLENIGHT" -build_rom "examples/the-hat-chooses-the-wizard" "HATWIZARD" - -build_rom "book/games/pong" "PONG" - -(cd examples/target && zip examples.zip examples/*.gba) \ No newline at end of file diff --git a/.github/scripts/run-branch-build.sh b/.github/scripts/run-branch-build.sh deleted file mode 100644 index 45a5a8c4..00000000 --- a/.github/scripts/run-branch-build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -e # Fail if any command fails - -CARGO_PROJECT_FILES=( agb-*/Cargo.toml agb/Cargo.toml examples/*/Cargo.toml book/games/*/Cargo.toml ) - -for CARGO_PROJECT_FILE in "${CARGO_PROJECT_FILES[@]}"; do - PROJECT_DIR=$(dirname "$CARGO_PROJECT_FILE") - - echo "Checking project $PROJECT_DIR" - (cd "$PROJECT_DIR" && cargo build) - - if echo "$PROJECT_DIR" | grep -qE '^agb'; then - echo "Running clippy on $PROJECT_DIR" - (cd "$PROJECT_DIR" && cargo clippy) - - echo "Testing $PROJECT_DIR in debug mode" - (cd "$PROJECT_DIR" && cargo test) - - echo "Testing $PROJECT_DIR in release mode" - (cd "$PROJECT_DIR" && cargo test --release) - fi -done diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8cb69deb..8c385284 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -32,7 +32,6 @@ jobs: run: echo "CARGO_TARGET_DIR=$HOME/target" >> $GITHUB_ENV - name: Install gbafix run: cargo install gbafix + - uses: extractions/setup-just@v1 - name: Build and test all crates - run: bash .github/scripts/run-branch-build.sh - - name: Build example projects - run: bash .github/scripts/build-example-gba-files.sh \ No newline at end of file + run: just ci \ No newline at end of file diff --git a/justfile b/justfile index 08e6b94f..561c5b95 100644 --- a/justfile +++ b/justfile @@ -1,6 +1,6 @@ build: _build-roms -ci: +ci: && _build-roms just _all-crates _build just _all-crates _test-debug just _all-crates _test-release