Try Fancy CI

This commit is contained in:
TheBrokenRail 2023-11-24 18:37:08 -05:00
parent 71b11b314b
commit 73b51be43f
6 changed files with 83 additions and 50 deletions

View File

@ -9,39 +9,83 @@ on:
- '!flatpak'
jobs:
# Build Project
build:
strategy:
fail-fast: false
matrix:
mode:
- Client
- Server
arch:
- AMD64
- ARM64
- ARMHF
name: ${{ matrix.mode }} (${{ matrix.arch }})
runs-on: ubuntu-latest
container: node:16-buster
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
# Dependencies
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
# Dependencies
- name: Install CMake
run: |
echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get install --no-install-recommends -y -t buster-backports cmake
- name: Install Dependencies
run: ./scripts/install-dependencies.sh amd64 armhf arm64
# Build
run: ./scripts/install-dependencies.sh ${{ matrix.arch }}
# Build
- name: Build
run: ./scripts/package-all.sh
- name: Test
run: ./scripts/test.sh
run: ./scripts/package.sh ${{ matrix.mode }} ${{ matrix.arch }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.mode }}-${{ matrix.arch }}
path: ./out/*.AppImage*
# Create Release
# Test Project
test:
name: Test
runs-on: ubuntu-latest
container: node:16-buster
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true
# Dependencies
- name: Install CMake
run: |
echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get install --no-install-recommends -y -t buster-backports cmake
- name: Install Dependencies
run: ./scripts/install-dependencies.sh
# Test
- name: Test
run: ./scripts/test.sh
# Create Release
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
name: Release
runs-on: ubuntu-latest
container: node:16-buster
steps:
# Dependencies
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
# Download Artifacts
- uses: actions/download-artifact@v3
with:
path: out
# Create Release
- name: Create Release
uses: https://gitea.com/actions/release-action@main
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./out/*.AppImage*
api_key: ${{ secrets.RELEASE_TOKEN }}

View File

@ -34,8 +34,8 @@ build() {
}
# Variables
MODE="$1"
ARCH="$2"
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
shift 2
# Build

View File

@ -82,7 +82,7 @@ run() {
libglib2.0-dev:$1
}
for arch in "$@"; do
architecture_specific_pkg "${arch}"
architecture_specific_pkg "$(echo "${arch}" | tr '[:upper:]' '[:lower:]')"
done
# AppStream Verification

View File

@ -1,14 +0,0 @@
#!/bin/sh
set -e
# Clean Prefix
rm -rf out
# Build
./scripts/package.sh client amd64
./scripts/package.sh server amd64
./scripts/package.sh client arm64
./scripts/package.sh server arm64
./scripts/package.sh client armhf
./scripts/package.sh server armhf

View File

@ -4,37 +4,39 @@ set -e
# Prepare
NAME='minecraft-pi-reborn'
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
# Build
./scripts/setup.sh "$1" "$2" -DMCPI_IS_APPIMAGE_BUILD=ON
./scripts/build.sh "$1" "$2"
./scripts/setup.sh "${MODE}" "${ARCH}" -DMCPI_IS_APPIMAGE_BUILD=ON
./scripts/build.sh "${MODE}" "${ARCH}"
# Download Runtime
mkdir -p build/appimage
if [ ! -f "build/appimage/runtime-$2" ]; then
case "$2" in
if [ ! -f "build/appimage/runtime-${ARCH}" ]; then
case "${ARCH}" in
'armhf') RUNTIME_ARCH='armhf';;
'arm64') RUNTIME_ARCH='aarch64';;
'i386') RUNTIME_ARCH='i686';;
'amd64') RUNTIME_ARCH='x86_64';;
esac
wget -O "build/appimage/runtime-$2" "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-${RUNTIME_ARCH}"
wget -O "build/appimage/runtime-${ARCH}" "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-${RUNTIME_ARCH}"
fi
# Package
case "$2" in
case "${ARCH}" in
'armhf') APPIMAGE_ARCH='arm';;
'arm64') APPIMAGE_ARCH='arm_aarch64';;
'i386') APPIMAGE_ARCH='i686';;
'amd64') APPIMAGE_ARCH='x86_64';;
esac
ARCH="${APPIMAGE_ARCH}" appimagetool \
--updateinformation "zsync|https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/releases/download/latest/${NAME}-latest-$2.AppImage.zsync" \
--runtime-file "build/appimage/runtime-$2" \
--updateinformation "zsync|https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/releases/download/latest/${NAME}-latest-${ARCH}.AppImage.zsync" \
--runtime-file "build/appimage/runtime-${ARCH}" \
--comp xz \
"./out/$1-$2" \
"./out/${NAME}-$1-$(cat VERSION)-$2.AppImage"
"./out/${MODE}-${ARCH}" \
"./out/${NAME}-${MODE}-$(cat VERSION)-${ARCH}.AppImage"
# Move ZSync
rm -f "./out/${NAME}-$1-latest-$2.AppImage.zsync"
mv "./${NAME}-$1-$(cat VERSION)-$2.AppImage.zsync" "./out/${NAME}-$1-latest-$2.AppImage.zsync"
rm -f "./out/${NAME}-${MODE}-latest-${ARCH}.AppImage.zsync"
mv "./${NAME}-${MODE}-$(cat VERSION)-${ARCH}.AppImage.zsync" "./out/${NAME}-${MODE}-latest-${ARCH}.AppImage.zsync"

View File

@ -8,7 +8,7 @@ ARM_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain/armhf-toolchain.cmake"
# Setup
setup() {
# Find Toolchain
local toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake"
toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake"
if [ ! -f "${toolchain_file}" ]; then
echo "Invalid Architecture: ${ARCH}" > /dev/stderr
exit 1
@ -20,27 +20,28 @@ setup() {
cd "build/${MODE}-${ARCH}"
# Server Build
local server_mode='OFF'
server_mode='OFF'
if [ "${MODE}" = "server" ]; then
server_mode='ON'
fi
# Mixed Build
local mixed_build='ON'
mixed_build='ON'
if [ "${ARCH}" = "armhf" ]; then
mixed_build='OFF'
fi
# Extra Flags
extra_flags="-DMCPI_IS_MIXED_BUILD=${mixed_build} -DMCPI_SERVER_MODE=${server_mode}"
# Build ARM Components
mkdir arm
cd arm
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="${ARM_TOOLCHAIN_FILE}" -DMCPI_BUILD_MODE=arm -DMCPI_IS_MIXED_BUILD="${mixed_build}" -DMCPI_SERVER_MODE="${server_mode}" "$@" ../../..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="${ARM_TOOLCHAIN_FILE}" -DMCPI_BUILD_MODE=arm ${extra_flags} "$@" ../../..
cd ../
# Build Native Components
mkdir native
cd native
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DMCPI_BUILD_MODE=native -DMCPI_IS_MIXED_BUILD="${mixed_build}" -DMCPI_SERVER_MODE="${server_mode}" "$@" ../../..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DMCPI_BUILD_MODE=native ${extra_flags} "$@" ../../..
cd ../
# Exit
@ -48,8 +49,8 @@ setup() {
}
# Variables
MODE="$1"
ARCH="$2"
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
shift 2
# Verify Mode