Skip to content

Make CI work in private repositories on the Free plan - #536

Open
mtrojnar wants to merge 3 commits into
masterfrom
ci/private-repo
Open

mtrojnar wants to merge 3 commits into
masterfrom
ci/private-repo

Conversation

@mtrojnar

Copy link
Copy Markdown
Owner

Problem

CI does not work in private copies of this repository on the GitHub Free plan. Every Visual Studio job fails because step-security/msvc-dev-cmd requires a paid StepSecurity subscription in private repositories, and CodeQL fails because code scanning there requires GitHub Code Security. macOS jobs also account for about half the cost of a CI run, which quickly uses up the included monthly Actions usage.

Fix

  • Configure MSVC with Visual Studio's own vcvarsall.bat in CI and release builds, removing the third-party action.
  • Skip CodeQL in private repositories.
  • Move macOS to a separate job with the same steps and check name, which private repositories run only when CI is started manually.

This repository runs the same jobs as before.

Validation

In a private repository, the PR run passed with macOS and CodeQL skipped, and a manual CI run passed with macOS under its usual check name. All three Visual Studio jobs passed in both. The release workflow change has not been run.

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.
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant