Skip to content

Commit dfbbaa1

Browse files
mcpolo99RandomCrocodile
andauthored
develop: branch conventions, CI optimization, commit format (#83)
* feat: retarget ConfuserEx from .NET Framework 4.6.1 to .NET 10 (#71) * perf(ci): eliminate duplicate build — test workflow reuses CI build output (#78) Before: ci.yml and test.yml each did a full MSBuild restore + build (~4 min each) After: ci.yml builds + uploads artifacts, test.yml downloads and runs tests only Changes: - ci.yml: add build-output artifact upload (1-day retention) - ci.yml: add paths-ignore (skip on docs-only changes) - ci.yml: add concurrency (cancel in-progress on new push) - test.yml: trigger on workflow_run (waits for CI completion) - test.yml: download build-output instead of building - test.yml: no more restore/build steps - format.yml: only trigger when .cs/.vb/.editorconfig files change Saves ~4 min of Windows runner time per push by not building twice. All 3 workflows remain separate with their own status checks. Co-authored-by: RandomCrocodile <mawi@polosab.com> * fix(ci): update CodeQL to windows-2025 for MSBuild 18 / .NET 10 support CodeQL was still on windows-2022 (MSBuild 17) which can't resolve .NET 10 SDK from global.json. Also removed obsolete .NET 4.6.1 targeting pack install (net48 doesn't need it) and bumped checkout to v5. * chore: update repo references from mkaring to mcpolo99/ConfuserExx - Issue template config: point discussions to our repo, add Ideas + General links - CODEOWNERS: mkaring → mcpolo99 - FUNDING.yml: mkaring → mcpolo99 - MSBuild.Tasks PackageProjectUrl: point to our repo - Test [Trait("Issue")] attributes kept as upstream attribution (historical) * fix(ci): revert test workflow to direct triggers for reliable PR comments workflow_run doesn't associate with PRs reliably — test results and coverage comments were not posted on PR #79. Reverted to direct push/pull_request triggers with its own build step. Still optimized with: - paths-ignore (skip on docs-only changes) - concurrency (cancel in-progress on new push) - NuGet cache (shared cache key with ci.yml) - Removed build-output artifact from ci.yml (no longer needed) * chore: adopt GitHub branch conventions — master→main, pre-release→develop (#82) * chore: rename master→main, pre-release→develop, adopt GitHub branch conventions Branch renames: - master → main (default branch) - pre-release → develop (integration branch) All references updated: - ci.yml: triggers, release jobs, dev-release job (was pre-release) - test.yml, format.yml, codeql-analysis.yml: branch triggers - dependabot.yml: target branch - README.md: contributing section, CI badge - CONTRIBUTING.md: branch naming convention, PR target New branch naming convention (documented in CONTRIBUTING.md): - Issue-linked: {number}-{slug} via gh issue develop - Feature: feature/{description} - Chore: chore/{description} - Docs: docs/{description} - Hotfix: hotfix/{description} (from main) - Experiment: experiment/{description} * feat(ci): lightweight lint on push, full CI on PR only (#81) New workflow layout: - lint.yml (NEW): every push + PR — format + style + Roslyn analyzers without building. Posts results to PR comment or issue comment (parses issue number from branch name). ~2 min. - ci.yml: PR + main/develop push only — full build + package - test.yml: PR only — full build + test + coverage - codeql: weekly (Mon 3am, skips if no commits) + manual trigger - format.yml: DELETED — replaced by lint.yml Cost per event: - Feature branch push: ~2 min (was ~9 min) — 77% reduction - PR: ~11 min (lint + ci + test, unchanged) - Merge to main: ~5 min (ci only) - CodeQL: weekly conditional, not on every push/PR --------- Co-authored-by: RandomCrocodile <mawi@polosab.com> * docs: update commit convention to match branch naming — full words, no scopes --------- Co-authored-by: RandomCrocodile <mawi@polosab.com>
1 parent 599f3af commit dfbbaa1

7 files changed

Lines changed: 242 additions & 45 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7-
target-branch: "master"
7+
target-branch: "develop"
88
ignore:
99
- dependency-name: "Microsoft.Build.Tasks.Core"
1010
versions: ["16.*"]

.github/workflows/ci.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: ci
22

33
on:
44
push:
5-
branches: [master, pre-release, feature/**, fix/**]
5+
branches: [main, develop]
66
paths-ignore: ['**.md', 'docs/**', 'LICENSE*']
77
pull_request:
8-
branches: [master, pre-release]
8+
branches: [main, develop]
99
paths-ignore: ['**.md', 'docs/**', 'LICENSE*']
1010

1111
concurrency:
@@ -89,10 +89,10 @@ jobs:
8989
ConfuserEx.zip
9090
Confuser.MSBuild.Tasks/bin/Release/*.nupkg
9191
92-
# Pre-release: on push to pre-release branch
93-
pre-release:
92+
# Dev build: on push to develop branch
93+
dev-release:
9494
needs: build
95-
if: github.event_name == 'push' && github.ref == 'refs/heads/pre-release'
95+
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
9696
runs-on: windows-2025
9797
timeout-minutes: 5
9898
permissions:
@@ -111,25 +111,24 @@ jobs:
111111
run: |
112112
$ver = nbgv get-version -v NuGetPackageVersion
113113
echo "VERSION=$ver" >> $env:GITHUB_OUTPUT
114-
Write-Host "Pre-release version: $ver"
115114
116115
- name: Download artifacts
117116
uses: actions/download-artifact@v5
118117
with:
119118
name: confuserex-packages
120119

121-
- name: Create or update pre-release
120+
- name: Create or update dev release
122121
uses: softprops/action-gh-release@v2
123122
with:
124-
tag_name: pre-release
125-
name: "Pre-release v${{ steps.version.outputs.VERSION }}"
123+
tag_name: dev-latest
124+
name: "Dev build v${{ steps.version.outputs.VERSION }}"
126125
prerelease: true
127126
make_latest: false
128127
body: |
129-
**Pre-release build** — for testing only, not production use.
128+
**Development build** — for testing only, not production use.
130129
131130
Version: `${{ steps.version.outputs.VERSION }}`
132-
Branch: `pre-release`
131+
Branch: `develop`
133132
Commit: ${{ github.sha }}
134133
135134
Download the binaries below to test recent fixes and features before they are included in a stable release.
@@ -139,10 +138,10 @@ jobs:
139138
ConfuserEx.zip
140139
*.nupkg
141140
142-
# Release: only on PR merge to master
141+
# Release: only on PR merge to main
143142
release:
144143
needs: build
145-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
144+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
146145
runs-on: windows-2025
147146
timeout-minutes: 5
148147
permissions:
@@ -161,7 +160,6 @@ jobs:
161160
run: |
162161
$ver = nbgv get-version -v NuGetPackageVersion
163162
echo "VERSION=$ver" >> $env:GITHUB_OUTPUT
164-
Write-Host "Version: $ver"
165163
166164
- name: Configure git identity
167165
run: |
Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,56 @@
11
name: "CodeQL"
22

33
on:
4-
push:
5-
branches: [master, release/*]
6-
pull_request:
7-
branches: [master]
84
schedule:
9-
- cron: "26 4 * * 0"
5+
- cron: "0 3 * * 1" # Every Monday 3am UTC
6+
workflow_dispatch: # Manual trigger from Actions tab
107

118
permissions:
129
contents: read
1310
security-events: write
14-
pull-requests: read
1511
actions: read
1612

1713
jobs:
1814
analyze:
1915
name: Analyze
2016
runs-on: windows-2025
2117

22-
strategy:
23-
fail-fast: false
24-
2518
steps:
2619
- name: Checkout repository
2720
uses: actions/checkout@v5
2821
with:
2922
fetch-depth: 0
30-
submodules: recursive
23+
24+
- name: Check for recent commits
25+
id: check
26+
shell: pwsh
27+
run: |
28+
$count = (git log --oneline --since="7 days ago" | Measure-Object).Count
29+
echo "has_changes=$($count -gt 0)" >> $env:GITHUB_OUTPUT
30+
Write-Host "Commits in last 7 days: $count"
3131
3232
- name: Initialize CodeQL
33+
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
3334
uses: github/codeql-action/init@v3
3435
with:
3536
languages: csharp
3637

3738
- name: Setup MSBuild
39+
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
3840
uses: microsoft/setup-msbuild@v2
3941

4042
- name: Restore
43+
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
4144
run: msbuild Confuser2.sln -t:Restore -verbosity:minimal
4245

4346
- name: Build
47+
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
4448
run: msbuild Confuser2.sln -p:Configuration=Release -verbosity:minimal
4549

4650
- name: Perform CodeQL Analysis
51+
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
4752
uses: github/codeql-action/analyze@v3
53+
54+
- name: Skip notice
55+
if: steps.check.outputs.has_changes != 'True' && github.event_name != 'workflow_dispatch'
56+
run: echo "No commits in the last 7 days — skipping analysis."

.github/workflows/lint.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
paths-ignore: ['**.md', 'docs/**', 'LICENSE*']
6+
pull_request:
7+
branches: [main, develop]
8+
paths-ignore: ['**.md', 'docs/**', 'LICENSE*']
9+
10+
concurrency:
11+
group: lint-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint:
16+
runs-on: windows-2025
17+
timeout-minutes: 5
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
issues: write
22+
env:
23+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- name: Cache NuGet packages
28+
uses: actions/cache@v4
29+
with:
30+
path: ${{ github.workspace }}/.nuget/packages
31+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.vcxproj') }}
32+
restore-keys: |
33+
${{ runner.os }}-nuget-
34+
35+
- name: Restore
36+
run: dotnet restore Confuser2.sln
37+
38+
- name: Check whitespace
39+
id: whitespace
40+
run: dotnet format whitespace Confuser2.sln --verify-no-changes --verbosity minimal 2>&1 | Tee-Object -Variable wsOutput
41+
shell: pwsh
42+
continue-on-error: true
43+
44+
- name: Check style
45+
id: style
46+
run: dotnet format style Confuser2.sln --verify-no-changes --severity warn 2>&1 | Tee-Object -Variable styleOutput
47+
shell: pwsh
48+
continue-on-error: true
49+
50+
- name: Check analyzers
51+
id: analyzers
52+
run: dotnet format analyzers Confuser2.sln --verify-no-changes --severity warn 2>&1 | Tee-Object -Variable analyzerOutput
53+
shell: pwsh
54+
continue-on-error: true
55+
56+
- name: Build lint report
57+
if: always()
58+
id: report
59+
shell: pwsh
60+
run: |
61+
$ws = '${{ steps.whitespace.outcome }}'
62+
$st = '${{ steps.style.outcome }}'
63+
$an = '${{ steps.analyzers.outcome }}'
64+
$anyFailed = ($ws -eq 'failure') -or ($st -eq 'failure') -or ($an -eq 'failure')
65+
66+
$md = @()
67+
$md += '## Lint Results'
68+
$md += ''
69+
70+
if (-not $anyFailed) {
71+
$md += '> :white_check_mark: **All checks passed**'
72+
} else {
73+
$md += '> :warning: **Issues found** — run `dotnet format Confuser2.sln` locally to fix'
74+
}
75+
76+
$md += ''
77+
$md += '| Check | Result |'
78+
$md += '|-------|--------|'
79+
80+
$icon = if ($ws -eq 'success') { ':white_check_mark:' } else { ':x:' }
81+
$md += "| Whitespace (indentation, line endings) | $icon |"
82+
83+
$icon = if ($st -eq 'success') { ':white_check_mark:' } else { ':x:' }
84+
$md += "| Style (IDE rules, naming, var usage) | $icon |"
85+
86+
$icon = if ($an -eq 'success') { ':white_check_mark:' } else { ':x:' }
87+
$md += "| Analyzers (CA*, RCS* rules) | $icon |"
88+
89+
# Get specific violations if any failed
90+
if ($anyFailed) {
91+
$md += ''
92+
$md += '<details><summary><strong>Details (click to expand)</strong></summary>'
93+
$md += ''
94+
$md += '```'
95+
# Re-run to capture output
96+
$violations = dotnet format Confuser2.sln --verify-no-changes --verbosity diagnostic 2>&1 | Select-String 'error|warning' | Select-Object -First 30
97+
foreach ($v in $violations) { $md += $v.ToString().Trim() }
98+
if ($violations.Count -ge 30) { $md += '... (truncated, run dotnet format locally for full list)' }
99+
$md += '```'
100+
$md += ''
101+
$md += '</details>'
102+
}
103+
104+
$md -join "`n" | Set-Content -Path 'lint-report.md' -Encoding utf8
105+
$md -join "`n" >> $env:GITHUB_STEP_SUMMARY
106+
107+
echo "any_failed=$anyFailed" >> $env:GITHUB_OUTPUT
108+
109+
- name: Post PR comment
110+
if: always() && github.event_name == 'pull_request'
111+
uses: marocchino/sticky-pull-request-comment@v2
112+
with:
113+
header: lint-report
114+
path: lint-report.md
115+
116+
- name: Post issue comment
117+
if: always() && github.event_name == 'push' && github.event.pull_request == null
118+
shell: pwsh
119+
run: |
120+
# Extract issue number from branch name (e.g. 54-nuget-packages → 54)
121+
$branch = "${{ github.ref_name }}"
122+
if ($branch -match '^(\d+)-') {
123+
$issueNumber = $Matches[1]
124+
$marker = '<!-- lint-bot -->'
125+
$body = $marker + "`n" + (Get-Content 'lint-report.md' -Raw)
126+
127+
# Find existing lint comment
128+
$comments = gh api "repos/${{ github.repository }}/issues/$issueNumber/comments" --jq '.[] | select(.body | startswith("<!-- lint-bot -->")) | .id' 2>$null
129+
if ($comments) {
130+
# Update existing
131+
gh api "repos/${{ github.repository }}/issues/comments/$comments" -X PATCH -f body="$body" 2>$null
132+
} else {
133+
# Create new
134+
gh issue comment $issueNumber --repo ${{ github.repository }} --body "$body" 2>$null
135+
}
136+
}
137+
env:
138+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
140+
- name: Fail if issues found
141+
if: always() && steps.report.outputs.any_failed == 'True'
142+
shell: pwsh
143+
run: |
144+
Write-Host "::warning::Lint issues found. Run 'dotnet format Confuser2.sln' locally to fix."
145+
exit 1

.github/workflows/test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: test
22

33
on:
4-
push:
5-
branches: [master, pre-release, feature/**, fix/**]
6-
paths-ignore: ['**.md', 'docs/**', 'LICENSE*']
74
pull_request:
8-
branches: [master, pre-release]
5+
branches: [main, develop]
96
paths-ignore: ['**.md', 'docs/**', 'LICENSE*']
107

118
concurrency:

0 commit comments

Comments
 (0)