CI Improvements
This commit is contained in:
parent
41fcc942fa
commit
31fcff13e9
@ -1,4 +1,4 @@
|
||||
name: 'Build'
|
||||
name: 'CI'
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -38,8 +38,9 @@ jobs:
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.mode }}-${{ matrix.arch }}
|
||||
path: ./out/**/*.AppImage*
|
||||
name: ${{ matrix.mode }} (${{ matrix.arch }})
|
||||
path: ./out/*.AppImage*
|
||||
if-no-files-found: error
|
||||
# Test Project
|
||||
test:
|
||||
strategy:
|
||||
@ -59,12 +60,38 @@ jobs:
|
||||
# Dependencies
|
||||
- name: Install Dependencies
|
||||
run: ./scripts/install-dependencies.sh
|
||||
- name: Install ARM Toolchain
|
||||
if: ${{ matrix.mode == 'Client' }}
|
||||
run: apt-get install --no-install-recommends -y g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
|
||||
# Test
|
||||
- name: Test
|
||||
run: ./scripts/test.sh ${{ matrix.mode }}
|
||||
# Example Mods
|
||||
example-mods:
|
||||
name: Build Example Mods
|
||||
runs-on: ubuntu-latest
|
||||
container: node:lts-bullseye
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
# Dependencies
|
||||
- name: Install Dependencies
|
||||
run: ./scripts/install-dependencies.sh
|
||||
- name: Install ARM Toolchain
|
||||
run: apt-get install --no-install-recommends -y g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
|
||||
# Build SDK
|
||||
- name: Build SDK
|
||||
run: |
|
||||
./scripts/build.mjs none client host
|
||||
./out/client/host/usr/bin/minecraft-pi-reborn-client --copy-sdk
|
||||
# Build Example Mods
|
||||
- name: Build Example Mods
|
||||
run: ./scripts/build-example-mods.sh
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Example Mods
|
||||
path: ./out/example-mods/*
|
||||
if-no-files-found: error
|
||||
# Create Release
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
@ -87,7 +114,7 @@ jobs:
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: ./out
|
||||
files: ./out/*/*.AppImage*
|
||||
api_key: ${{ secrets.RELEASE_TOKEN }}
|
||||
title: v${{ github.ref_name }}
|
||||
body: "[View Changelog](https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/src/branch/master/docs/CHANGELOG.md)"
|
||||
|
22
scripts/build-example-mods.sh
Executable file
22
scripts/build-example-mods.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Create Output Directory
|
||||
ROOT="$(pwd)"
|
||||
OUT="${ROOT}/out/example-mods"
|
||||
rm -rf "${OUT}"
|
||||
mkdir -p "${OUT}"
|
||||
|
||||
# Build
|
||||
for MOD in example-mods/*/; do
|
||||
cd "${ROOT}/${MOD}"
|
||||
# Build
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -GNinja ..
|
||||
cmake --build .
|
||||
# Copy Result
|
||||
cp lib*.so "${OUT}"
|
||||
done
|
@ -136,7 +136,11 @@ function updateDir(dir) {
|
||||
return path.join(dir, variant.name, architecture.name);
|
||||
}
|
||||
build = updateDir(build);
|
||||
let cleanOut = false;
|
||||
if (packageType === PackageTypes.None) {
|
||||
cleanOut = true;
|
||||
out = updateDir(out);
|
||||
}
|
||||
|
||||
// Configure Build Options
|
||||
function toCmakeBool(val) {
|
||||
@ -150,9 +154,6 @@ if (architecture !== Architectures.Host) {
|
||||
} else {
|
||||
delete options['CMAKE_TOOLCHAIN_FILE'];
|
||||
}
|
||||
if (packageType === PackageTypes.AppImage) {
|
||||
options['CPACK_PACKAGE_DIRECTORY'] = out;
|
||||
}
|
||||
|
||||
// Make Build Directory
|
||||
function createDir(dir, clean) {
|
||||
@ -163,7 +164,7 @@ function createDir(dir, clean) {
|
||||
}
|
||||
createDir(build, clean);
|
||||
if (!install) {
|
||||
createDir(out, true);
|
||||
createDir(out, cleanOut);
|
||||
}
|
||||
|
||||
// Run CMake
|
||||
@ -193,4 +194,14 @@ if (packageType !== PackageTypes.AppImage) {
|
||||
run(['cmake', '--install', '.']);
|
||||
} else {
|
||||
run(['cmake', '--build', '.', '--target', 'package']);
|
||||
// Copy Generated Files
|
||||
const files = fs.readdirSync(build);
|
||||
for (const file of files) {
|
||||
if (file.includes('.AppImage')) {
|
||||
info('Copying: ' + file);
|
||||
const src = path.join(build, file);
|
||||
const dst = path.join(out, file);
|
||||
fs.copyFileSync(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,15 +27,4 @@ else
|
||||
export _MCPI_SKIP_ROOT_CHECK=1
|
||||
export HOME="$(pwd)/build/test"
|
||||
minecraft-pi-reborn-client --default --no-cache --benchmark
|
||||
|
||||
# Build Example Mods
|
||||
for project in example-mods/*/; do
|
||||
cd "${project}"
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -GNinja ..
|
||||
cmake --build .
|
||||
cd ../../../
|
||||
done
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user