Try Fancy CI
This commit is contained in:
parent
71b11b314b
commit
73b51be43f
@ -9,39 +9,83 @@ on:
|
|||||||
- '!flatpak'
|
- '!flatpak'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
# Build Project
|
||||||
build:
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
mode:
|
||||||
|
- Client
|
||||||
|
- Server
|
||||||
|
arch:
|
||||||
|
- AMD64
|
||||||
|
- ARM64
|
||||||
|
- ARMHF
|
||||||
|
name: ${{ matrix.mode }} (${{ matrix.arch }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node:16-buster
|
container: node:16-buster
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
# Dependencies
|
# Dependencies
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '>=1.20.1'
|
|
||||||
- name: Install CMake
|
- name: Install CMake
|
||||||
run: |
|
run: |
|
||||||
echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list
|
echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install --no-install-recommends -y -t buster-backports cmake
|
apt-get install --no-install-recommends -y -t buster-backports cmake
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: ./scripts/install-dependencies.sh amd64 armhf arm64
|
run: ./scripts/install-dependencies.sh ${{ matrix.arch }}
|
||||||
# Build
|
# Build
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./scripts/package-all.sh
|
run: ./scripts/package.sh ${{ matrix.mode }} ${{ matrix.arch }}
|
||||||
- name: Test
|
|
||||||
run: ./scripts/test.sh
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
name: ${{ matrix.mode }}-${{ matrix.arch }}
|
||||||
path: ./out/*.AppImage*
|
path: ./out/*.AppImage*
|
||||||
|
# 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
|
# Create Release
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: https://gitea.com/actions/release-action@main
|
uses: https://gitea.com/actions/release-action@main
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
with:
|
||||||
files: ./out/*.AppImage*
|
files: ./out/*.AppImage*
|
||||||
api_key: ${{ secrets.RELEASE_TOKEN }}
|
api_key: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
@ -34,8 +34,8 @@ build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
MODE="$1"
|
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
||||||
ARCH="$2"
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
||||||
shift 2
|
shift 2
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
@ -82,7 +82,7 @@ run() {
|
|||||||
libglib2.0-dev:$1
|
libglib2.0-dev:$1
|
||||||
}
|
}
|
||||||
for arch in "$@"; do
|
for arch in "$@"; do
|
||||||
architecture_specific_pkg "${arch}"
|
architecture_specific_pkg "$(echo "${arch}" | tr '[:upper:]' '[:lower:]')"
|
||||||
done
|
done
|
||||||
|
|
||||||
# AppStream Verification
|
# AppStream Verification
|
||||||
|
@ -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
|
|
@ -4,37 +4,39 @@ set -e
|
|||||||
|
|
||||||
# Prepare
|
# Prepare
|
||||||
NAME='minecraft-pi-reborn'
|
NAME='minecraft-pi-reborn'
|
||||||
|
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
./scripts/setup.sh "$1" "$2" -DMCPI_IS_APPIMAGE_BUILD=ON
|
./scripts/setup.sh "${MODE}" "${ARCH}" -DMCPI_IS_APPIMAGE_BUILD=ON
|
||||||
./scripts/build.sh "$1" "$2"
|
./scripts/build.sh "${MODE}" "${ARCH}"
|
||||||
|
|
||||||
# Download Runtime
|
# Download Runtime
|
||||||
mkdir -p build/appimage
|
mkdir -p build/appimage
|
||||||
if [ ! -f "build/appimage/runtime-$2" ]; then
|
if [ ! -f "build/appimage/runtime-${ARCH}" ]; then
|
||||||
case "$2" in
|
case "${ARCH}" in
|
||||||
'armhf') RUNTIME_ARCH='armhf';;
|
'armhf') RUNTIME_ARCH='armhf';;
|
||||||
'arm64') RUNTIME_ARCH='aarch64';;
|
'arm64') RUNTIME_ARCH='aarch64';;
|
||||||
'i386') RUNTIME_ARCH='i686';;
|
'i386') RUNTIME_ARCH='i686';;
|
||||||
'amd64') RUNTIME_ARCH='x86_64';;
|
'amd64') RUNTIME_ARCH='x86_64';;
|
||||||
esac
|
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
|
fi
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
case "$2" in
|
case "${ARCH}" in
|
||||||
'armhf') APPIMAGE_ARCH='arm';;
|
'armhf') APPIMAGE_ARCH='arm';;
|
||||||
'arm64') APPIMAGE_ARCH='arm_aarch64';;
|
'arm64') APPIMAGE_ARCH='arm_aarch64';;
|
||||||
'i386') APPIMAGE_ARCH='i686';;
|
'i386') APPIMAGE_ARCH='i686';;
|
||||||
'amd64') APPIMAGE_ARCH='x86_64';;
|
'amd64') APPIMAGE_ARCH='x86_64';;
|
||||||
esac
|
esac
|
||||||
ARCH="${APPIMAGE_ARCH}" appimagetool \
|
ARCH="${APPIMAGE_ARCH}" appimagetool \
|
||||||
--updateinformation "zsync|https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/releases/download/latest/${NAME}-latest-$2.AppImage.zsync" \
|
--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-$2" \
|
--runtime-file "build/appimage/runtime-${ARCH}" \
|
||||||
--comp xz \
|
--comp xz \
|
||||||
"./out/$1-$2" \
|
"./out/${MODE}-${ARCH}" \
|
||||||
"./out/${NAME}-$1-$(cat VERSION)-$2.AppImage"
|
"./out/${NAME}-${MODE}-$(cat VERSION)-${ARCH}.AppImage"
|
||||||
|
|
||||||
# Move ZSync
|
# Move ZSync
|
||||||
rm -f "./out/${NAME}-$1-latest-$2.AppImage.zsync"
|
rm -f "./out/${NAME}-${MODE}-latest-${ARCH}.AppImage.zsync"
|
||||||
mv "./${NAME}-$1-$(cat VERSION)-$2.AppImage.zsync" "./out/${NAME}-$1-latest-$2.AppImage.zsync"
|
mv "./${NAME}-${MODE}-$(cat VERSION)-${ARCH}.AppImage.zsync" "./out/${NAME}-${MODE}-latest-${ARCH}.AppImage.zsync"
|
||||||
|
@ -8,7 +8,7 @@ ARM_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain/armhf-toolchain.cmake"
|
|||||||
# Setup
|
# Setup
|
||||||
setup() {
|
setup() {
|
||||||
# Find Toolchain
|
# Find Toolchain
|
||||||
local toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake"
|
toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake"
|
||||||
if [ ! -f "${toolchain_file}" ]; then
|
if [ ! -f "${toolchain_file}" ]; then
|
||||||
echo "Invalid Architecture: ${ARCH}" > /dev/stderr
|
echo "Invalid Architecture: ${ARCH}" > /dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
@ -20,27 +20,28 @@ setup() {
|
|||||||
cd "build/${MODE}-${ARCH}"
|
cd "build/${MODE}-${ARCH}"
|
||||||
|
|
||||||
# Server Build
|
# Server Build
|
||||||
local server_mode='OFF'
|
server_mode='OFF'
|
||||||
if [ "${MODE}" = "server" ]; then
|
if [ "${MODE}" = "server" ]; then
|
||||||
server_mode='ON'
|
server_mode='ON'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mixed Build
|
# Mixed Build
|
||||||
local mixed_build='ON'
|
mixed_build='ON'
|
||||||
if [ "${ARCH}" = "armhf" ]; then
|
if [ "${ARCH}" = "armhf" ]; then
|
||||||
mixed_build='OFF'
|
mixed_build='OFF'
|
||||||
fi
|
fi
|
||||||
|
# Extra Flags
|
||||||
|
extra_flags="-DMCPI_IS_MIXED_BUILD=${mixed_build} -DMCPI_SERVER_MODE=${server_mode}"
|
||||||
|
|
||||||
# Build ARM Components
|
# Build ARM Components
|
||||||
mkdir arm
|
mkdir arm
|
||||||
cd 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 ../
|
cd ../
|
||||||
|
|
||||||
# Build Native Components
|
# Build Native Components
|
||||||
mkdir native
|
mkdir native
|
||||||
cd 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 ../
|
cd ../
|
||||||
|
|
||||||
# Exit
|
# Exit
|
||||||
@ -48,8 +49,8 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
MODE="$1"
|
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
||||||
ARCH="$2"
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
||||||
shift 2
|
shift 2
|
||||||
|
|
||||||
# Verify Mode
|
# Verify Mode
|
||||||
|
Loading…
Reference in New Issue
Block a user