Skip to content

Migrate CI build pipeline to Ubuntu (Linux) runner #42

Description

@cjdutoit

Summary

As part of an org-wide effort across Digital Development Team repositories, we need to support Linux builds (ubuntu-latest) instead of windows-latest for CI. The build job in .github/workflows/build.yml currently runs on windows-latest.

Local development is unaffected — this is a CI-only change.

What was found in this repo

  • Workflow: .github/workflows/build.ymlbuild job has runs-on: windows-latest and a Windows-only Enable long paths for Git step (git config --system core.longpaths true). Unit, Acceptance, and Integration test suites run via PowerShell (pwsh) loops over *.csproj files matching each test-type filter.
  • This repo (NHSDigital.ApiPlatform.Sdk, NHSDigital.ApiPlatform.Sdk.AspNetCore) is a client SDK / broker library for calling the NHS Digital API Platform — it is not backed by a database. A search of the codebase for DbContext/UseSqlServer/UseNpgsql/UseInMemoryDatabase only turns up references inside the .agents/.claude skill templates (shared org coding-standard examples), not in the SDK's own source. No Docker database container is needed for this repo's CI.
  • Other workflows: pages.yml (GitHub Pages, hand-authored per the repo's own dependency-graph documentation) and prLinter.yml are unaffected by this change; add_tag and publish jobs already run on ubuntu-latest.
  • Generator: this repo follows the org convention — .github/workflows/build.yml (and prLinter.yml) are generated by the NHSDigital.ApiPlatform.Infrastructure console project (Program.cs calls ScriptGenerationService.GenerateBuildScript(...), which builds a GithubPipeline via ADotNet and serializes it). The repo's own Documentation/DependencyGraph notes confirm build.yml/prLinter.yml are generated artifacts and must not be hand-edited (pages.yml is the documented exception). build.yml must never be hand-edited directly.

What needs to change

  1. Runner: In ScriptGenerationService.GenerateBuildScript (in NHSDigital.ApiPlatform.Infrastructure/Services/ScriptGenerationService.cs), change the build job's RunsOn from BuildMachines.WindowsLatest to BuildMachines.UbuntuLatest.
  2. Database: Not applicable — this repo has no database dependency, so no Docker database service is required in CI.
  3. Windows-only step: Remove Enable long paths for Git (git config --system core.longpaths true) — unnecessary on Ubuntu.
  4. Test steps: The existing pwsh-based test loops (Unit/Acceptance/Integration) will continue to work on ubuntu-latest since PowerShell Core is preinstalled there, but verify each step still passes after switching runner OS (e.g. path separators, any Windows-specific assumptions in the test projects).
  5. Never hand-edit build.yml: All of the above must be implemented as changes to the C# generator code in NHSDigital.ApiPlatform.Infrastructure, then the console project run to regenerate .github/workflows/build.yml, and the regenerated file committed.
  6. Verify the regenerated workflow runs green end-to-end on ubuntu-latest before merging.

Local development

No change — local dev is unaffected by this CI-only migration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions