Skip to content

Fix: Setting per pixel lighting from graphics menu #86

Fix: Setting per pixel lighting from graphics menu

Fix: Setting per pixel lighting from graphics menu #86

Workflow file for this run

name: Emscripten
on:
push:
branches-ignore:
- 'l10n_**' # Push events to translation service branches (that begin with "l10n_")
pull_request:
# Match all pull requests...
paths-ignore:
# Except some text-only files / documentation
- 'ChangeLog'
# Except those that only include changes to stats
- 'data/base/stats/**'
- 'data/mp/stats/**'
- 'data/mp/multiplay/script/functions/camTechEnabler.js'
# Support running after "Draft Tag Release" workflow completes, as part of automated release process
workflow_run:
workflows: ["Draft Tag Release"]
push:
tags:
- '*'
types:
- completed
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
EMSDK_VERSION: 3.1.53
CMAKE_BUILD_PARALLEL_LEVEL: 4 # See: https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/
jobs:
web-build:
strategy:
matrix:
include:
- arch: "wasm32"
upload_artifact: true
fail-fast: false
name: '${{ matrix.arch }}'
permissions:
contents: read
runs-on: ubuntu-latest
env:
WZ_WASM_ARCH: '${{ matrix.arch }}'
if: "!contains(github.event.head_commit.message, '[ci skip]')"
outputs:
# Needed by the release + other later jobs - despite this being a matrix job, this should be the same for all, so we can allow whatever is last to persist it
WZ_GITHUB_REF: ${{ steps.checkout-config.outputs.WZ_GITHUB_REF }}
WZ_GITHUB_SHA: ${{ steps.checkout-config.outputs.WZ_GITHUB_SHA }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: 'src'
- name: Configure Repo Checkout
id: checkout-config
working-directory: ./src
env:
WORKFLOW_RUN_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
. .ci/githubactions/checkout_config.sh
- name: Prepare Git Repo for autorevision
working-directory: '${{ github.workspace }}/src'
run: cmake -P .ci/githubactions/prepare_git_repo.cmake
- name: Init Git Submodules
working-directory: '${{ github.workspace }}/src'
run: git submodule update --init --recursive
- name: Prep Directories
run: |
mkdir -p "${{ github.workspace }}/build"
mkdir -p "${{ github.workspace }}/installed"
mkdir -p "${{ github.workspace }}/output"
- name: Compute build variables
run: |
WZ_DISTRIBUTOR="UNKNOWN"
if [ "${GITHUB_REPOSITORY}" == "Warzone2100/warzone2100" ]; then
WZ_DISTRIBUTOR="wz2100.net"
fi
echo "WZ_DISTRIBUTOR=${WZ_DISTRIBUTOR}"
echo "WZ_DISTRIBUTOR=${WZ_DISTRIBUTOR}" >> $GITHUB_ENV
WZ_BUILD_DESC="web_${WZ_WASM_ARCH}"
echo "WZ_BUILD_DESC=${WZ_BUILD_DESC}"
echo "WZ_BUILD_DESC=${WZ_BUILD_DESC}" >> $GITHUB_ENV
- name: Prep Build Environment
run: |
# Install additional host tools
sudo apt-get -u update
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cmake git zip unzip gettext asciidoctor
- uses: actions/setup-node@v4
- name: Install workbox-cli
run: npm install workbox-cli --global
- name: Install EMSDK
id: emsdk
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
# Download and install the latest SDK tools
./emsdk install ${EMSDK_VERSION}
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate ${EMSDK_VERSION}
# Output full path to activation script
echo "CI_EMSDK_ENV_SCRIPT_PATH=$(pwd)/emsdk_env.sh" >> $GITHUB_OUTPUT
echo "CI_EMSDK_ENV_SCRIPT_PATH=$(pwd)/emsdk_env.sh" >> $GITHUB_ENV
- name: CMake Configure
working-directory: '${{ github.workspace }}/build'
env:
WZ_INSTALL_DIR: '${{ github.workspace }}/installed'
run: |
# Setup vcpkg in build dir
git clone https://github.com/microsoft/vcpkg.git vcpkg
# CMake Configure
source "${CI_EMSDK_ENV_SCRIPT_PATH}"
echo "::add-matcher::${GITHUB_WORKSPACE}/src/.ci/githubactions/pattern_matchers/cmake.json"
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DWZ_ENABLE_WARNINGS:BOOL=ON -DWZ_DISTRIBUTOR:STRING="${WZ_DISTRIBUTOR}" "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=${WZ_WASM_ARCH}-emscripten" "-DCMAKE_INSTALL_PREFIX:PATH=${WZ_INSTALL_DIR}" "${{ github.workspace }}/src"
echo "::remove-matcher owner=cmake::"
- name: CMake Build
working-directory: '${{ github.workspace }}/build'
run: |
source "${CI_EMSDK_ENV_SCRIPT_PATH}"
echo "::add-matcher::${GITHUB_WORKSPACE}/src/.ci/githubactions/pattern_matchers/clang.json"
cmake --build . --config ${BUILD_TYPE} --target install
echo "::remove-matcher owner=clang::"
- name: Debug Output
working-directory: ${{github.workspace}}/installed
run: ls -al
- name: Package Archive
working-directory: '${{ github.workspace }}/build'
env:
OUTPUT_DIR: "${{ github.workspace }}/output"
run: |
cpack --config "./CPackConfig.cmake" -G ZIP -D CPACK_PACKAGE_FILE_NAME="warzone2100_archive" -D CPACK_INCLUDE_TOPLEVEL_DIRECTORY=OFF -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON -D CPACK_COMPONENTS_GROUPING=ALL_COMPONENTS_IN_ONE
OUTPUT_FILE_NAME="warzone2100_${WZ_BUILD_DESC}_archive.zip"
mv "./warzone2100_archive.zip" "${OUTPUT_DIR}/${OUTPUT_FILE_NAME}"
echo "Generated .zip: \"${OUTPUT_FILE_NAME}\""
echo " -> SHA512: $(sha512sum "${OUTPUT_DIR}/${OUTPUT_FILE_NAME}")"
echo " -> Size (bytes): $(stat -c %s "${OUTPUT_DIR}/${OUTPUT_FILE_NAME}")"
echo "WZ_FULL_OUTPUT_ZIP_PATH=${OUTPUT_DIR}/${OUTPUT_FILE_NAME}" >> $GITHUB_ENV
- name: 'Upload Artifact - (Archive)'
uses: actions/upload-artifact@v4
if: success() && (matrix.upload_artifact == true) && (github.repository == 'Warzone2100/warzone2100')
with:
name: warzone2100_${{ env.WZ_BUILD_DESC }}_archive
path: '${{ env.WZ_FULL_OUTPUT_ZIP_PATH }}'
if-no-files-found: 'error'
upload_to_release:
strategy:
matrix:
architecture: ["wasm32"]
fail-fast: false
name: 'Upload to Release'
permissions:
contents: write # Needed to upload to releases
runs-on: ubuntu-latest
if: (github.repository == 'Warzone2100/warzone2100') && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release')
needs: web-build
env:
WZ_WASM_ARCH: '${{ matrix.arch }}'
WZ_BUILD_DESC: 'web_${{ matrix.arch }}'
steps:
- name: Prep Environment
run: mkdir dl-archive
- name: Download Archive Artifact
uses: actions/download-artifact@v4
with:
name: 'warzone2100_${{ env.WZ_BUILD_DESC }}_archive'
path: ./dl-archive
- name: Upload Release Asset
run: |
SOURCE_TAG="${WZ_GITHUB_REF#refs/tags/}"
gh release upload "${SOURCE_TAG}" "${{ env.WZ_FULL_OUTPUT_ZIP_PATH }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
WZ_GITHUB_REF: ${{ needs.web-build.outputs.WZ_GITHUB_REF }}
WZ_FULL_OUTPUT_ZIP_PATH: ./dl-archive/warzone2100_${{ env.WZ_BUILD_DESC }}_archive.zip
publish_dev_build:
strategy:
matrix:
architecture: ["wasm32"]
fail-fast: false
name: 'Publish Dev Build (${{ matrix.architecture }})'
# Run on push to master branch (development build)
if: (github.repository == 'Warzone2100/warzone2100') && (github.event_name == 'push' && github.ref == 'refs/heads/master')
needs: web-build
uses: ./.github/workflows/publish_web_build.yml
with:
env: webedition_deploy_dev
architecture: ${{ matrix.architecture }}
artifact: 'warzone2100_web_${{ matrix.architecture }}_archive'
built-ref: ${{ needs.web-build.outputs.WZ_GITHUB_REF }}
built-commit-sha: ${{ needs.web-build.outputs.WZ_GITHUB_SHA }}
release: false
ssh-dest-host: ${{ vars.WZ_WEB_BUILD_UPLOAD_SSH_HOST }}
cdn-purge-base-url: 'play.wz2100.net/dev'
secrets: inherit
publish_release_build:
strategy:
matrix:
architecture: ["wasm32"]
fail-fast: false
name: 'Publish Release Build (${{ matrix.architecture }})'
# Run on tag release automation build
# Note: the build will be uploaded to a /release/<tag>/ folder, but will not be set as the "latest" release until the GitHub Release is published
if: (github.repository == 'Warzone2100/warzone2100') && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release')
needs: web-build
uses: ./.github/workflows/publish_web_build.yml
with:
env: webedition_deploy_release
architecture: ${{ matrix.architecture }}
artifact: 'warzone2100_web_${{ matrix.architecture }}_archive'
built-ref: ${{ needs.web-build.outputs.WZ_GITHUB_REF }}
built-commit-sha: ${{ needs.web-build.outputs.WZ_GITHUB_SHA }}
release: true
ssh-dest-host: ${{ vars.WZ_WEB_BUILD_UPLOAD_SSH_HOST }}
cdn-purge-base-url: 'play.wz2100.net/release'
secrets: inherit