-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (67 loc) · 3.05 KB
/
Copy pathci.yml
File metadata and controls
75 lines (67 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: CI
on:
push:
branches: ["**"]
pull_request:
# Lets a run be started by hand. Push events are not always delivered — during a
# GitHub Actions incident they are dropped silently rather than queued, leaving
# commits unverified with no failed run to notice.
workflow_dispatch:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Build solution (including WPF via EnableWindowsTargeting)
run: dotnet build TaskTracker.sln -c Release -p:EnableWindowsTargeting=true
- name: Test
run: dotnet test TaskTracker.Core.Tests -c Release --no-build
# Runs after the build so a compile error reports as a compile error rather than
# as a formatting failure. `dotnet format` takes no -p: properties, so the WPF
# head's targeting override goes through the environment, which MSBuild reads
# as a property.
- name: Format
run: dotnet format TaskTracker.sln --verify-no-changes --no-restore
env:
EnableWindowsTargeting: true
# An installed `tasktracker-mcp` is a snapshot, and `dotnet tool update` no-ops on an
# equal version — so shipping a behaviour change without bumping <Version> leaves every
# consumer silently on old code, with no error anywhere to notice. This is the only
# part of that failure mode a machine can catch.
version-bump:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Require a <Version> bump when the server or Core changes
env:
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
# Comment-only edits elsewhere should not trip this, so only .cs counts.
if ! git diff --name-only "$BASE" "$HEAD" \
| grep -qE '^TaskTracker\.(Mcp|Core)/.*\.cs$'; then
echo "No server or Core code changed; no bump needed."
exit 0
fi
if git log --format=%B "$BASE..$HEAD" | grep -qF '[skip version]'; then
echo "Bump waived by [skip version] in a commit message."
exit 0
fi
csproj=TaskTracker.Mcp/TaskTracker.Mcp.csproj
before=$(git show "$BASE:$csproj" | sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p')
after=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' "$csproj")
if [ "$before" = "$after" ]; then
echo "::error::TaskTracker.Mcp or TaskTracker.Core changed but <Version> is still $after."
echo "Bump it in TaskTracker.Mcp/TaskTracker.Mcp.csproj (patch = fix, minor = new tool,"
echo "major = removed/renamed tool or changed response shape), or add [skip version] to a"
echo "commit message if this genuinely does not affect the published tool."
exit 1
fi
echo "Version bumped $before -> $after."