From 642713fd46a262a64c40a651f7c089f38d9476d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Tue, 17 Nov 2026 11:11:29 +0100 Subject: [PATCH 1/3] Set up MSVC without the StepSecurity action step-security/msvc-dev-cmd fails in private repositories unless the owner has a StepSecurity subscription, which it checks by sending the repository name to StepSecurity's API. This breaks every Visual Studio CI job in private development forks. Run Visual Studio's own vcvarsall.bat instead and export the variables it changes, which is what the action did. This removes a third-party dependency from both CI and release builds. --- .github/workflows/ci.yml | 24 +++++++++++++++++++++--- .github/workflows/release.yml | 24 +++++++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20b0ecd..5e21609 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,11 +135,29 @@ jobs: restore-keys: | ${{matrix.id}}- + # Use Visual Studio's own vcvarsall.bat: the StepSecurity action that + # wraps it requires a paid subscription in private repositories. - name: Configure Visual Studio if: matrix.compiler == 'vs' - uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1 - with: - arch: ${{matrix.arch}} + shell: pwsh + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $vcvarsall = & $vswhere -latest -products * -find VC\Auxiliary\Build\vcvarsall.bat | + Select-Object -First 1 + if (!$vcvarsall) { throw "vcvarsall.bat not found" } + $script = "$env:RUNNER_TEMP\vcvars.cmd" + "@call `"$vcvarsall`" ${{matrix.arch}} >&2 && set" | Set-Content -Encoding ascii $script + $vars = cmd.exe /d /c $script + if ($LASTEXITCODE -ne 0 -or !($vars -match '^VSCMD_ARG_TGT_ARCH=')) { + throw "vcvarsall.bat ${{matrix.arch}} failed" + } + foreach ($var in $vars) { + $name, $value = $var -split '=', 2 + if ($name -and $null -ne $value -and + [Environment]::GetEnvironmentVariable($name) -cne $value) { + "$name=$value" >> $env:GITHUB_ENV + } + } - name: Install MSYS2 if: matrix.compiler == 'mingw' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a3c3d6..bd76435 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -371,10 +371,28 @@ jobs: NASM_VERSION: "3.02" NASM_SHA256: 161d0bfaff53c2f9e9f3e69fd0672323ebabafd1268976a5cec11be92a19aee7 steps: + # Use Visual Studio's own vcvarsall.bat: the StepSecurity action that + # wraps it requires a paid subscription in private repositories. - name: Configure Visual Studio - uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1 - with: - arch: ${{matrix.vs_arch}} + shell: pwsh + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $vcvarsall = & $vswhere -latest -products * -find VC\Auxiliary\Build\vcvarsall.bat | + Select-Object -First 1 + if (!$vcvarsall) { throw "vcvarsall.bat not found" } + $script = "$env:RUNNER_TEMP\vcvars.cmd" + "@call `"$vcvarsall`" ${{matrix.vs_arch}} >&2 && set" | Set-Content -Encoding ascii $script + $vars = cmd.exe /d /c $script + if ($LASTEXITCODE -ne 0 -or !($vars -match '^VSCMD_ARG_TGT_ARCH=')) { + throw "vcvarsall.bat ${{matrix.vs_arch}} failed" + } + foreach ($var in $vars) { + $name, $value = $var -split '=', 2 + if ($name -and $null -ne $value -and + [Environment]::GetEnvironmentVariable($name) -cne $value) { + "$name=$value" >> $env:GITHUB_ENV + } + } # Python setup - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 From 6aa4d5478f20ab1bb779b64ce8f54a85820f16b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Tue, 17 Nov 2026 11:11:29 +0100 Subject: [PATCH 2/3] Skip CodeQL in private repositories Code scanning of private repositories requires GitHub Code Security, which is unavailable on the GitHub Free plan. Without it, every CodeQL run fails at upload after analyzing the code. Public repositories keep scanning on every push, pull request, and schedule. --- .github/workflows/codeql-analysis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 633965b..a296556 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,6 +12,8 @@ on: jobs: analyze: name: Analyze + # Code scanning of private repositories requires GitHub Code Security. + if: ${{ !github.event.repository.private }} runs-on: ubuntu-latest permissions: actions: read From 891f892b9f80d1434e387e134952c963edb7f0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Tue, 17 Nov 2026 12:00:25 +0100 Subject: [PATCH 3/3] Build on macOS in private repositories only on demand macOS runner minutes cost about six times as much as Windows minutes and are about half the cost of a CI run with warm caches, which quickly exhausts the included Actions usage of private repositories. Changes developed there are mostly portable and still get Linux and Windows coverage. Move macOS to a separate job that reuses the build steps, so it can be skipped in private repositories unless CI is run manually. Public repositories keep building on macOS for every push and pull request, under the same check name. --- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e21609..4fb84c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,12 +49,6 @@ jobs: os: ubuntu-22.04 generator: Unix Makefiles vcpkg_root: - - id: macOS - triplet: arm64-osx - compiler: clang - os: macOS-latest - generator: Unix Makefiles - vcpkg_root: /usr/local/share/vcpkg - id: windows-x64-vs triplet: x64-windows compiler: vs @@ -87,12 +81,12 @@ jobs: vcpkg_root: C:/vcpkg cache: C:/Users/runneradmin/AppData/Local/vcpkg/archives - runs-on: ${{matrix.os}} + runs-on: &runs-on ${{matrix.os}} - env: + env: &env VCPKG_ROOT: ${{matrix.vcpkg_root}} - steps: + steps: &build-steps - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 with: persist-credentials: false @@ -322,3 +316,26 @@ jobs: with: name: ${{env.version}}-${{matrix.id}} path: ${{github.workspace}}/dist + + # macOS minutes cost about six times as much as Windows minutes, which + # quickly exhausts the included usage of private repositories. Their + # portable changes are covered on other platforms, so private repositories + # build on macOS only when the workflow is run manually. + build-macos: + name: build + if: ${{ !github.event.repository.private || github.event_name == 'workflow_dispatch' }} + strategy: + matrix: + include: + - id: macOS + triplet: arm64-osx + compiler: clang + os: macOS-latest + generator: Unix Makefiles + vcpkg_root: /usr/local/share/vcpkg + + runs-on: *runs-on + + env: *env + + steps: *build-steps