From 630e27d6bc4f0d4b552b16b53c5a90cf977dc9c6 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:14:48 +0100 Subject: [PATCH 1/2] GitHub Workflow: Adjusted for CMake. --- .github/workflows/build.yml | 6 +-- .github/workflows/build_language.yml | 67 +++++++++++----------------- 2 files changed, 28 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4984532b2..f4bc31d743 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,10 +42,10 @@ jobs: # 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 # 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 # English + some other language for compilation testing - languages_json_array='["DE_German", "EN_English"]' + languages_json_array='["German", "English"]' fi echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT @@ -173,7 +173,7 @@ jobs: language: ${{ matrix.language }} assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }} # 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: needs: [ workflow_setup, build ] diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 631bf45e51..40a75f37e0 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -4,9 +4,9 @@ on: workflow_call: inputs: 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 - default: 'EN_English' + default: 'English' type: string assemble: description: 'assemble full package' @@ -53,60 +53,45 @@ jobs: sed -i "s|@Build@|${GAME_BUILD:0:255}|" 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 shell: bash run: | set -eux - if [[ '${{ matrix.application }}' == *'mapeditor' ]] - then - Configuration='MapEditor' - else - Configuration='Release' - fi - - INPUTS_LANGUAGE='${{ inputs.language }}' - JA2LangPrefix="${INPUTS_LANGUAGE:0:2}" - JA2Language=$(echo "${INPUTS_LANGUAGE:3}" | tr '[:lower:]' '[:upper:]') + cp -a CMakeUserPresets_VS2022.json CMakeUserPresets.json - if [[ '${{ matrix.application }}' == 'ja2ub'* ]] - then - JA2Config='JA2UB' - else - JA2Config='JA2' - fi + JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]') + JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]') echo " - Configuration=$Configuration - JA2LangPrefix=$JA2LangPrefix JA2Language=$JA2Language - JA2Config=$JA2Config + JA2Application=$JA2Application " >> $GITHUB_ENV - 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 run: | - msbuild ja2_VS2019.sln ` - /p:Configuration=$Env:Configuration ` - /p:JA2LangPrefix=$Env:JA2LangPrefix ` - /p:JA2Language=$Env:JA2Language ` - /p:JA2Config=$Env:JA2Config + cmake --build build/ + - name: List build artifacts + shell: bash + run: | + find build/ - name: Upload uses: actions/upload-artifact@v3 with: name: ${{ inputs.language }}_${{ matrix.application }} - path: bin/VS2013/ + path: build/*.exe assemble: needs: [ compile ] @@ -132,7 +117,7 @@ jobs: path: gamedir - name: Checkout gamedir-languages - if: inputs.language != 'EN_English' + if: inputs.language != 'English' uses: actions/checkout@v3 with: repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }} @@ -140,13 +125,11 @@ jobs: path: gamedir-languages - name: Copy gamedir-languages files to gamedir - if: inputs.language != 'EN_English' + if: inputs.language != 'English' shell: bash run: | set -eux - DIST_LANG='${{ inputs.language }}' - GAMEDIR_LANGUAGE="${DIST_LANG:3}" - cp -a gamedir-languages/${GAMEDIR_LANGUAGE}_Version/* gamedir/ + cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/ - name: Download ja2 uses: actions/download-artifact@v3 From 2b490ef6846bca5e01d6c3db249c6583fc002864 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Sun, 15 Jan 2023 14:04:40 -0300 Subject: [PATCH 2/2] A few nits create empty CMakeUserPresets.json file so build happens on first run comment doesn't apply anymore no need to specify the compiler when using msbuild@xxx ask ninja for the verbose command line when building --- .github/workflows/build.yml | 3 --- .github/workflows/build_language.yml | 10 ++++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4bc31d743..5529cd970a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,6 @@ jobs: if [[ '${{ inputs.build_all_languages }}' == 'true' || ( '${{ inputs.build_all_languages }}' == '' && "$full_release" == 'true' ) ]] then - # 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 - # for compilation only, the long form is transformed to upper case languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]'; else # English + some other language for compilation testing diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 40a75f37e0..bea5a00aa7 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -58,8 +58,8 @@ jobs: run: | set -eux - cp -a CMakeUserPresets_VS2022.json CMakeUserPresets.json - + touch CMakeUserPresets.json + JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]') JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]') @@ -76,12 +76,10 @@ jobs: 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" + cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" - name: Build run: | - cmake --build build/ + cmake --build build/ -- -v - name: List build artifacts shell: bash run: |