Skip to content

Commit 5ff026f

Browse files
authored
Merge pull request #3 from jongalloway/ci-setup
Add CI workflow, Dependabot, and SDK pin
2 parents 2f1e554 + 781f8e5 commit 5ff026f

3 files changed

Lines changed: 114 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Dependabot configuration.
2+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
7+
# NuGet packages — Central Package Management means Directory.Packages.props at
8+
# the repo root is the single source of truth. One PR per bump, grouped by minor/patch
9+
# so the Tuesday update is one PR not seven.
10+
- package-ecosystem: nuget
11+
directory: /
12+
schedule:
13+
interval: weekly
14+
day: tuesday
15+
open-pull-requests-limit: 5
16+
groups:
17+
minor-and-patch:
18+
update-types: [minor, patch]
19+
commit-message:
20+
prefix: deps
21+
labels: [dependencies, nuget]
22+
23+
# GitHub Actions used in workflows. Keeps action SHAs/versions current —
24+
# matters for supply-chain hygiene and deprecation warnings.
25+
- package-ecosystem: github-actions
26+
directory: /
27+
schedule:
28+
interval: weekly
29+
day: tuesday
30+
commit-message:
31+
prefix: ci
32+
labels: [dependencies, ci]

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
# Cancel superseded runs on the same PR/branch — saves minutes when pushing fixups.
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build-test:
20+
runs-on: ubuntu-latest
21+
22+
env:
23+
DOTNET_NOLOGO: true
24+
DOTNET_CLI_TELEMETRY_OPTOUT: true
25+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
26+
# Belt-and-braces: the snapshot suite already refuses UPDATE_SNAPSHOTS when
27+
# CI is detected, but pin it off explicitly so a stray env var on the agent
28+
# can't auto-accept baselines.
29+
UPDATE_SNAPSHOTS: '0'
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Set up .NET
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
# Reads global.json for the resolved version; cache keys off the CPM lock.
39+
global-json-file: global.json
40+
cache: true
41+
cache-dependency-path: Directory.Packages.props
42+
43+
- name: Restore
44+
run: dotnet restore DiagramForge.slnx
45+
46+
- name: Build
47+
run: dotnet build DiagramForge.slnx --no-restore --configuration Release
48+
49+
- name: Test
50+
run: >
51+
dotnet test DiagramForge.slnx
52+
--no-build
53+
--configuration Release
54+
--logger "trx;LogFilePrefix=results"
55+
--results-directory TestResults
56+
57+
# Upload the snapshot .actual.svg gallery even (especially) when tests fail —
58+
# that's when you most want to eyeball the rendered output.
59+
- name: Upload rendered snapshots
60+
if: always()
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: snapshots
64+
path: artifacts/test-results/snapshots/
65+
if-no-files-found: ignore
66+
retention-days: 7
67+
68+
- name: Upload test results
69+
if: always()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: test-results
73+
path: TestResults/
74+
if-no-files-found: warn
75+
retention-days: 7

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "10.0.100",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": true
6+
}
7+
}

0 commit comments

Comments
 (0)