Skip to content

Added editor mode to build pipeline #519

Added editor mode to build pipeline

Added editor mode to build pipeline #519

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build and Test
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events on master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "lint"
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bahmutov/npm-install@v1
with:
node-version: 16
- name: Test eslint
run: npm run lint
# This workflow contains a single job called "gametest"
gametest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bahmutov/npm-install@v1
with:
node-version: 16
- name: Run build script (server + gametest)
run: |
node build.mjs --target=server --gametest
echo "import { world } from '@minecraft/server'; world.afterEvents.worldLoad.subscribe(() => world.getDimension('overworld').runCommand('gametest runset worldedit'));" >> builds/WorldEditBP/scripts/index.js
- name: Download bedrock dedicated server
run: |
wget https://www.minecraft.net/bedrockdedicatedserver/bin-linux-preview/bedrock-server-1.21.120.25.zip -O bedrock-server.zip
unzip bedrock-server.zip -d bedrock-server
- name: Set up Bedrock server
run: |
chmod +x bedrock-server/bedrock_server
mkdir -p "bedrock-server/worlds/Bedrock level"
cp -r test/world/* "bedrock-server/worlds/Bedrock level/"
node tools/add_to_world.mjs --world-path="bedrock-server/worlds/Bedrock level"
- name: Run Server
run: |
cd bedrock-server
echo "Running Bedrock server..."
./bedrock_server >../server_output.log 2>&1 &
SERVER_PID=$!
sleep 10 # Let the server run for a bit
kill $SERVER_PID
if grep -q "onTestFailed" ../server_output.log || grep -q " ERROR]" ../server_output.log; then
echo "Error during gametest execution:"
cat ../server_output.log
exit 1
fi
# This workflow contains a single job called "build"
build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [debug, release]
steps:
- uses: actions/checkout@v3
- uses: montudor/action-zip@v1
- uses: bahmutov/npm-install@v1
with:
node-version: 16
- name: Run build script (${{ matrix.target }})
run: node build.mjs --target=${{ matrix.target }}
- name: Archive addon artifact (release)
uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'release'}}
with:
name: mcaddon-artifact-release
path: builds/WorldEdit.mcaddon
- name: Archive addon artifact (debug)
uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'debug'}}
with:
name: mcaddon-artifact-debug
path: |
builds/WorldEditBP
builds/WorldEditRP