Files
fheroes2/.github/workflows/make.yml
T

370 lines
13 KiB
YAML

name: Make
on:
workflow_call:
permissions:
contents: write
jobs:
make:
strategy:
matrix:
include:
- name: Linux x86-64 SDL2 Release
on: [ 'pull_request', 'push' ]
os: ubuntu-22.04
dependencies: libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
package_name: fheroes2_ubuntu_x86-64_SDL2.zip
package_files: >-
LICENSE
changelog.txt
fheroes2
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
maps/*.fh2m
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/linux/install_sdl2.sh
tools_package_name: fheroes2_tools_ubuntu_x86-64_SDL2.zip
tools_package_files: >-
LICENSE
./docs/GRAPHICAL_ASSETS.md
./script/agg/extract_agg.sh
./src/dist/tools/82m2wav
./src/dist/tools/bin2txt
./src/dist/tools/extractor
./src/dist/tools/h2dmgr
./src/dist/tools/icn2img
./src/dist/tools/pal2img
./src/dist/tools/til2img
./src/dist/tools/xmi2midi
release_name: Ubuntu x86-64 (Linux) build with SDL2 (latest commit)
release_tag: fheroes2-linux-sdl2_dev
- name: Linux x86-64 SDL2 Debug
on: [ 'pull_request' ]
os: ubuntu-latest
dependencies: libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
FHEROES2_WITH_DEBUG: ON
FHEROES2_WITH_ASAN: ON
- name: Linux ARM64 SDL2 Release
on: [ 'pull_request', 'push' ]
os: ubuntu-22.04-arm
dependencies: libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
package_name: fheroes2_ubuntu_arm64_SDL2.zip
package_files: >-
LICENSE
changelog.txt
fheroes2
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
maps/*.fh2m
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/linux/install_sdl2.sh
tools_package_name: fheroes2_tools_ubuntu_arm64_SDL2.zip
tools_package_files: >-
LICENSE
./docs/GRAPHICAL_ASSETS.md
./script/agg/extract_agg.sh
./src/dist/tools/82m2wav
./src/dist/tools/bin2txt
./src/dist/tools/extractor
./src/dist/tools/h2dmgr
./src/dist/tools/icn2img
./src/dist/tools/pal2img
./src/dist/tools/til2img
./src/dist/tools/xmi2midi
release_name: Ubuntu ARM64 (Linux) build with SDL2 (latest commit)
release_tag: fheroes2-linux-arm-sdl2_dev
- name: Linux ARM64 SDL2 Debug
on: [ 'pull_request' ]
os: ubuntu-24.04-arm
dependencies: libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
FHEROES2_WITH_DEBUG: ON
FHEROES2_WITH_TSAN: ON
- name: macOS SDL2
on: [ 'pull_request', 'push' ]
os: macos-13
dependencies: sdl2 sdl2_mixer sdl2_image
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
package_name: fheroes2_macos_x86-64_SDL2.zip
package_files: >-
LICENSE
changelog.txt
fheroes2
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
maps/*.fh2m
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/macos/Brewfile
tools_package_name: fheroes2_tools_macos_x86-64_SDL2.zip
tools_package_files: >-
LICENSE
./docs/GRAPHICAL_ASSETS.md
./script/agg/extract_agg.sh
./src/dist/tools/82m2wav
./src/dist/tools/bin2txt
./src/dist/tools/extractor
./src/dist/tools/h2dmgr
./src/dist/tools/icn2img
./src/dist/tools/pal2img
./src/dist/tools/til2img
./src/dist/tools/xmi2midi
release_name: macOS x86-64 build with SDL2 (latest commit)
release_tag: fheroes2-osx-sdl2_dev
- name: macOS SDL2 App Bundle
on: [ 'pull_request' ]
os: macos-latest
dependencies: sdl2 sdl2_mixer dylibbundler
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_MACOS_APP_BUNDLE: ON
name: Make (${{ matrix.name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
if: ${{ contains( matrix.on, github.event_name ) }}
- name: Install dependencies (Linux)
if: ${{ contains( matrix.on, github.event_name ) && startsWith( matrix.os, 'ubuntu-' ) }}
run: |
sudo apt-get -y update
sudo apt-get -y install ${{ matrix.dependencies }}
- name: Install dependencies (macOS)
if: ${{ contains( matrix.on, github.event_name ) && startsWith( matrix.os, 'macos-' ) }}
run: |
brew install ${{ matrix.dependencies }}
env:
# Do not update outdated dependencies of installed packages
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: ON
- name: Build (Linux)
if: ${{ contains( matrix.on, github.event_name ) && startsWith( matrix.os, 'ubuntu-' ) }}
run: |
make -j "$(nproc)"
env: ${{ matrix.env }}
- name: Build (MacOS)
if: ${{ contains( matrix.on, github.event_name ) && startsWith( matrix.os, 'macos-' ) }}
run: |
make -j "$(sysctl -n hw.logicalcpu)"
env: ${{ matrix.env }}
- name: Create packages
if: ${{ contains( matrix.on, github.event_name ) && matrix.package_name != '' && matrix.tools_package_name != '' }}
run: |
7z a -bb1 -tzip -- ${{ matrix.package_name }} ${{ matrix.package_files }}
7z a -bb1 -tzip -- ${{ matrix.tools_package_name }} ${{ matrix.tools_package_files }}
- uses: actions/upload-artifact@v4
if: ${{ contains( matrix.on, github.event_name ) && github.event_name == 'pull_request' && matrix.package_name != '' }}
with:
name: ${{ matrix.package_name }}
path: ${{ matrix.package_name }}
if-no-files-found: error
- uses: actions/upload-artifact@v4
if: ${{ contains( matrix.on, github.event_name ) && github.event_name == 'pull_request' && matrix.tools_package_name != '' }}
with:
name: ${{ matrix.tools_package_name }}
path: ${{ matrix.tools_package_name }}
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ contains( matrix.on, github.event_name ) && github.event_name == 'push' }}
with:
artifacts: ${{ matrix.package_name }}, ${{ matrix.tools_package_name }}
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.release_name }}
tag: ${{ matrix.release_tag }}
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true
make-psv:
name: Make (PS Vita)
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install libgcc1 gettext
- name: Prepare Vita SDK cache
uses: actions/cache@v4
with:
path: ~/.vitasdk-cache
key: make-vitasdk-cache-${{ github.sha }}
restore-keys: |
make-vitasdk-cache-
- name: Setup Vita SDK
continue-on-error: true
run: |
git clone --depth 1 https://github.com/vitasdk/vdpm
cd vdpm
export PATH=$VITASDK/bin:$PATH
./bootstrap-vitasdk.sh
./install-all.sh
rm -rf ~/.vitasdk-cache
env:
VITASDK: /usr/local/vitasdk
- name: Restore Vita SDK from cache
run: |
if [[ -d ~/.vitasdk-cache ]]; then
sudo rm -rf /usr/local/vitasdk
sudo mv ~/.vitasdk-cache /usr/local/vitasdk
fi
- name: Build
run: |
export PATH=$VITASDK/bin:$PATH
make -f Makefile.vita -j "$(nproc)"
env:
FHEROES2_STRICT_COMPILATION: ON
VITASDK: /usr/local/vitasdk
- name: Update Vita SDK cache
run: |
if [[ -d /usr/local/vitasdk ]]; then
rm -rf ~/.vitasdk-cache
sudo mv /usr/local/vitasdk ~/.vitasdk-cache
fi
- name: Create package
run: |
# Translations, H2D files and FH2M maps are already bundled into fheroes2.vpk
7z a -bb1 -tzip -- fheroes2_psv.zip LICENSE changelog.txt fheroes2.vpk ./docs/README.txt ./docs/README_PSV.md
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: fheroes2_psv.zip
path: fheroes2_psv.zip
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' }}
with:
artifacts: fheroes2_psv.zip
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: PS Vita build (latest commit)
tag: fheroes2-psv-sdl2_dev
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true
make-switch:
name: Make (Nintendo Switch)
runs-on: ubuntu-latest
container: devkitpro/devkita64:latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install gettext p7zip-full
- name: Build
run: |
export PATH=$DEVKITPRO/tools/bin:$DEVKITPRO/portlibs/switch/bin:$DEVKITPRO/devkitA64/bin:$PATH
make -f Makefile.switch -j "$(nproc)"
env:
FHEROES2_STRICT_COMPILATION: ON
DEVKITPRO: /opt/devkitpro
- name: Generate translations
run: |
make -C files/lang -j "$(nproc)"
- name: Create package
run: |
7z a -bb1 -tzip -- fheroes2_switch.zip LICENSE changelog.txt fheroes2.nro ./docs/README.txt ./docs/README_switch.md files/data/*.h2d files/lang/*.mo maps/*.fh2m
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: fheroes2_switch.zip
path: fheroes2_switch.zip
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' }}
with:
artifacts: fheroes2_switch.zip
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: Nintendo Switch build (latest commit)
tag: fheroes2-switch-sdl2_dev
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true
make-emscripten:
strategy:
matrix:
include:
- name: Emscripten
on: [ 'pull_request' ]
env:
FHEROES2_STRICT_COMPILATION: ON
package_name: fheroes2_emscripten.zip
- name: Emscripten Multithreaded
on: [ 'pull_request' ]
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_THREADS: ON
package_name: fheroes2_emscripten_mt.zip
name: Make (${{ matrix.name }})
runs-on: ubuntu-latest
container: emscripten/emsdk:latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
if: ${{ contains( matrix.on, github.event_name ) }}
- name: Install dependencies
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
sudo apt-get -y update
sudo apt-get -y install gettext p7zip-full
- name: Build
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
emmake make -f Makefile.emscripten -j "$(nproc)"
env: ${{ matrix.env }}
- name: Create package
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
# Translations, H2D files and FH2M maps are already bundled into fheroes2.data
7z a -bb1 -tzip -- ${{ matrix.package_name }} LICENSE changelog.txt fheroes2.data fheroes2.js fheroes2.wasm ./docs/README.txt ./files/emscripten/*
- uses: actions/upload-artifact@v4
if: ${{ contains( matrix.on, github.event_name ) }}
with:
name: ${{ matrix.package_name }}
path: ${{ matrix.package_name }}
if-no-files-found: error