GitHub Workflow: Adjusted for CMake.

This commit is contained in:
CptMoore
2023-04-22 04:31:37 -03:00
committed by majcosta
parent 3173b73ba0
commit d8728c9b92
2 changed files with 28 additions and 45 deletions
+3 -3
View File
@@ -42,10 +42,10 @@ jobs:
# the two letter short form could be removed if JA2LangPrefix is removed # the two letter short form could be removed if JA2LangPrefix is removed
# the casing of the long form adheres to the one found in the gamedir-languages repo # the casing of the long form adheres to the one found in the gamedir-languages repo
# for compilation only, the long form is transformed to upper case # for compilation only, the long form is transformed to upper case
languages_json_array='["CN_Chinese", "DE_German", "EN_English", "FR_French", "PL_Polish", "IT_Italian", "NL_Dutch", "RU_Russian"]'; languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]';
else else
# English + some other language for compilation testing # English + some other language for compilation testing
languages_json_array='["DE_German", "EN_English"]' languages_json_array='["German", "English"]'
fi fi
echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT
@@ -173,7 +173,7 @@ jobs:
language: ${{ matrix.language }} language: ${{ matrix.language }}
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }} assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
# at least English and some other lang have to work # at least English and some other lang have to work
continue-on-error: ${{ matrix.language != 'EN_English' && matrix.language != 'DE_German' }} continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
release: release:
needs: [ workflow_setup, build ] needs: [ workflow_setup, build ]
+25 -42
View File
@@ -4,9 +4,9 @@ on:
workflow_call: workflow_call:
inputs: inputs:
language: language:
description: 'any of CN_Chinese DE_German EN_English FR_French PL_Polish IT_Italian NL_Dutch RU_Russian' description: 'any of Chinese German English French Polish Italian Dutch Russian'
required: true required: true
default: 'EN_English' default: 'English'
type: string type: string
assemble: assemble:
description: 'assemble full package' description: 'assemble full package'
@@ -53,60 +53,45 @@ jobs:
sed -i "s|@Build@|${GAME_BUILD:0:255}|" GameVersion.cpp sed -i "s|@Build@|${GAME_BUILD:0:255}|" GameVersion.cpp
cat GameVersion.cpp cat GameVersion.cpp
# not sure if needed as per Language Defines.h, but only here can we set both defines I think
- name: Update builddefines.h
if: ${{ startsWith(matrix.application, 'ja2ub') }}
shell: bash
run: |
set -eux
sed -i 's/\/\/#define JA2UB/#define JA2UB/' builddefines.h
sed -i 's/\/\/#define JA2UBMAPS/#define JA2UBMAPS/' builddefines.h
cat builddefines.h
- name: Prepare build properties - name: Prepare build properties
shell: bash shell: bash
run: | run: |
set -eux set -eux
if [[ '${{ matrix.application }}' == *'mapeditor' ]] cp -a CMakeUserPresets_VS2022.json CMakeUserPresets.json
then
Configuration='MapEditor'
else
Configuration='Release'
fi
INPUTS_LANGUAGE='${{ inputs.language }}' JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]')
JA2LangPrefix="${INPUTS_LANGUAGE:0:2}" JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]')
JA2Language=$(echo "${INPUTS_LANGUAGE:3}" | tr '[:lower:]' '[:upper:]')
if [[ '${{ matrix.application }}' == 'ja2ub'* ]]
then
JA2Config='JA2UB'
else
JA2Config='JA2'
fi
echo " echo "
Configuration=$Configuration
JA2LangPrefix=$JA2LangPrefix
JA2Language=$JA2Language JA2Language=$JA2Language
JA2Config=$JA2Config JA2Application=$JA2Application
" >> $GITHUB_ENV " >> $GITHUB_ENV
- uses: microsoft/setup-msbuild@v1.1 - uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: x86
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Prepare build
run: |
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" `
-DLanguages="$Env:JA2Language" `
-DApplications="$Env:JA2Application"
- name: Build - name: Build
run: | run: |
msbuild ja2_VS2019.sln ` cmake --build build/
/p:Configuration=$Env:Configuration ` - name: List build artifacts
/p:JA2LangPrefix=$Env:JA2LangPrefix ` shell: bash
/p:JA2Language=$Env:JA2Language ` run: |
/p:JA2Config=$Env:JA2Config find build/
- name: Upload - name: Upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ inputs.language }}_${{ matrix.application }} name: ${{ inputs.language }}_${{ matrix.application }}
path: bin/VS2013/ path: build/*.exe
assemble: assemble:
needs: [ compile ] needs: [ compile ]
@@ -132,7 +117,7 @@ jobs:
path: gamedir path: gamedir
- name: Checkout gamedir-languages - name: Checkout gamedir-languages
if: inputs.language != 'EN_English' if: inputs.language != 'English'
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }} repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }}
@@ -140,13 +125,11 @@ jobs:
path: gamedir-languages path: gamedir-languages
- name: Copy gamedir-languages files to gamedir - name: Copy gamedir-languages files to gamedir
if: inputs.language != 'EN_English' if: inputs.language != 'English'
shell: bash shell: bash
run: | run: |
set -eux set -eux
DIST_LANG='${{ inputs.language }}' cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/
GAMEDIR_LANGUAGE="${DIST_LANG:3}"
cp -a gamedir-languages/${GAMEDIR_LANGUAGE}_Version/* gamedir/
- name: Download ja2 - name: Download ja2
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3