web/.forgejo/workflows/plugins.yml

81 lines
3 KiB
YAML

name: DuneRealms Plugin CI
on:
workflow_dispatch:
push:
branches: [main]
paths:
- '.forgejo/workflows/plugins.yml'
- 'Dune*/**'
- 'JarvisConnector/**'
- 'gui-common/**'
- 'network/proxy/central-pack/**'
jobs:
plugins:
runs-on: dune-ci
steps:
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '9.2.1'
- name: Test and build first-party plugins
shell: bash
run: |
set -euo pipefail
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneTerrain JarvisConnector)
if [[ -f network/proxy/central-pack/build.gradle.kts ]]; then
modules+=(network/proxy/central-pack)
fi
mkdir -p plugin-artifacts
for module in "${modules[@]}"; do
gradle --no-daemon -p "$module" test jar
for jar in "$module"/build/libs/*.jar; do
test -f "$jar"
artifact="plugin-artifacts/${jar##*/}"
test ! -e "$artifact"
cp "$jar" "$artifact"
done
done
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
(cd plugin-artifacts && sha256sum -- *.jar SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Plugins
path: plugin-artifacts/
if-no-files-found: error
- name: Test release installer failure recovery
shell: bash
run: |
set -euo pipefail
if ! python3 -c 'import yaml'; then
apt-get update
apt-get install -y --no-install-recommends python3-yaml
fi
python3 -m unittest discover -s tools -p test_dunemenus_installer.py -v
- name: Test and build the replacement DuneMenus plugin
shell: bash
run: |
set -euo pipefail
gradle --no-daemon -p DuneMenus test jar
mkdir -p dunemenus-artifacts
python3 tools/build-dunemenus-release.py dunemenus-artifacts
printf '%s\n' "$(git rev-parse HEAD)" > dunemenus-artifacts/SOURCE_COMMIT
(cd dunemenus-artifacts && sha256sum -- DuneMenus.jar DuneRealms-Network-Artwork-v7.zip SOURCE_COMMIT release.json > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: ${{ github.repository == 'dev/MC' && 'DuneMenus-Development' || 'DuneMenus' }}
path: dunemenus-artifacts/
if-no-files-found: error