feat(i18n): embed locale catalogs and load from XDG cache #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [master] | |
| tags: ['*'] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| env: | |
| BUILD_TYPE: RelWithDebInfo | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| semver: ${{ steps.version.outputs.semver }} | |
| steps: | |
| - id: version | |
| run: | | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ]; then | |
| semver="${GITHUB_REF_NAME#v}" | |
| else | |
| semver="$(grep -Po 'project\([^)]*VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt | head -n1)" | |
| fi | |
| echo "version=OpenGothicStarter v${semver}" >> "$GITHUB_OUTPUT" | |
| echo "semver=${semver}" >> "$GITHUB_OUTPUT" | |
| format: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install clang-format | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format | |
| - name: Run formatter | |
| run: ./scripts/format.sh | |
| - name: Verify formatting | |
| run: git diff --exit-code | |
| i18n: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install gettext tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gettext | |
| - name: Validate localization catalogs | |
| run: ./scripts/check_i18n.sh | |
| - name: Validate POT template sync | |
| run: ./scripts/check_pot_sync.sh | |
| tidy: | |
| needs: [format, i18n] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwxgtk3.2-dev clang clang-tidy | |
| - name: Configure | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| run: | | |
| cmake -S . -B build-tidy \ | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DOGS_WARNINGS_AS_ERRORS=ON \ | |
| -DOGS_EXTRA_WARNINGS=ON | |
| - name: Run clang-tidy | |
| run: | | |
| ./scripts/tidy.sh build-tidy | |
| linux: | |
| needs: [setup, format, tidy] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwxgtk3.2-dev clang lld | |
| - name: Configure | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DOGS_WARNINGS_AS_ERRORS=ON \ | |
| -DOGS_EXTRA_WARNINGS=ON \ | |
| -DOGS_HARDENED_BUILD=ON | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opengothicstarter_${{ needs.setup.outputs.semver }}_linux_x64 | |
| path: | | |
| build/OpenGothicStarter | |
| build/locale | |
| windows: | |
| needs: [setup, format, tidy] | |
| runs-on: windows-2025 | |
| env: | |
| VCPKG_REF: 2025.12.12 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Cache vcpkg | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| C:\vcpkg\archives | |
| C:\vcpkg\downloads | |
| key: ${{ runner.os }}-vcpkg-${{ env.VCPKG_REF }}-x64-windows-${{ hashFiles('**/vcpkg.json', '**/vcpkg-configuration.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vcpkg-${{ env.VCPKG_REF }}-x64-windows- | |
| ${{ runner.os }}-vcpkg- | |
| - name: Setup vcpkg | |
| shell: pwsh | |
| run: | | |
| if (-not (Test-Path 'C:\vcpkg\.git')) { | |
| git clone https://github.com/microsoft/vcpkg C:\vcpkg | |
| } | |
| git -C C:\vcpkg fetch --depth 1 origin "refs/tags/$env:VCPKG_REF" | |
| git -C C:\vcpkg checkout --force FETCH_HEAD | |
| & 'C:\vcpkg\bootstrap-vcpkg.bat' | |
| New-Item -ItemType Directory -Force -Path 'C:\vcpkg\archives' | Out-Null | |
| New-Item -ItemType Directory -Force -Path 'C:\vcpkg\downloads' | Out-Null | |
| "VCPKG_ROOT=C:\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "VCPKG_DEFAULT_BINARY_CACHE=C:\vcpkg\archives" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "VCPKG_BINARY_SOURCES=clear;files,C:\vcpkg\archives,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "VCPKG_DOWNLOADS=C:\vcpkg\downloads" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Install dependencies | |
| shell: pwsh | |
| run: | | |
| & "$env:VCPKG_ROOT\vcpkg.exe" install --triplet x64-windows | |
| - name: Configure | |
| shell: pwsh | |
| run: | | |
| cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" -DOGS_WARNINGS_AS_ERRORS=ON -DOGS_EXTRA_WARNINGS=ON | |
| - name: Build | |
| shell: pwsh | |
| run: | | |
| cmake --build build --parallel | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opengothicstarter_${{ needs.setup.outputs.semver }}_win_x64 | |
| path: | | |
| build/OpenGothicStarter.exe | |
| build/locale | |
| macos-arm64: | |
| needs: [setup, format, tidy] | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: brew install wxwidgets | |
| - name: Configure | |
| run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DOGS_WARNINGS_AS_ERRORS=ON -DOGS_EXTRA_WARNINGS=ON -DOGS_HARDENED_BUILD=ON | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opengothicstarter_${{ needs.setup.outputs.semver }}_osx_arm64 | |
| path: | | |
| build/OpenGothicStarter | |
| build/locale | |
| macos-x64: | |
| needs: [setup, format, tidy] | |
| runs-on: macos-15-intel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: brew install wxwidgets | |
| - name: Configure | |
| run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DOGS_WARNINGS_AS_ERRORS=ON -DOGS_EXTRA_WARNINGS=ON -DOGS_HARDENED_BUILD=ON | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opengothicstarter_${{ needs.setup.outputs.semver }}_osx_x64 | |
| path: | | |
| build/OpenGothicStarter | |
| build/locale | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [setup, tidy, linux, windows, macos-arm64, macos-x64] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Package release archives | |
| env: | |
| VERSION: ${{ needs.setup.outputs.semver }} | |
| run: | | |
| cd artifacts/opengothicstarter_${VERSION}_linux_x64 && zip -r ../opengothicstarter_${VERSION}_linux_x64.zip . && cd ../.. | |
| cd artifacts/opengothicstarter_${VERSION}_win_x64 && zip -r ../opengothicstarter_${VERSION}_win_x64.zip . && cd ../.. | |
| cd artifacts/opengothicstarter_${VERSION}_osx_arm64 && zip -r ../opengothicstarter_${VERSION}_osx_arm64.zip . && cd ../.. | |
| cd artifacts/opengothicstarter_${VERSION}_osx_x64 && zip -r ../opengothicstarter_${VERSION}_osx_x64.zip . && cd ../.. | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: OpenGothicStarter v${{ needs.setup.outputs.semver }} | |
| draft: true | |
| prerelease: true | |
| fail_on_unmatched_files: true | |
| files: | | |
| artifacts/opengothicstarter_${{ needs.setup.outputs.semver }}_linux_x64.zip | |
| artifacts/opengothicstarter_${{ needs.setup.outputs.semver }}_win_x64.zip | |
| artifacts/opengothicstarter_${{ needs.setup.outputs.semver }}_osx_arm64.zip | |
| artifacts/opengothicstarter_${{ needs.setup.outputs.semver }}_osx_x64.zip |