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

386 lines
14 KiB
YAML

name: Make
on:
workflow_call:
permissions:
contents: write
jobs:
make:
strategy:
matrix:
config:
- name: Linux x86-64 SDL2 Release
os: ubuntu-20.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
./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
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
os: ubuntu-22.04
dependencies: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libsdl2-dev:arm64 libsdl2-mixer-dev:arm64 libsdl2-image-dev:arm64 libpng-dev:arm64 gettext
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
AR: aarch64-linux-gnu-ar
package_name: fheroes2_ubuntu_arm64_SDL2.zip
package_files: >-
LICENSE
changelog.txt
fheroes2
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
./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
os: ubuntu-22.04
dependencies: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libsdl2-dev:arm64 libsdl2-mixer-dev:arm64 libsdl2-image-dev:arm64 libpng-dev:arm64 gettext
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_TOOLS: ON
FHEROES2_WITH_IMAGE: ON
FHEROES2_WITH_DEBUG: ON
FHEROES2_WITH_TSAN: ON
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
AR: aarch64-linux-gnu-ar
- name: macOS SDL2
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
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/macos/install_sdl2.sh
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
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.config.name }})
runs-on: ${{ matrix.config.os }}
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: ${{ startsWith( matrix.config.os, 'ubuntu-' ) }}
run: |
if [[ "${{ matrix.config.name }}" == *ARM64* ]]
then
sudo sed -i -e 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
sudo dpkg --add-architecture arm64
sudo sh -c '. /etc/os-release;
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME} main restricted universe multiverse" > /etc/apt/sources.list.d/arm64.list;
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/arm64.list;
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-security main restricted universe multiverse" >> /etc/apt/sources.list.d/arm64.list;
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-backports main restricted universe multiverse" >> /etc/apt/sources.list.d/arm64.list;'
fi
sudo apt-get -y update
sudo apt-get -y install ${{ matrix.config.dependencies }}
- name: Install dependencies (macOS)
if: ${{ startsWith( matrix.config.os, 'macos-' ) }}
run: |
brew install ${{ matrix.config.dependencies }}
env:
# Do not update outdated dependencies of installed packages
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: ON
- name: Build (Linux)
if: ${{ startsWith( matrix.config.os, 'ubuntu-' ) }}
run: |
make -j "$(nproc)"
env: ${{ matrix.config.env }}
- name: Build (MacOS)
if: ${{ startsWith( matrix.config.os, 'macos-' ) }}
run: |
make -j "$(sysctl -n hw.logicalcpu)"
env: ${{ matrix.config.env }}
- name: Create package
if: ${{ matrix.config.package_name != '' && matrix.config.package_files != '' }}
run: |
7z a -bb1 -tzip -- ${{ matrix.config.package_name }} ${{ matrix.config.package_files }}
- name: Create tools package
if: ${{ matrix.config.tools_package_name != '' && matrix.config.tools_package_files != '' }}
run: |
7z a -bb1 -tzip -- ${{ matrix.config.tools_package_name }} ${{ matrix.config.tools_package_files }}
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' && matrix.config.package_name != '' }}
with:
name: ${{ matrix.config.package_name }}
path: ${{ matrix.config.package_name }}
if-no-files-found: error
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' && matrix.config.tools_package_name != '' }}
with:
name: ${{ matrix.config.tools_package_name }}
path: ${{ matrix.config.tools_package_name }}
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' && matrix.config.package_name != '' && matrix.config.tools_package_name == '' && matrix.config.release_name != '' && matrix.config.release_tag != '' }}
with:
artifacts: ${{ matrix.config.package_name }}
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.config.release_name }}
tag: ${{ matrix.config.release_tag }}
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' && matrix.config.package_name != '' && matrix.config.tools_package_name != '' && matrix.config.release_name != '' && matrix.config.release_tag != '' }}
with:
artifacts: ${{ matrix.config.package_name }}, ${{ matrix.config.tools_package_name }}
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.config.release_name }}
tag: ${{ matrix.config.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 and H2D files are already included in 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
- 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:
name: Make (Emscripten)
runs-on: ubuntu-latest
container: emscripten/emsdk:3.1.74
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: |
emmake make -f Makefile.emscripten -j "$(nproc)"
env:
FHEROES2_STRICT_COMPILATION: ON
- name: Create package
run: |
# Translations and H2D files are already included in fheroes2.data
7z a -bb1 -tzip -- fheroes2_emscripten.zip LICENSE changelog.txt fheroes2.data fheroes2.js fheroes2.wasm ./docs/README.txt ./files/emscripten/*
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: fheroes2_emscripten.zip
path: fheroes2_emscripten.zip
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' }}
with:
artifacts: fheroes2_emscripten.zip
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: Emscripten build (latest commit)
tag: fheroes2-emscripten-sdl2_dev
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true