Skip to content

Build WotW Rando

Build WotW Rando #783

Workflow file for this run

name: Build WotW Rando
on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_version:
description: 'Release version (leave empty to build only)'
required: false
default: ''
client_branch:
description: 'Client branch'
required: true
default: 'main'
ui_branch:
description: 'UI branch'
required: true
default: 'main'
seedgen_branch:
description: 'Seedgen branch'
required: true
default: 'main'
seedgen_c_interop_branch:
description: 'Seedgen C interop branch'
required: true
default: 'main'
jobs:
build_randomizer:
runs-on: windows-2022
env:
SCCACHE_GHA_ENABLED: "true"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Load CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.0
- name: Enable Git support for long file paths
run: git config --system core.longpaths true
- name: Set up directories
run: |
md -Path 'C:\\moon\\randomizer'
- name: Clone ori-community/wotw-rando-client
run: |
git clone --branch ${{ github.event.inputs.client_branch || 'dev' }} --depth 1 https://github.com/ori-community/wotw-rando-client.git
cd wotw-rando-client
git rev-parse HEAD > C:\moon\randomizer\client.revision
- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: 14.39 # Workaround for https://github.com/actions/runner-images/issues/9086
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Update vcpkg repository
shell: cmd
run: |
cd /d C:\vcpkg
git pull
- name: Generate CMake project
shell: cmd
working-directory: wotw-rando-client
run: "generate-cmake.release-ninja.bat"
- name: Compile Wotw Rando
shell: cmd
working-directory: wotw-rando-client
run: |
cmake --build cmake-build-relwithdebinfo --target INSTALL_RUNTIME --config RelWithDebInfo
IF ERRORLEVEL 1 (
echo BUILD FAILED
exit 1
)
- name: Write version file
shell: bash
run: |
echo Writing version file...
(if [[ -n "${{ github.event.inputs.release_version }}" ]]; then echo -n "${{ github.event.inputs.release_version }}"; else echo -n "develop"; fi) > VERSION
cp -f VERSION /c/moon/randomizer/VERSION
- name: Write Run ID
shell: bash
run: |
echo -n "${{ github.run_id }}" > /c/moon/randomizer/run_id
- name: Copy modloader_config.json
shell: cmd
working-directory: wotw-rando-client
run: |
copy resources\modloader_config.json C:\moon\randomizer\modloader_config.json
- name: Clone ori-community/wotw-rando-assets
run: |
git clone --depth 1 https://github.com/ori-community/wotw-rando-assets.git C:\moon\randomizer\assets
git -C C:\moon\randomizer\assets rev-parse HEAD > C:\moon\randomizer\assets.revision
git -C C:\moon\randomizer\assets lfs checkout
Remove-Item -Path C:\moon\randomizer\assets\.git -Force -Recurse
- name: Archive randomizer
uses: actions/upload-artifact@v3
with:
name: randomizer
path: |
C:\moon\randomizer\**\*
!C:\moon\randomizer\*.pdb
retention-days: 1
- name: Archive PDBs
uses: actions/upload-artifact@v3
with:
name: pdb
path: |
C:\moon\randomizer\*.pdb
build_seedgen:
runs-on: windows-2022
steps:
- name: Set up directories
run: "md -Path 'C:\\seedgen'"
- name: Clone ori-community/wotw-seedgen
run: |
git clone --branch ${{ github.event.inputs.seedgen_branch || 'dev' }} --depth 1 https://github.com/ori-community/wotw-seedgen.git .
git rev-parse HEAD > C:\seedgen\seedgen.revision
- name: Install Rust (Stable)
run:
curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Build seedgen
run: |
cargo build --release
- name: Copy artifacts
shell: powershell
run: |
echo Copying seedgen.exe
Copy-Item -Path ".\target\release\seedgen.exe" -Destination "C:\seedgen\seedgen.exe"
echo Copying headers and presets
Copy-Item -Path wotw_seedgen\headers -Recurse -Destination C:\seedgen\headers\
Copy-Item -Path wotw_seedgen\world_presets -Recurse -Destination C:\seedgen\world_presets\
echo Copying wotw_seedgen\loc_data.csv
Copy-Item -Path wotw_seedgen\loc_data.csv -Destination "C:\seedgen\loc_data.csv"
echo Copying wotw_seedgen\state_data.csv
Copy-Item -Path wotw_seedgen\state_data.csv -Destination "C:\seedgen\state_data.csv"
echo Copying wotw_seedgen\areas.wotw
Copy-Item -Path wotw_seedgen\areas.wotw -Destination "C:\seedgen\areas.wotw"
- name: Archive seedgen
uses: actions/upload-artifact@v3
with:
name: seedgen
path: 'C:\seedgen\**\*'
retention-days: 1
build_seedgen_c_interop:
runs-on: windows-2022
steps:
- name: Set up directories
run: "md -Path 'C:\\seedgen_c_interop'"
- name: Clone ori-community/wotw-seedgen-c-interop
run: |
git clone --branch ${{ github.event.inputs.seedgen_c_interop_branch || 'dev' }} --depth 1 https://github.com/ori-community/wotw-seedgen-c-interop.git .
git rev-parse HEAD > C:\seedgen_c_interop\seedgen-c-interop.revision
- name: Install Rust (Stable)
run:
curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Build seedgen C interop
run: |
cargo build --release
- name: Copy artifacts
shell: powershell
run: |
echo Copying seedgen_interop.dll
Copy-Item -Path ".\target\release\wotw_seedgen_c_interop.dll" -Destination "C:\seedgen_c_interop\seedgen_interop.dll"
- name: Archive seedgen
uses: actions/upload-artifact@v3
with:
name: seedgen_c_interop
path: 'C:\seedgen_c_interop\**\*'
retention-days: 1
build_launcher_windows:
runs-on: windows-2022
steps:
- name: Clone ori-community/rando-ui
run: |
git clone --branch ${{ github.event.inputs.ui_branch || 'dev' }} --depth 1 https://github.com/ori-community/rando-ui .
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install dependencies 👨🏻‍💻
run: yarn install --network-timeout 100000
- name: Generate client
run: |
$env:API_SECURE = "true"
$env:IS_ELECTRON = "true"
$env:PLATFORM = "win32"
yarn run generate
Copy-item -Force -Recurse -Verbose ".\dist\*" -Destination ".\electron\public\"
- name: Build electron
working-directory: .\\electron
run: |
yarn install --network-timeout 100000
yarn run electron:build -- -w
- name: Write Git revision
run: |
md -Path '.\electron\dist_electron\win-unpacked\randomizer'
git rev-parse HEAD > .\electron\dist_electron\win-unpacked\randomizer\launcher.revision
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: launcher_windows
retention-days: 1
path: |
.\electron\dist_electron\win-unpacked\*
build_launcher_linux:
runs-on: ubuntu-latest
steps:
- name: Clone ori-community/rando-ui
run: |
git clone --branch ${{ github.event.inputs.ui_branch || 'dev' }} --depth 1 https://github.com/ori-community/rando-ui .
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install dependencies 👨🏻‍💻
run: yarn install --network-timeout 100000
- name: Generate client
run: |
export API_SECURE="true"
export IS_ELECTRON="true"
export PLATFORM="linux"
yarn run generate
cp -vr ./dist/* ./electron/public/
- name: Build electron
working-directory: ./electron
run: |
yarn install --network-timeout 100000
yarn run electron:build -l
cp -vrp ./external/* ./dist_electron/linux-unpacked/
- name: Write Git revision
run: |
mkdir -p ./electron/dist_electron/linux-unpacked/randomizer
git rev-parse HEAD > ./electron/dist_electron/linux-unpacked/randomizer/launcher.revision
- name: Archive artifacts
run: |
cd ./electron/dist_electron/linux-unpacked/
tar -cvf /tmp/launcher_linux.tar *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: launcher_linux
retention-days: 1
path: |
/tmp/launcher_linux.tar
render_credits:
runs-on: ubuntu-latest
steps:
- name: Clone ori-community/wotw-rando-credits
run: |
git clone --depth 1 https://github.com/ori-community/wotw-rando-credits .
git rev-parse HEAD > credits.revision
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies 👨🏻‍💻
run: npm ci
- name: Render credits
run: npm run generate
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: credits
retention-days: 1
path: |
./credits
./credits.revision
build_installer:
runs-on: windows-2022
needs: [build_randomizer, build_seedgen, build_seedgen_c_interop, build_launcher_windows, render_credits]
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install Inno setup
run: |
Invoke-WebRequest -Uri "https://jrsoftware.org/download.php/is.exe" -OutFile innosetup.exe
if ((Get-FileHash innosetup.exe).Hash -eq "8117D10D00A2AD33A1390978EA3872861C330E087914410A6377B22C4C5B8563") {
Start-Process .\innosetup.exe -ArgumentList "/VERYSILENT /LOG=innosetup.log" -NoNewWindow -Wait
Get-Content innosetup.log
} else {
echo "Inno Setup hash verification failed"
exit 1
}
- name: Set up directories
run: "md -Path 'C:\\moon\\randomizer'"
- name: Download launcher
uses: actions/download-artifact@v3
with:
name: launcher_windows
path: "C:\\moon\\"
- name: Download randomizer
uses: actions/download-artifact@v3
with:
name: randomizer
path: "C:\\moon\\randomizer\\"
- name: Download seedgen
uses: actions/download-artifact@v3
with:
name: seedgen
path: "C:\\moon\\randomizer\\"
- name: Download seedgen_c_interop
uses: actions/download-artifact@v3
with:
name: seedgen_c_interop
path: "C:\\moon\\randomizer\\"
- name: Download credits
uses: actions/download-artifact@v3
with:
name: credits
path: "C:\\moon\\randomizer\\"
- name: Build installer
run: |
$env:APP_VERSION = "${{ github.event.inputs.release_version || 'dev' }}"
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /O"output" /F"WotwRandoSetup" setup.iss
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: installer
retention-days: 7
path: |
.\output\WotwRandoSetup.exe
build_linux_package:
runs-on: ubuntu-latest
needs: [build_randomizer, build_seedgen, build_seedgen_c_interop, build_launcher_linux, render_credits]
steps:
- name: Set up directories
run: "mkdir -p /tmp/moon"
- name: Download launcher
uses: actions/download-artifact@v3
with:
name: launcher_linux
path: "/tmp/"
- name: Extract launcher
run: |
tar -xvf /tmp/launcher_linux.tar -C /tmp/moon
- name: Download randomizer
uses: actions/download-artifact@v3
with:
name: randomizer
path: "/tmp/moon/randomizer/"
- name: Download seedgen
uses: actions/download-artifact@v3
with:
name: seedgen
path: "/tmp/moon/randomizer/"
- name: Download seedgen_c_interop
uses: actions/download-artifact@v3
with:
name: seedgen_c_interop
path: "/tmp/moon/randomizer/"
- name: Download credits
uses: actions/download-artifact@v3
with:
name: credits
path: "/tmp/moon/randomizer/"
- name: Build package
run: |
cd /tmp/moon
tar -zcvf /tmp/WotwRando.tar.gz *
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: linux_package
retention-days: 7
path: |
/tmp/WotwRando.tar.gz
create_release:
runs-on: ubuntu-latest
needs: [build_installer, build_linux_package]
steps:
- name: Set up directories
run: "mkdir -p /tmp/release"
- name: Download Installer
uses: actions/download-artifact@v3
with:
name: installer
path: "/tmp/release/"
- name: Download Linux package
uses: actions/download-artifact@v3
with:
name: linux_package
path: "/tmp/release/"
- name: Create draft release
if: ${{ github.event.inputs.release_version != '' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.event.inputs.release_version }}
release_name: ${{ github.event.inputs.release_version }}
body: TODO
draft: true
prerelease: false
- name: Release WotwRandoSetup.exe
if: ${{ github.event.inputs.release_version != '' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: '/tmp/release/WotwRandoSetup.exe'
asset_name: WotwRandoSetup.exe
asset_content_type: application/octet-stream
- name: Release WotwRando.tar.gz
if: ${{ github.event.inputs.release_version != '' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: '/tmp/release/WotwRando.tar.gz'
asset_name: WotwRando.tar.gz
asset_content_type: application/octet-stream