Skip to content

Commit dd045a8

Browse files
🔧 Add GitHub Actions for CI and PR (#1624)
Fixes #1623 ## Summary Migrates CI/CD pipelines from Azure Pipelines to GitHub Actions while keeping Azure Pipelines files intact for comparison. ## Changes - Added `ci.yml` workflow for continuous integration on master and release branches - Added `pr.yml` workflow for pull request validation - Both workflows include .NET nanoFramework support using `nanoframework/nanobuild@v1` action - Migrated codecov.io upload and artifact handling - Added NuGet publishing for CI builds on master branch ## Testing Once the workflow files are moved to the correct location, both GitHub Actions and Azure Pipelines will run in parallel for comparison. Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Andreas Gullberg Larsen <[email protected]>
1 parent a15e504 commit dd045a8

File tree

3 files changed

+246
-0
lines changed

3 files changed

+246
-0
lines changed

.github/workflows/ci.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'release/**'
8+
- 'maintenance/**'
9+
paths-ignore:
10+
- '**/*.png'
11+
- '**/*.md'
12+
workflow_dispatch:
13+
14+
env:
15+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
16+
DOTNET_CLI_TELEMETRY_OPTOUT: true
17+
18+
jobs:
19+
build-and-test:
20+
name: Build & Test
21+
runs-on: windows-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
lfs: true
29+
30+
- name: Setup .NET SDK
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: |
34+
6.0.x
35+
8.0.x
36+
37+
- name: Setup .NET nanoFramework build components
38+
uses: nanoframework/nanobuild@v1
39+
with:
40+
workload: 'nanoFramework'
41+
42+
- name: Build, Test and Pack
43+
shell: pwsh
44+
run: |
45+
./Build/build.ps1 -IncludeNanoFramework
46+
working-directory: ${{ github.workspace }}
47+
48+
- name: Upload to codecov.io
49+
shell: pwsh
50+
env:
51+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
52+
run: |
53+
Write-Host -Foreground Green "Downloading codecov binaries..."
54+
55+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
56+
gpg.exe --import codecov.asc
57+
58+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
59+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
60+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
61+
62+
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
63+
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
64+
65+
Write-Host -Foreground Green "Uploading to codecov..."
66+
67+
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "${{ github.run_number }}"
68+
69+
Write-Host -Foreground Green "✅ Uploaded to codecov."
70+
71+
- name: Upload Artifacts
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: artifacts
75+
path: Artifacts/
76+
retention-days: 30
77+
78+
- name: Upload NuGet packages
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: nuget-packages
82+
path: |
83+
Artifacts/**/*.nupkg
84+
Artifacts/**/*.snupkg
85+
retention-days: 30
86+
87+
publish-nuget:
88+
name: Publish to NuGet
89+
needs: build-and-test
90+
runs-on: ubuntu-latest
91+
if: github.ref == 'refs/heads/master' && github.repository_owner == 'angularsen'
92+
environment: Publish
93+
94+
steps:
95+
- name: Download NuGet packages
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: nuget-packages
99+
path: nugets
100+
101+
- name: Setup .NET SDK
102+
uses: actions/setup-dotnet@v4
103+
with:
104+
dotnet-version: 8.0.x
105+
106+
- name: Push to nuget.org
107+
run: |
108+
dotnet nuget push "**/*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGET_ORG_APIKEY }} --source https://api.nuget.org/v3/index.json
109+
working-directory: nugets

.github/workflows/pr.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: PR Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- 'release/**'
8+
- 'maintenance/**'
9+
paths-ignore:
10+
- '*.md'
11+
- '*.png'
12+
- '*.gitignore'
13+
14+
env:
15+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
16+
DOTNET_CLI_TELEMETRY_OPTOUT: true
17+
18+
jobs:
19+
build-and-test:
20+
name: Build & Test
21+
runs-on: windows-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
lfs: true
29+
30+
- name: Setup .NET SDK
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: |
34+
6.0.x
35+
8.0.x
36+
37+
- name: Setup .NET nanoFramework build components
38+
uses: nanoframework/nanobuild@v1
39+
with:
40+
workload: 'nanoFramework'
41+
42+
- name: Build, Test and Pack
43+
shell: pwsh
44+
run: |
45+
./Build/build.ps1 -IncludeNanoFramework
46+
working-directory: ${{ github.workspace }}
47+
48+
- name: Upload Test Results
49+
uses: actions/upload-artifact@v4
50+
if: always()
51+
with:
52+
name: test-results
53+
path: Artifacts/TestResults/*.trx
54+
retention-days: 7
55+
56+
- name: Publish Test Results
57+
uses: EnricoMi/publish-unit-test-result-action/windows@v2
58+
if: always()
59+
with:
60+
files: |
61+
Artifacts/TestResults/*.trx
62+
check_name: Test Results
63+
comment_mode: off
64+
65+
- name: Upload to codecov.io
66+
shell: pwsh
67+
env:
68+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
69+
run: |
70+
Write-Host -Foreground Green "Downloading codecov binaries..."
71+
72+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
73+
gpg.exe --import codecov.asc
74+
75+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
76+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
77+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
78+
79+
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
80+
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
81+
82+
Write-Host -Foreground Green "Uploading to codecov..."
83+
84+
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "${{ github.run_number }}"
85+
86+
Write-Host -Foreground Green "✅ Uploaded to codecov."
87+
88+
- name: Upload Artifacts
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: artifacts
92+
path: Artifacts/
93+
retention-days: 7

GITHUB_ACTIONS_MIGRATION_README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# GitHub Actions Migration
2+
3+
This PR adds GitHub Actions workflows to run alongside the existing Azure Pipelines configuration.
4+
5+
## Files to Move
6+
7+
Due to GitHub App permission restrictions, the workflow files are created in the root directory. Please move these files to `.github/workflows/` after merging:
8+
9+
1. `github-actions-ci.yml``.github/workflows/ci.yml`
10+
2. `github-actions-pr.yml``.github/workflows/pr.yml`
11+
12+
## Key Features
13+
14+
### CI Workflow (ci.yml)
15+
- Triggers on pushes to master, release/*, and maintenance/* branches
16+
- Builds with .NET nanoFramework support using `nanoframework/nanobuild@v1` action
17+
- Runs tests and uploads coverage to codecov.io
18+
- Publishes NuGet packages to nuget.org (only on master branch)
19+
- Uses Windows runner to match Azure Pipelines configuration
20+
21+
### PR Workflow (pr.yml)
22+
- Triggers on pull requests to master, release/*, and maintenance/* branches
23+
- Same build and test process as CI workflow
24+
- Publishes test results as PR checks
25+
- Uploads test coverage to codecov.io
26+
- No NuGet publishing for PRs
27+
28+
## .NET nanoFramework Support
29+
30+
The key challenge mentioned in the issue was .NET nanoFramework support. This is handled using the `nanoframework/nanobuild@v1` GitHub Action, which is the official GitHub Actions equivalent of the Azure Pipelines `InstallNanoMSBuildComponents@1` task.
31+
32+
## Migration Notes
33+
34+
- Both workflows use the existing PowerShell build script (`Build/build.ps1`) with the `-IncludeNanoFramework` flag
35+
- Secrets needed: `CODECOV_TOKEN` and `NUGET_ORG_APIKEY` (should already be configured)
36+
- The workflows are designed to run alongside Azure Pipelines for comparison
37+
- Azure Pipelines configuration files remain unchanged as requested
38+
39+
## Next Steps
40+
41+
1. Move the workflow files to `.github/workflows/`
42+
2. Test both workflows to ensure they work correctly
43+
3. Compare results with Azure Pipelines
44+
4. Make any necessary adjustments based on testing

0 commit comments

Comments
 (0)