Compare commits

...

2 Commits

Author SHA1 Message Date
930d0120f3 More CI Improvements
Some checks failed
CI / Build (AMD64, Server) (push) Successful in 9m46s
CI / Build (AMD64, Client) (push) Successful in 9m57s
CI / Build (ARM64, Client) (push) Successful in 10m0s
CI / Build (ARM64, Server) (push) Successful in 10m3s
CI / Build (ARMHF, Server) (push) Successful in 6m53s
CI / Build (ARMHF, Client) (push) Successful in 9m8s
CI / Test (Server) (push) Successful in 10m50s
CI / Test (Client) (push) Successful in 13m14s
CI / Release (push) Has been skipped
CI / Build Example Mods (push) Failing after 5m55s
2024-02-04 00:43:25 -05:00
31fcff13e9 CI Improvements 2024-02-04 00:36:58 -05:00
5 changed files with 87 additions and 28 deletions

View File

@ -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,40 @@ 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: |
cd example-mods
./build.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Example Mods
path: ./example-mods/out/*
if-no-files-found: error
# Create Release
release:
if: startsWith(github.ref, 'refs/tags/')
@ -87,7 +116,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)"

2
.gitignore vendored
View File

@ -12,3 +12,5 @@
/*.AppImage
/core*
/qemu_*
/example-mods/out
/.testing-tmp

25
example-mods/build.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
# Create Output Directory
ROOT="$(pwd)"
OUT="${ROOT}/out"
rm -rf "${OUT}"
mkdir -p "${OUT}"
# Build
build() {
cd "${ROOT}/$1"
# Build
rm -rf build
mkdir build
cd build
cmake -GNinja ..
cmake --build .
# Copy Result
cp lib*.so "${OUT}"
}
build chat-commands
build expanded-creative
build recipes

View File

@ -136,7 +136,11 @@ function updateDir(dir) {
return path.join(dir, variant.name, architecture.name);
}
build = updateDir(build);
out = updateDir(out);
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);
}
}
}

View File

@ -13,29 +13,21 @@ ARCH='host'
export PATH="$(pwd)/out/${MODE}/${ARCH}/usr/bin:${PATH}"
# Make Test Directory
rm -rf build/test
mkdir -p build/test
TEST_WORKING_DIR="$(pwd)/.testing-tmp"
rm -rf "${TEST_WORKING_DIR}"
mkdir -p "${TEST_WORKING_DIR}"
# Run
if [ "${MODE}" = "server" ]; then
# Server Test
cd build/test
cd "${TEST_WORKING_DIR}"
minecraft-pi-reborn-server --only-generate
cd ../../
else
# Client Test
export _MCPI_SKIP_ROOT_CHECK=1
export HOME="$(pwd)/build/test"
export HOME="${TEST_WORKING_DIR}"
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
# Clean Up
rm -rf "${TEST_WORKING_DIR}"