Migrate build-example-gba-files to just

This commit is contained in:
Gwilym Kuiper 2022-02-24 21:32:11 +00:00
parent c12b8d60ef
commit 432ea71966
4 changed files with 3 additions and 62 deletions

View file

@ -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)

View file

@ -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

View file

@ -32,7 +32,6 @@ jobs:
run: echo "CARGO_TARGET_DIR=$HOME/target" >> $GITHUB_ENV run: echo "CARGO_TARGET_DIR=$HOME/target" >> $GITHUB_ENV
- name: Install gbafix - name: Install gbafix
run: cargo install gbafix run: cargo install gbafix
- uses: extractions/setup-just@v1
- name: Build and test all crates - name: Build and test all crates
run: bash .github/scripts/run-branch-build.sh run: just ci
- name: Build example projects
run: bash .github/scripts/build-example-gba-files.sh

View file

@ -1,6 +1,6 @@
build: _build-roms build: _build-roms
ci: ci: && _build-roms
just _all-crates _build just _all-crates _build
just _all-crates _test-debug just _all-crates _test-debug
just _all-crates _test-release just _all-crates _test-release