Skip to content

Commit 415bbce

Browse files
bdukesdonker
andauthored
Add CI build via GitHub Actions (#7108)
Co-authored-by: Peter Donker <[email protected]>
1 parent 36c6285 commit 415bbce

3 files changed

Lines changed: 137 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: "Build and Validate"
2+
3+
env:
4+
CAKE_TARGET: "BuildAll"
5+
CAKE_VERBOSITY: "Normal"
6+
RELEASE_MODE: "Beta"
7+
RUN_TESTS: "true"
8+
9+
permissions:
10+
checks: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
on:
18+
push:
19+
branches:
20+
- "develop"
21+
- "release/*"
22+
pull_request:
23+
branches:
24+
- "develop"
25+
- "release/*"
26+
workflow_dispatch:
27+
inputs:
28+
CAKE_TARGET:
29+
description: "Cake Target"
30+
type: "string"
31+
default: "BuildAll"
32+
CAKE_VERBOSITY:
33+
description: "Cake Verbosity"
34+
type: "choice"
35+
default: "Normal"
36+
options:
37+
- "Quiet"
38+
- "Minimal"
39+
- "Normal"
40+
- "Verbose"
41+
- "Diagnostic"
42+
RELEASE_MODE:
43+
description: "Release Mode"
44+
type: "choice"
45+
default: "Beta"
46+
options:
47+
- "Alpha"
48+
- "Beta"
49+
- "RC"
50+
- "Stable"
51+
RUN_TESTS:
52+
description: "Run Tests?"
53+
type: boolean
54+
default: true
55+
56+
jobs:
57+
build-and-validate:
58+
name: "Build and Validate"
59+
runs-on: "windows-2025-vs2026"
60+
defaults:
61+
run:
62+
shell: "pwsh"
63+
steps:
64+
- name: "Checkout"
65+
uses: "actions/[email protected]"
66+
67+
# Built-in caching is broken for Yarn, using setup-node twice
68+
# See https://github.com/actions/setup-node/issues/531#issuecomment-3335630863
69+
- name: "Setup Node.js"
70+
uses: "actions/[email protected]"
71+
with:
72+
node-version-file: ".node-version"
73+
package-manager-cache: false
74+
75+
- name: "Enable Corepack"
76+
run: "corepack enable"
77+
78+
- name: "Setup Yarn cache"
79+
uses: "actions/[email protected]"
80+
with:
81+
cache: "yarn"
82+
83+
- name: "Setup .NET SDK"
84+
uses: "actions/[email protected]"
85+
with:
86+
global-json-file: "global.json"
87+
88+
- name: "Initialize Git User"
89+
run: |
90+
git config --global user.email '[email protected]';
91+
git config --global user.name 'DNN Platform CI Bot';
92+
93+
- name: "Update Alpha/Beta/Stable flag"
94+
run: |
95+
$path = '.\DNN Platform\Library\Properties\AssemblyInfo.cs'
96+
$pattern3 = '\[assembly: AssemblyStatus'
97+
(Get-Content $path) | ForEach-Object {
98+
if ($_ -match $pattern3) {
99+
# We have found the matching line
100+
'[assembly: AssemblyStatus(ReleaseMode.{0})]' -f '${{ env.RELEASE_MODE }}'
101+
} else {
102+
$_
103+
}
104+
} | Set-Content $path
105+
106+
- name: "Run DNN Build via Cake"
107+
run: "./build.ps1 --target=${{ env.CAKE_TARGET }} --verbosity=${{ env.CAKE_VERBOSITY }}"
108+
109+
- name: "Run Unit Tests via Cake"
110+
if: ${{ env.RUN_TESTS == 'true' }}
111+
run: "./build.ps1 --target=UnitTests --verbosity=${{ env.CAKE_VERBOSITY }}"
112+
continue-on-error: true
113+
114+
- name: "Publish Test Results"
115+
uses: "EnricoMi/publish-unit-test-result-action/[email protected]"
116+
if: ${{ !cancelled() && env.RUN_TESTS == 'true' }}
117+
with:
118+
files: "**/TestResults/*.trx"
119+
action_fail: true
120+
121+
- name: "Publish Artifacts"
122+
uses: "actions/[email protected]"
123+
if: ${{ !cancelled() }}
124+
with:
125+
path: "Artifacts"
126+
if-no-files-found: "error"
127+
compression-level: "0"
128+
overwrite: true
129+
130+
- name: "Create GitHub Pull Request"
131+
if: ${{ success() && !contains('pull_request', github.event_name) && (contains(fromJSON('["develop", "main"]'), github.ref_name) || startsWith('release/', github.ref_name)) }}
132+
run: "./build.ps1 --target=CreateGitHubPullRequest --verbosity=${{ env.CAKE_VERBOSITY }}"
133+
env:
134+
GITHUB_APP_ID: ${{ secrets.GITHUB_APP_ID }}
135+
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/*

DNN_Platform.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
139139
settings.local.json = settings.local.json
140140
SolutionInfo.cs = SolutionInfo.cs
141141
stylecop.json = stylecop.json
142+
.node-version = .node-version
142143
EndProjectSection
143144
EndProject
144145
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetNuke.Tests.Integration", "DNN Platform\Tests\DotNetNuke.Tests.Integration\DotNetNuke.Tests.Integration.csproj", "{6629A64D-58B9-48B9-B932-15AF193C2212}"

0 commit comments

Comments
 (0)