Skip to content

Move CI to GitHub Actions; retire AppVeyor and Azure Pipelines config - #4105

Merged
AArnott merged 7 commits into
masterfrom
github-actions-ci
Oct 7, 2026
Merged

AArnott merged 7 commits into
masterfrom
github-actions-ci

Conversation

@AArnott

@AArnott AArnott commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This makes GitHub Actions the CI for this repo and retires the AppVeyor and Azure Pipelines config.

Maintainer action is needed before this can merge. See Required before merge.

Changes

File Change
.github/workflows/build.yml New. Build, C# 6–13 × Debug/Release test matrix, coverage, packages.
.nuget/packages.config OpenCover → coverlet.console 6.0.4. Byte-identical to #4104, so the two PRs don't conflict on this file.
azure-pipelines.yml, build/build-and-test.yml, build/test.yml Deleted. Nothing else referenced them except two solution items.
StyleCopAnalyzers.sln Removed the solution items for the two deleted build/*.yml files.
appveyor.yml Replaced with a stub that disables AppVeyor builds. See below for why it isn't simply deleted.

build/opencover-report.ps1 is kept because it's a local developer script, not CI config. README, docs, version.json/NBGV, and the Unstable package ID are unchanged.

The workflow

It starts from the Build workflow in #3956 (AArnott:modernize, closed, never merged): one windows-latest job (Debug/Release) running init.ps1, nuget restore, and msbuild, then uploading the Release .nupkg. It had no tests. The first commit brings that file in unchanged. Changes since then:

  • Line endings: core.autocrlf true is set before checkout. It used to run after checkout, so it had no effect. This matches AppVeyor.
  • SDK: actions/setup-dotnet with global-json-file: global.json (6.0.100) instead of init.ps1. init.ps1 goes through Set-EnvVars.ps1, which uses the removed ::set-env/::add-path commands.
  • NuGet / MSBuild: NuGet 6.0.6 and sequential msbuild (AnnotatorBuildTask doesn't support parallel builds), as the old Azure build did. A binlog is uploaded on failure.
  • Tests: 16 jobs, C# 6–13 × Debug/Release. Each runs the matching test assembly with xunit.console.x86 wrapped by coverlet.console, with Cobertura output. This is the same invocation as ci: replace OpenCover with coverlet.console (fix C#13 Debug AV crash) #4104. TFMs are net452 (C# 6), net46 (C# 7), and net472 (C# 8–13). Test binaries are passed from the build job as artifacts.
  • Coverage merge: a job runs ReportGenerator on the per-language reports and produces Cobertura plus an HTML summary. Uploading to codecov.io is left for later because it needs a token.
  • Triggers: push and pull_request to master (tags ignored), plus workflow_dispatch. Superseded PR runs are cancelled. Token permissions are contents: read.

Why coverlet instead of OpenCover

With OpenCover 4.6.519, Debug test jobs crashed intermittently on Actions, the same way Azure's "Test C# 13 Debug" did. About 15 s after "Starting", xunit died with no output, OpenCover committed a near-empty report, and the job exited 1. It hit C# 7, 9, 10, 11 and 12 Debug on different runs. One C# 13 Release job also hung for more than 18 minutes. After switching to coverlet (as #4104 does for Azure), all 16 jobs pass. For example, C# 13 Debug ran 8,739 tests with 0 failures and 91% line coverage. No tests were skipped or changed.

Artifacts

  • nuget-packages: StyleCop.Analyzers.<ver>.nupkg, StyleCop.Analyzers.Unstable.<ver>.nupkg, and .symbols.nupkg
  • test-results-cs<N>-<Config>: xUnit XML
  • coverage-cs<N> and coverage-merged
  • test-bin-cs<N>-<Config>: internal handoff between jobs, 3-day retention
  • status-json: only when the status generator succeeds (it currently doesn't; see Known issues)

No .vsix: the VSIX project was removed in 473a022 (Dec 2023), so there's no VSIX to publish. AppVeyor's .vsix artifact path already matched nothing.

Why appveyor.yml is a stub instead of deleted

The AppVeyor project's public API (ci.appveyor.com/api/projects/sharwell/stylecopanalyzers) reports skipBranchesWithoutAppveyorYml: false. That means if appveyor.yml is missing, AppVeyor falls back to the build settings in its web UI and keeps building. So the stub stops webhook builds using AppVeyor's documented settings:

  • skip_commits: message: /.*/ (docs)
  • branches: only: [__appveyor_disabled__] (docs)
  • skip_tags: true
  • build: off / test: off, in case a build is started from the UI, API, or a schedule (those ignore the filters)

Verified on this PR: AppVeyor built c81c5963 (branch and PR builds) but created no build for c56bb282, the commit that adds the stub.

Azure Pipelines after deleting the YAML

Azure definition 6 (DotNetAnalyzers.StyleCopAnalyzers, dev.azure.com/DotNetAnalyzers) did not queue a failing build for c56bb282. It queued nothing at all, and Azure reports no check on that commit. Deleting the YAML therefore stops it on this branch rather than turning it red. The definition is still enabled, though. Any branch or old PR that still contains azure-pipelines.yml will keep triggering it until someone disables the definition.

Required before merge (maintainer actions)

  1. Branch protection on master: the required status checks are currently continuous-integration/appveyor/pr and DotNetAnalyzers.StyleCopAnalyzers. Neither will report on this PR or later ones, so the PR stays blocked. A repo admin needs to replace them with the Actions checks (for example the Test C# * * and Build * jobs).
  2. Azure Pipelines: a project admin of dev.azure.com/DotNetAnalyzers should disable or delete pipeline definition 6, and optionally the GitHub service connection.
  3. AppVeyor: the project lives under @sharwell's AppVeyor account. Only that account (or collaborators it has added) can delete the project or remove its GitHub webhook. After that, the appveyor.yml stub can be deleted. Old branches without the stub (e.g. stabilization, which still has the old appveyor.yml) will keep building on AppVeyor until then.
  4. Rule status page: docs/index.html loads StyleCop.Analyzers.Status.json from AppVeyor's master artifacts. With AppVeyor disabled that data will stop updating, and the README badge still points at AppVeyor. Both need a follow-up docs change (out of scope here).

Known issues

This is the .github/workflows/build.yml from the closed PR #3956
(AArnott:modernize, commit 2474476), unmodified.
- Set core.autocrlf before checkout (was after, so it had no effect)
- Use actions/setup-dotnet with global-json-file instead of init.ps1
  (init.ps1 -> Set-EnvVars.ps1 uses the removed ::set-env/::add-path commands)
- Use NuGet 6.0.6 and sequential msbuild, matching Azure Pipelines
- Produce StyleCop.Analyzers.Status.json like AppVeyor
- Upload nupkg, status report, and binlog on failure
- Add test matrix C# 6-13 x Debug/Release mirroring build/test.yml
  (xunit.console.x86 under OpenCover)
- Add coverage merge job mirroring the Azure 'Publish Code Coverage' stage
  (without the codecov.io upload)
StyleCop.Analyzers.Status.Generator fails on windows-latest (VS 2022) with a
ReflectionTypeLoadException while creating MSBuildWorkspace. That's a tooling
issue unrelated to the build or tests, so don't let it block the test matrix
or other artifacts.
Matches build/test.yml, and keeps partial coverage from crashed runs out of the merged report.
@AArnott
AArnott marked this pull request as draft October 5, 2026 23:44
OpenCover 4.6.519 intermittently crashes the test process in Debug jobs
(seen on C# 7, 10, 11, 12 Debug here; C# 13 Debug on Azure). Mirror #4104:
wrap xunit.console.x86 with coverlet.console 6.0.4, Cobertura output,
keeping the OpenCover.Reports / OpenCover.*.xml names for the merge step.
'nuget install' rejects coverlet.console because it is a DotnetTool package
(NU5000), but packages.config restore accepts it. Use the identical
.nuget/packages.config from #4104 (OpenCover -> coverlet.console 6.0.4) so the
two PRs merge cleanly.
- Delete azure-pipelines.yml and its templates build/build-and-test.yml and
  build/test.yml (nothing else references them), plus their solution items.
- Replace appveyor.yml with a stub that disables AppVeyor builds. The AppVeyor
  project builds from its UI settings when appveyor.yml is missing
  (skipBranchesWithoutAppveyorYml=false), so deleting the file would not stop it.
@AArnott AArnott changed the title Add GitHub Actions CI (build, C# 6-13 test matrix, packages) Move CI to GitHub Actions; retire AppVeyor and Azure Pipelines config Oct 6, 2026
@AArnott
AArnott marked this pull request as ready for review October 6, 2026 01:08
@AArnott
AArnott merged commit 7481838 into master Oct 7, 2026
19 checks passed
@AArnott
AArnott deleted the github-actions-ci branch October 7, 2026 03:41
AArnott added a commit that referenced this pull request Oct 7, 2026
Merge Edwin Engelen's original commits from #4077 (b0af9b7, 0d3e41c,
e65f52d, 9b946ab) on top of the C# 14 test project from #4117.

Conflict resolution:
- b0af9b7 is Edwin's copy of Björn's "Add test project for c# 14"
  (ccb81f4, already in history). Keep the #4117 version of the C# 14 test
  project (csproj and SA1107 tests); its Azure Pipelines edits are dropped
  because master deleted build/build-and-test.yml and build/test.yml (#4105).
- SA1500CSharp14UnitTests.cs, SA1513CSharp14UnitTests.cs: take Edwin's tests
  on top of the empty C# 14 test classes.
- The NuGet.Frameworks 6.3.3 -> 6.3.4 bump (0d3e41c) merges cleanly and is
  kept: it is a patch-level bump of a test-only dependency.
alexander-efremov pushed a commit to alexander-efremov/StyleCopNext.Analyzers that referenced this pull request Oct 7, 2026
Bring Björn's C# 14 test project commit (ccb81f4, from DotNetAnalyzers#4040) up to date
with master.

Conflict resolution:
- build/build-and-test.yml, build/test.yml: keep master's deletion (DotNetAnalyzers#4105
  moved CI to GitHub Actions); the C# 14 test stage moves to
  .github/workflows/build.yml (test binary upload + langVersion 14 matrix entry).
- SA1107UnitTests.cs: keep the GetFixedCodeTestEmptyStatementAfterBlock hook
  from DotNetAnalyzers#4040 on top of master's VerifyCSharpFixAsync form of the test.
AArnott added a commit that referenced this pull request Oct 7, 2026
Codecov was last updated by Azure Pipelines (bc487e7, Oct 6). Since
#4105 moved CI to GitHub Actions without the codecov.io upload step,
nothing has been uploaded. Upload the merged Cobertura report from the
coverage job with codecov/codecov-action (pinned to v7.1.1), when every
test job succeeded. It authenticates with GitHub OIDC, so no Codecov
token secret is needed; pull requests from forks fall back to Codecov's
tokenless upload.
This was referenced Nov 23, 2026
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