mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Merge pull request #158 from gwilymk/consolidate-workflows
Consolidate workflows
This commit is contained in:
commit
40b87e6c6f
6
.github/scripts/build-example-gba-files.sh
vendored
6
.github/scripts/build-example-gba-files.sh
vendored
|
@ -17,10 +17,12 @@ function build_rom() {
|
||||||
|
|
||||||
(cd "$GAME_FOLDER" && cargo build --release --verbose --target thumbv4t-none-eabi)
|
(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"
|
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"
|
gbafix -p "-t${INTERNAL_NAME:0:12}" "-c${INTERNAL_NAME:0:4}" -mGC "$GBA_FILE"
|
||||||
|
|
||||||
cp -v "$GBA_FILE" "examples/$GAME_NAME.gba"
|
cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba"
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p examples/target
|
mkdir -p examples/target
|
||||||
|
@ -30,4 +32,4 @@ build_rom "examples/the-hat-chooses-the-wizard" "HATWIZARD"
|
||||||
|
|
||||||
build_rom "book/games/pong" "PONG"
|
build_rom "book/games/pong" "PONG"
|
||||||
|
|
||||||
zip examples/target/examples.zip examples/*.gba
|
(cd examples/target && zip examples.zip examples/*.gba)
|
8
.github/scripts/publish-crate.sh
vendored
Normal file
8
.github/scripts/publish-crate.sh
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e # Fail if any command fails
|
||||||
|
|
||||||
|
RELEASE_TAG=$(git tag --points-at HEAD)
|
||||||
|
|
||||||
|
PROJECT=${RELEASE_TAG/\/*/}
|
||||||
|
(cd "$PROJECT" && cargo publish)
|
23
.github/scripts/run-branch-build.sh
vendored
Normal file
23
.github/scripts/run-branch-build.sh
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/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
|
38
.github/workflows/build-book.yml
vendored
Normal file
38
.github/workflows/build-book.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
name: Build book
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
paths:
|
||||||
|
'book/**'
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
paths:
|
||||||
|
'book/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Set CARGO_TARGET_DIR
|
||||||
|
run: echo "CARGO_TARGET_DIR=$HOME/target" >> $GITHUB_ENV
|
||||||
|
- name: Install build tools
|
||||||
|
run: sudo apt-get update && sudo apt-get install build-essential binutils-arm-none-eabi libelf-dev zip -y
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Cache
|
||||||
|
uses: actions/cache@v2.1.7
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
~/target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Install mdbook
|
||||||
|
run: cargo install mdbook
|
||||||
|
- name: Build the book
|
||||||
|
run: mdbook build
|
||||||
|
working-directory: book
|
20
.github/workflows/publish-agb-macros.yml
vendored
20
.github/workflows/publish-agb-macros.yml
vendored
|
@ -1,20 +0,0 @@
|
||||||
name: Publish agb-macros
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- agb-macros/v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Install build tools
|
|
||||||
run: sudo apt-get update && sudo apt-get install build-essential binutils-arm-none-eabi -y
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Login to crates.io
|
|
||||||
run: cargo login ${{ secrets.CRATE_API }}
|
|
||||||
- name: Publish agb-macros
|
|
||||||
run: cargo publish
|
|
||||||
working-directory: ./agb-macros
|
|
11
.github/workflows/publish-agb.yml
vendored
11
.github/workflows/publish-agb.yml
vendored
|
@ -36,3 +36,14 @@ jobs:
|
||||||
asset_name: examples.zip
|
asset_name: examples.zip
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
|
- name: Install mdbook
|
||||||
|
run: cargo install mdbook
|
||||||
|
- name: Build the book
|
||||||
|
run: mdbook build
|
||||||
|
working-directory: book
|
||||||
|
- name: Deploy the book
|
||||||
|
uses: JamesIves/github-pages-deploy-action@v4.2.2
|
||||||
|
with:
|
||||||
|
branch: gh-pages
|
||||||
|
folder: book/book
|
||||||
|
|
20
.github/workflows/publish-image-converter.yml
vendored
20
.github/workflows/publish-image-converter.yml
vendored
|
@ -1,20 +0,0 @@
|
||||||
name: Publish agb-image-converter
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- agb-image-converter/v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Install build tools
|
|
||||||
run: sudo apt-get update && sudo apt-get install build-essential binutils-arm-none-eabi -y
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Login to crates.io
|
|
||||||
run: cargo login ${{ secrets.CRATE_API }}
|
|
||||||
- name: Publish agb-image-converter
|
|
||||||
run: cargo publish
|
|
||||||
working-directory: ./agb-image-converter
|
|
20
.github/workflows/publish-sound-converter.yml
vendored
20
.github/workflows/publish-sound-converter.yml
vendored
|
@ -1,20 +0,0 @@
|
||||||
name: Publish agb-sound-converter
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- agb-sound-converter/v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Install build tools
|
|
||||||
run: sudo apt-get update && sudo apt-get install build-essential binutils-arm-none-eabi -y
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Login to crates.io
|
|
||||||
run: cargo login ${{ secrets.CRATE_API }}
|
|
||||||
- name: Publish agb-sound-converter
|
|
||||||
run: cargo publish
|
|
||||||
working-directory: ./agb-sound-converter
|
|
|
@ -1,9 +1,9 @@
|
||||||
name: Publish agb-fixnum
|
name: Publish sub crate
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- agb-fixnum/v*
|
- "*/v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -15,6 +15,5 @@ jobs:
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Login to crates.io
|
- name: Login to crates.io
|
||||||
run: cargo login ${{ secrets.CRATE_API }}
|
run: cargo login ${{ secrets.CRATE_API }}
|
||||||
- name: Publish agb-fixnum
|
- name: Publish crate
|
||||||
run: cargo publish
|
run: bash .github/scripts/publish-crate.sh
|
||||||
working-directory: ./agb-fixnum
|
|
32
.github/workflows/rust.yml
vendored
32
.github/workflows/rust.yml
vendored
|
@ -31,33 +31,7 @@ jobs:
|
||||||
run: cargo install --path mgba-test-runner --verbose
|
run: cargo install --path mgba-test-runner --verbose
|
||||||
- name: Install gbafix
|
- name: Install gbafix
|
||||||
run: cargo install gbafix
|
run: cargo install gbafix
|
||||||
- name: Build agb library
|
- name: Build and test all crates
|
||||||
working-directory: agb
|
run: bash .github/scripts/run-branch-build.sh
|
||||||
run: cargo build --verbose
|
|
||||||
- name: Run Clippy on agb
|
|
||||||
working-directory: agb
|
|
||||||
run: cargo clippy --verbose
|
|
||||||
- name: Run Clippy on agb image converter
|
|
||||||
working-directory: agb-image-converter
|
|
||||||
run: cargo clippy --verbose
|
|
||||||
- name: Run Clippy on agb sound converter
|
|
||||||
working-directory: agb-sound-converter
|
|
||||||
run: cargo clippy --verbose
|
|
||||||
- name: Run Clippy on agb macros
|
|
||||||
working-directory: agb-macros
|
|
||||||
run: cargo clippy --verbose
|
|
||||||
- name: Run Clippy on agb fixnum
|
|
||||||
working-directory: agb-fixnum
|
|
||||||
run: cargo clippy --verbose
|
|
||||||
- name: Run Tests for fixnum
|
|
||||||
working-directory: agb-fixnum
|
|
||||||
run: cargo test --verbose
|
|
||||||
- name: Run Tests for agb in debug mode
|
|
||||||
working-directory: agb
|
|
||||||
run: cargo test --verbose
|
|
||||||
- name: Run Tests for agb in release mode
|
|
||||||
working-directory: agb
|
|
||||||
run: cargo test --verbose --release
|
|
||||||
- name: Build example projects
|
- name: Build example projects
|
||||||
run: bash .github/scripts/build-example-gba-files.sh
|
run: bash .github/scripts/build-example-gba-files.sh
|
||||||
|
|
1
examples/.gitignore
vendored
1
examples/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
*.gba
|
|
23
release.sh
23
release.sh
|
@ -31,26 +31,19 @@ case "$PROJECT" in
|
||||||
DIRECTORY="agb"
|
DIRECTORY="agb"
|
||||||
TAGNAME="v$VERSION"
|
TAGNAME="v$VERSION"
|
||||||
;;
|
;;
|
||||||
agb-image-converter)
|
agb-*)
|
||||||
DIRECTORY="agb-image-converter"
|
if [ -f "$PROJECT/Cargo.toml" ]; then
|
||||||
TAGNAME="agb-image-converter/v$VERSION"
|
DIRECTORY=$PROJECT
|
||||||
;;
|
TAGNAME="$PROJECT/v$VERSION"
|
||||||
agb-sound-converter)
|
else
|
||||||
DIRECTORY="agb-sound-converter"
|
echo "Unknown project name $PROJECT"
|
||||||
TAGNAME="agb-sound-converter/v$VERSION"
|
exit 1
|
||||||
;;
|
fi
|
||||||
agb-macros)
|
|
||||||
DIRECTORY="agb-macros"
|
|
||||||
TAGNAME="agb-macros/v$VERSION"
|
|
||||||
;;
|
;;
|
||||||
mgba-test-runner)
|
mgba-test-runner)
|
||||||
DIRECTORY="mgba-test-runner"
|
DIRECTORY="mgba-test-runner"
|
||||||
TAGNAME="mgba-test-runner/v$VERSION"
|
TAGNAME="mgba-test-runner/v$VERSION"
|
||||||
;;
|
;;
|
||||||
agb-fixnum)
|
|
||||||
DIRECTORY="agb-fixnum"
|
|
||||||
TAGNAME="agb-fixnum/v$VERSION"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Unknown project name $PROJECT"
|
echo "Unknown project name $PROJECT"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue