CI Improvements
This commit is contained in:
parent
41fcc942fa
commit
31fcff13e9
@ -1,4 +1,4 @@
|
|||||||
name: 'Build'
|
name: 'CI'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -38,8 +38,9 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.mode }}-${{ matrix.arch }}
|
name: ${{ matrix.mode }} (${{ matrix.arch }})
|
||||||
path: ./out/**/*.AppImage*
|
path: ./out/*.AppImage*
|
||||||
|
if-no-files-found: error
|
||||||
# Test Project
|
# Test Project
|
||||||
test:
|
test:
|
||||||
strategy:
|
strategy:
|
||||||
@ -59,12 +60,38 @@ jobs:
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: ./scripts/install-dependencies.sh
|
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
|
# Test
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ./scripts/test.sh ${{ matrix.mode }}
|
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
|
# Create Release
|
||||||
release:
|
release:
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -87,7 +114,7 @@ jobs:
|
|||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: https://gitea.com/actions/release-action@main
|
uses: https://gitea.com/actions/release-action@main
|
||||||
with:
|
with:
|
||||||
files: ./out
|
files: ./out/*/*.AppImage*
|
||||||
api_key: ${{ secrets.RELEASE_TOKEN }}
|
api_key: ${{ secrets.RELEASE_TOKEN }}
|
||||||
title: v${{ github.ref_name }}
|
title: v${{ github.ref_name }}
|
||||||
body: "[View Changelog](https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/src/branch/master/docs/CHANGELOG.md)"
|
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);
|
return path.join(dir, variant.name, architecture.name);
|
||||||
}
|
}
|
||||||
build = updateDir(build);
|
build = updateDir(build);
|
||||||
out = updateDir(out);
|
let cleanOut = false;
|
||||||
|
if (packageType === PackageTypes.None) {
|
||||||
|
cleanOut = true;
|
||||||
|
out = updateDir(out);
|
||||||
|
}
|
||||||
|
|
||||||
// Configure Build Options
|
// Configure Build Options
|
||||||
function toCmakeBool(val) {
|
function toCmakeBool(val) {
|
||||||
@ -150,9 +154,6 @@ if (architecture !== Architectures.Host) {
|
|||||||
} else {
|
} else {
|
||||||
delete options['CMAKE_TOOLCHAIN_FILE'];
|
delete options['CMAKE_TOOLCHAIN_FILE'];
|
||||||
}
|
}
|
||||||
if (packageType === PackageTypes.AppImage) {
|
|
||||||
options['CPACK_PACKAGE_DIRECTORY'] = out;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make Build Directory
|
// Make Build Directory
|
||||||
function createDir(dir, clean) {
|
function createDir(dir, clean) {
|
||||||
@ -163,7 +164,7 @@ function createDir(dir, clean) {
|
|||||||
}
|
}
|
||||||
createDir(build, clean);
|
createDir(build, clean);
|
||||||
if (!install) {
|
if (!install) {
|
||||||
createDir(out, true);
|
createDir(out, cleanOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run CMake
|
// Run CMake
|
||||||
@ -193,4 +194,14 @@ if (packageType !== PackageTypes.AppImage) {
|
|||||||
run(['cmake', '--install', '.']);
|
run(['cmake', '--install', '.']);
|
||||||
} else {
|
} else {
|
||||||
run(['cmake', '--build', '.', '--target', 'package']);
|
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 _MCPI_SKIP_ROOT_CHECK=1
|
||||||
export HOME="$(pwd)/build/test"
|
export HOME="$(pwd)/build/test"
|
||||||
minecraft-pi-reborn-client --default --no-cache --benchmark
|
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
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user