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)
|
||||
|
||||
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/$GAME_NAME.gba"
|
||||
cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba"
|
||||
}
|
||||
|
||||
mkdir -p examples/target
|
||||
|
@ -30,4 +32,4 @@ build_rom "examples/the-hat-chooses-the-wizard" "HATWIZARD"
|
|||
|
||||
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
|
||||
tag: ${{ github.ref }}
|
||||
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:
|
||||
push:
|
||||
tags:
|
||||
- agb-fixnum/v*
|
||||
- "*/v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -15,6 +15,5 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
- name: Login to crates.io
|
||||
run: cargo login ${{ secrets.CRATE_API }}
|
||||
- name: Publish agb-fixnum
|
||||
run: cargo publish
|
||||
working-directory: ./agb-fixnum
|
||||
- name: Publish crate
|
||||
run: bash .github/scripts/publish-crate.sh
|
30
.github/workflows/rust.yml
vendored
30
.github/workflows/rust.yml
vendored
|
@ -31,33 +31,7 @@ jobs:
|
|||
run: cargo install --path mgba-test-runner --verbose
|
||||
- name: Install gbafix
|
||||
run: cargo install gbafix
|
||||
- name: Build agb library
|
||||
working-directory: agb
|
||||
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 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
|
||||
|
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"
|
||||
TAGNAME="v$VERSION"
|
||||
;;
|
||||
agb-image-converter)
|
||||
DIRECTORY="agb-image-converter"
|
||||
TAGNAME="agb-image-converter/v$VERSION"
|
||||
;;
|
||||
agb-sound-converter)
|
||||
DIRECTORY="agb-sound-converter"
|
||||
TAGNAME="agb-sound-converter/v$VERSION"
|
||||
;;
|
||||
agb-macros)
|
||||
DIRECTORY="agb-macros"
|
||||
TAGNAME="agb-macros/v$VERSION"
|
||||
agb-*)
|
||||
if [ -f "$PROJECT/Cargo.toml" ]; then
|
||||
DIRECTORY=$PROJECT
|
||||
TAGNAME="$PROJECT/v$VERSION"
|
||||
else
|
||||
echo "Unknown project name $PROJECT"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
mgba-test-runner)
|
||||
DIRECTORY="mgba-test-runner"
|
||||
TAGNAME="mgba-test-runner/v$VERSION"
|
||||
;;
|
||||
agb-fixnum)
|
||||
DIRECTORY="agb-fixnum"
|
||||
TAGNAME="agb-fixnum/v$VERSION"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown project name $PROJECT"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in a new issue