配列クラスを整備する #2981
Workflow file for this run
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 sakura | |
| # Controls when the action will run. Triggers the workflow on push or pull request | |
| # events but only for the master branch | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths-ignore: | |
| - '**/*.md' | |
| - .gitignore | |
| - .editorconfig | |
| pull_request: | |
| paths-ignore: | |
| - '**/*.md' | |
| - .gitignore | |
| - .editorconfig | |
| defaults: | |
| run: | |
| shell: pwsh # 指定しない限りpwshを使う | |
| env: | |
| CI_ACCOUNT_NAME: ${{ github.actor }} | |
| CI_REPO_NAME: ${{ github.repository }} | |
| CI_BUILD_VERSION: ${{ github.run_id }} | |
| CI_BUILD_NUMBER: ${{ github.run_number }} | |
| CI_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| GITHUB_COMMIT_URL: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} | |
| VCPKG_BINARY_SOURCES: clear;nuget,https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json,read | |
| VCPKG_NUGET_FEED: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json | |
| VCPKG_NUGET_OWNER: ${{ github.repository_owner }} | |
| VCPKG_ROOT: ${{ github.workspace }}\tools\vcpkg | |
| permissions: | |
| actions: read | |
| contents: read | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| check-encoding: | |
| runs-on: &windows_runner windows-latest # YAMLアンカーを使う | |
| defaults: | |
| run: | |
| shell: cmd # このJobでは 指定しない限り cmd を使う | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 # 過去の履歴も含めて全て取得 (check_encoding.py で origin/master にアクセスするため) | |
| - name: Show environment variables for debug | |
| run: set | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: ${{ vars.PYTHON_VERSION || '3.14.3' }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| activate-environment: true | |
| - run: uv pip install --require-hashes --no-build --no-deps -r requirements.txt | |
| - name: Python version check | |
| run: python --version | |
| - name: Python compile check before install | |
| run: python -m compileall -f . | |
| - name: Check encoding | |
| run: checkEncoding.bat | |
| build-vcpkg: | |
| name: Build vcpkg | |
| runs-on: *windows_runner | |
| needs: check-encoding | |
| env: | |
| VCPKG_BINARY_SOURCES: clear;nuget,https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json,readwrite | |
| permissions: | |
| packages: write | |
| strategy: | |
| matrix: | |
| triplet: | |
| - x64-windows-static | |
| - x64-mingw-static | |
| - x86-windows-static | |
| steps: | |
| ## see https://github.com/actions/checkout | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 1 # 過去の履歴は含めず取得 | |
| submodules: true | |
| ## see https://github.com/microsoft/setup-msbuild | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # v3 | |
| - name: Set up MSYS2 | |
| uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0 | |
| if: matrix.triplet == 'x64-mingw-static' | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-iconv | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-make | |
| mingw-w64-x86_64-python | |
| mingw-w64-x86_64-uv | |
| mingw-w64-x86_64-7zip | |
| mingw-w64-x86_64-gdb | |
| mingw-w64-x86_64-ctags | |
| mingw-w64-x86_64-diffutils | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| if: matrix.triplet == 'x64-windows-static' || matrix.triplet == 'x86-windows-static' | |
| with: | |
| python-version: ${{ vars.PYTHON_VERSION || '3.14.3' }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| if: matrix.triplet == 'x64-windows-static' || matrix.triplet == 'x86-windows-static' | |
| with: | |
| activate-environment: true | |
| - run: uv venv | |
| if: matrix.triplet == 'x64-mingw-static' | |
| shell: msys2 {0} | |
| - run: uv pip install --require-hashes --no-build --no-deps -r requirements.txt | |
| if: matrix.triplet == 'x64-windows-static' || matrix.triplet == 'x86-windows-static' | |
| - run: uv pip install --require-hashes --no-build --no-deps -r requirements.txt | |
| if: matrix.triplet == 'x64-mingw-static' | |
| shell: msys2 {0} | |
| - name: Bootstrap vcpkg | |
| run: | | |
| if (-not (Test-Path ".\bootstrap-vcpkg.bat" -PathType Leaf)) { | |
| throw ".\bootstrap-vcpkg.bat not found." | |
| } | |
| & .\bootstrap-vcpkg.bat -disableMetrics | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Failed to bootstrap vcpkg (exit code: $LASTEXITCODE)." | |
| } | |
| working-directory: ${{ env.VCPKG_ROOT }} | |
| - name: Configure GitHub Packages for vcpkg | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| $vcpkg = "$env:VCPKG_ROOT\vcpkg.exe" | |
| $nuget = & $vcpkg fetch nuget | |
| if ($LASTEXITCODE -ne 0 -or -not (Test-Path $nuget -PathType Leaf)) { | |
| throw "Failed to obtain nuget.exe." | |
| } | |
| & $nuget sources remove ` | |
| -Name GitHubPackages ` | |
| -NonInteractive 2>$null | |
| & $nuget sources add ` | |
| -Name GitHubPackages ` | |
| -Source "$env:VCPKG_NUGET_FEED" ` | |
| -UserName "$env:VCPKG_NUGET_OWNER" ` | |
| -Password "$env:GITHUB_TOKEN" ` | |
| -StorePasswordInClearText ` | |
| -NonInteractive | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Failed to add the GitHub Packages NuGet source." | |
| } | |
| - name: vcpkg install (${{ matrix.triplet }}) | |
| run: | | |
| & "${{ env.VCPKG_ROOT }}\vcpkg.exe" install ` | |
| --triplet "${{ matrix.triplet }}" ` | |
| --clean-after-build | |
| build-chm: | |
| name: Build CHM | |
| runs-on: *windows_runner | |
| needs: check-encoding | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 1 | |
| submodules: true | |
| # HHC.exeを実行するためにMsBuildが必要 | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v3 | |
| # LEProc.exeをインストールするためにAutoHotKeyが必要 | |
| - name: Install AutoHotKey | |
| run: | | |
| $AutohotkeyDir = "$HOME\autohotkey" | |
| if (!(Test-Path $AutohotkeyDir)) { New-Item -ItemType Directory -Path $AutohotkeyDir } | |
| $ProgressPreference = 'SilentlyContinue' | |
| Invoke-WebRequest -Uri https://github.com/AutoHotkey/AutoHotkey/releases/download/v2.0.19/AutoHotkey_2.0.19.zip -OutFile "AutoHotkey.zip" | |
| Expand-Archive -Path "AutoHotkey.zip" -DestinationPath $AutohotkeyDir -Force | |
| echo "AutoHotKey=$HOME\autohotkey\AutoHotkey32.exe" >> $env:GITHUB_ENV | |
| # HHC.exeを実行するためにLEProc.exeが必要 | |
| - name: Install Locale Emulator | |
| run: | | |
| $LEExpandDir = "${{ github.workspace }}\tools\LocaleEmulator" | |
| $LEInitScript = "${{ github.workspace }}\tools\LocaleEmulator\init-locale-emulator.ahk" | |
| Expand-Archive "${{ github.workspace }}\externals\LocaleEmulator\locale-emulator.zip" "${LEExpandDir}" | |
| Start-Process $env:AutoHotKey "${LEInitScript}" | |
| Start-Process "${LEExpandDir}\LEInstaller.exe" | |
| echo "${LEExpandDir}" >> $env:GITHUB_PATH | |
| # HHC.exeを使ってHTMLヘルプをコンパイルする | |
| - name: Build HTML Help | |
| run: build-chm.bat | |
| shell: cmd | |
| # コンパイルしたHTMLヘルプをartifactにする | |
| - name: Upload CHM artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: build-chm-artifacts | |
| path: | | |
| help/**/*.chm | |
| help/**/Compile.log | |
| if-no-files-found: error | |
| build-bmp-tools: | |
| name: Build BmpTools | |
| runs-on: *windows_runner | |
| needs: check-encoding | |
| strategy: | |
| matrix: | |
| config: | |
| - Debug | |
| - Release | |
| steps: | |
| ## see https://github.com/actions/checkout | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 1 # 過去の履歴は含めず取得 | |
| submodules: true | |
| ## see https://github.com/microsoft/setup-msbuild | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # v3 | |
| - name: Bootstrap vcpkg | |
| run: .\bootstrap-vcpkg.bat -disableMetrics | |
| working-directory: ${{ env.VCPKG_ROOT }} | |
| shell: cmd | |
| # Toolbar Bitmap Split/Mux | |
| - name: Build Bitmap Split/Mux | |
| run: build-bmp-tools.bat ${{ matrix.config }} | |
| shell: cmd | |
| build: | |
| # The type of runner that the job will run on | |
| name: MSBuild | |
| runs-on: *windows_runner | |
| needs: [build-vcpkg, build-chm] | |
| strategy: | |
| matrix: | |
| config: | |
| - Debug | |
| - Release | |
| platform: | |
| - Win32 | |
| - x64 | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| ## see https://github.com/actions/checkout | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| ## see https://github.com/microsoft/setup-msbuild | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v3 | |
| # SonarQubeのBuild Wrapperをインストールする | |
| - name: Install Build Wrapper | |
| if: ${{ matrix.platform == 'x64' && matrix.config == 'Debug' }} | |
| uses: SonarSource/sonarqube-scan-action/install-build-wrapper@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 | |
| # OpenCppCoverageをインストールする | |
| - name: Install OpenCppCoverage (winget) | |
| id: install_opencppcoverage_winget | |
| if: ${{ matrix.config == 'Debug' }} | |
| continue-on-error: true | |
| run: | | |
| winget install ` | |
| --id OpenCppCoverage.OpenCppCoverage ` | |
| --exact ` | |
| --accept-package-agreements ` | |
| --accept-source-agreements | |
| # wingetは失敗することがあるので、インストーラー方式も残しておく。 | |
| - name: Install OpenCppCoverage (installer) | |
| if: ${{ matrix.config == 'Debug' && steps.install_opencppcoverage_winget.outcome == 'failure' }} | |
| working-directory: ${{ runner.temp }} | |
| run: | | |
| $installer = '.\OpenCppCoverageSetup.exe' | |
| Invoke-WebRequest ` | |
| -Uri "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.exe" ` | |
| -OutFile $installer | |
| $expectedSha256 = '2295a733da39412c61e4f478677519dd0bb1893d88313ce56b468c9e50517888' | |
| $actualSha256 = (Get-FileHash $installer -Algorithm SHA256).Hash.ToLowerInvariant() | |
| if ($actualSha256 -ne $expectedSha256.ToLowerInvariant()) { | |
| throw "SHA256 mismatch: expected=$expectedSha256 actual=$actualSha256" | |
| } | |
| Start-Process ` | |
| -FilePath $installer ` | |
| -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES" ` | |
| -Wait | |
| echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH | |
| - name: Install CTags (winget) | |
| continue-on-error: true | |
| run: | | |
| winget install ` | |
| --id UniversalCtags.Ctags ` | |
| --exact ` | |
| --accept-package-agreements ` | |
| --accept-source-agreements | |
| - name: Install DiffUtils (winget) | |
| continue-on-error: true | |
| run: | | |
| winget install ` | |
| --id GnuWin32.DiffUtils ` | |
| --exact ` | |
| --accept-package-agreements ` | |
| --accept-source-agreements | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: ${{ vars.PYTHON_VERSION || '3.14.3' }} | |
| architecture: ${{ matrix.platform == 'Win32' && 'x86' || 'x64' }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| activate-environment: true | |
| - run: uv pip install --require-hashes --no-build --no-deps -r requirements.txt | |
| - name: Copy github-event.json | |
| run: | | |
| Copy-Item "$env:GITHUB_EVENT_PATH" github-event.json | |
| - name: Generate sonar metadata | |
| if: ${{ matrix.platform == 'x64' && matrix.config == 'Debug' }} | |
| env: | |
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| PR_BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| run: | | |
| [ordered]@{ | |
| event_name = '${{ github.event_name }}' | |
| ref_name = '${{ github.ref_name }}' | |
| pr_number = '${{ github.event.pull_request.number }}' | |
| pr_head_ref = $env:PR_HEAD_REF | |
| pr_base_ref = $env:PR_BASE_REF | |
| } | ConvertTo-Json | Set-Content sonar-metadata.json | |
| - name: Setup PR environment variables | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| echo "GITHUB_PR_NUMBER=${{ github.event.pull_request.number }}" >> $env:GITHUB_ENV | |
| echo "GITHUB_PR_HEAD_URL=${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}/commits/${{ github.event.pull_request.head.sha }}" >> $env:GITHUB_ENV | |
| echo "GITHUB_PR_HEAD_COMMIT=${{ github.event.pull_request.head.sha }}" >> $env:GITHUB_ENV | |
| echo "GITHUB_PR_HEAD_SHORT_COMMIT=$('${{ github.event.pull_request.head.sha }}'.SubString(0, 8))" >> $env:GITHUB_ENV | |
| - name: Bootstrap vcpkg | |
| run: | | |
| if (-not (Test-Path ".\bootstrap-vcpkg.bat" -PathType Leaf)) { | |
| throw ".\bootstrap-vcpkg.bat not found." | |
| } | |
| & .\bootstrap-vcpkg.bat -disableMetrics | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Failed to bootstrap vcpkg (exit code: $LASTEXITCODE)." | |
| } | |
| working-directory: ${{ env.VCPKG_ROOT }} | |
| - name: Configure GitHub Packages for vcpkg | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| $vcpkg = "$env:VCPKG_ROOT\vcpkg.exe" | |
| $nuget = & $vcpkg fetch nuget | |
| if ($LASTEXITCODE -ne 0 -or -not (Test-Path $nuget)) { | |
| throw "Failed to obtain nuget.exe." | |
| } | |
| & $nuget sources remove ` | |
| -Name GitHubPackages ` | |
| -NonInteractive 2>$null | |
| & $nuget sources add ` | |
| -Name GitHubPackages ` | |
| -Source "$env:VCPKG_NUGET_FEED" ` | |
| -UserName "$env:VCPKG_NUGET_OWNER" ` | |
| -Password "$env:GITHUB_TOKEN" ` | |
| -StorePasswordInClearText ` | |
| -NonInteractive | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Failed to add the GitHub Packages NuGet source." | |
| } | |
| - name: Build with Build-Wrapper | |
| if: ${{ matrix.platform == 'x64' && matrix.config == 'Debug' }} | |
| run: build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /p:Platform=${{ matrix.platform }} /p:Configuration=${{ matrix.config }} | |
| - name: MSBuild | |
| if: ${{ !(matrix.platform == 'x64' && matrix.config == 'Debug') }} | |
| run: build-sln.bat ${{ matrix.platform }} ${{ matrix.config }} | |
| shell: cmd | |
| - name: Restore CHM artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: build-chm-artifacts | |
| path: help | |
| - name: Run unit tests | |
| timeout-minutes: 15 # 指定時間を越えたら打ち切る。値は暫定。 | |
| run: ctest | |
| --test-dir build/${{ matrix.platform }}/CMakeTools | |
| -C ${{ matrix.config }} | |
| --output-on-failure | |
| -V | |
| - name: Upload sonar-input artifact | |
| if: ${{ matrix.platform == 'x64' && matrix.config == 'Debug' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sonar-input | |
| path: | | |
| bw-output/ | |
| tests*-coverage.xml | |
| tests*-googletest.xml | |
| pytest-coverage.xml | |
| sonar-metadata.json | |
| github-event.json | |
| - name: Build installer with Inno Setup | |
| run: build-installer.bat ${{ matrix.platform }} ${{ matrix.config }} | |
| shell: cmd | |
| - name: zipArtifacts | |
| run: zipArtifacts.bat ${{ matrix.platform }} ${{ matrix.config }} | |
| if: ${{ matrix.config == 'Release' }} | |
| shell: cmd | |
| ## see https://github.com/actions/upload-artifact | |
| - name: Upload Installer | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ matrix.config == 'Release' }} | |
| with: | |
| name: Installer ${{ matrix.platform }} ${{ matrix.config }} | |
| path: 'sakura-*-Installer.zip' | |
| - name: Upload Exe | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ matrix.config == 'Release' }} | |
| with: | |
| name: Exe ${{ matrix.platform }} ${{ matrix.config }} | |
| path: 'sakura-*-Exe.zip' | |
| - name: Upload Log | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ matrix.config == 'Release' }} | |
| with: | |
| name: Log ${{ matrix.platform }} ${{ matrix.config }} | |
| path: 'sakura-*-Log.zip' | |
| - name: Upload Asm | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ matrix.config == 'Release' }} | |
| with: | |
| name: Asm ${{ matrix.platform }} ${{ matrix.config }} | |
| path: 'sakura-*-Asm.zip' | |
| - name: Upload Dev | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ matrix.config == 'Release' }} | |
| with: | |
| name: Dev ${{ matrix.platform }} ${{ matrix.config }} | |
| path: 'sakura-*-Dev.zip' |