Repository navigation
180 lines (159 loc) · 6.87 KB
/
Copy pathpack.yml
File metadata and controls
180 lines (159 loc) · 6.87 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Pack
# Builds every package a release ships: two Native AOT tool packages per runtime identifier, each
# smoke-tested on a matching runner, plus the libraries, the framework-dependent fallback packages,
# and the pointer packages. publish.yml calls it for a tag. It also runs on pull requests that
# change packaging, so every native build is proven before a release depends on it.
on:
workflow_call:
inputs:
ref:
description: Git ref to check out (the release tag).
required: true
type: string
version:
description: Package version.
required: true
type: string
pull_request:
paths:
- .github/workflows/pack.yml
- .github/actions/native-tool-smoke/**
- .github/scripts/native-tool-smoke.sh
- .github/scripts/verify-packages.sh
- .github/scripts/set-server-json-version.sh
- src/**/*.csproj
- src/ProjGraph.Mcp/.mcp/server.json
- tests/ProjGraph.Tests.Smoke.Aot/**
- ProjGraph.slnx
- Directory.Build.props
- Directory.Packages.props
- global.json
permissions:
contents: read
# Inside workflow_call, github.ref is the caller's ref, which for a dispatched release is the branch it
# ran from, so the group uses the release tag to keep runs for different tags apart.
concurrency:
group: pack-${{ github.event_name }}-${{ inputs.ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Pull request runs have no version input; any version works as long as every command uses it.
VERSION: ${{ inputs.version || format('0.0.0-ci.{0}', github.run_number) }}
jobs:
pack-native:
name: pack-native (${{ matrix.rid }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- rid: win-x64
runner: windows-latest
- rid: linux-x64
runner: ubuntu-latest
- rid: linux-arm64
runner: ubuntu-24.04-arm
- rid: linux-musl-x64
runner: ubuntu-latest
- rid: linux-musl-arm64
runner: ubuntu-24.04-arm
- rid: osx-arm64
runner: macos-latest
steps:
- uses: actions/checkout@v7
with:
# The release tag when called from publish.yml; the pull request's merge commit otherwise.
ref: ${{ inputs.ref || github.sha }}
- name: Pack and smoke test the native tools
uses: ./.github/actions/native-tool-smoke
with:
rid: ${{ matrix.rid }}
version: ${{ env.VERSION }}
- name: Verify the native packages
shell: bash
env:
RID: ${{ matrix.rid }}
run: bash .github/scripts/verify-packages.sh artifacts/packages "$VERSION" "$RID"
- name: Upload native packages
uses: actions/upload-artifact@v7
with:
name: packages-${{ matrix.rid }}
path: artifacts/packages/*.nupkg
if-no-files-found: error
retention-days: 7
pack-portable:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
# The release tag when called from publish.yml; the pull request's merge commit otherwise.
ref: ${{ inputs.ref || github.sha }}
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
cache: true
cache-dependency-path: Directory.Packages.props
- name: Build
run: |
dotnet restore ProjGraph.slnx
dotnet build ProjGraph.slnx --no-restore --configuration Release -p:Version="$VERSION"
- name: Stamp the MCP server.json version
run: bash .github/scripts/set-server-json-version.sh "$VERSION"
# With PublishAot set, packing the solution produces the RID-agnostic pointer packages for the
# two tools; they move to their own folder because publish.yml pushes them last.
- name: Pack libraries and pointer packages
run: |
dotnet pack ProjGraph.slnx --no-build --configuration Release -p:Version="$VERSION" --output artifacts/packages
mkdir -p artifacts/pointers
mv "artifacts/packages/ProjGraph.Cli.$VERSION.nupkg" "artifacts/packages/ProjGraph.Mcp.$VERSION.nupkg" artifacts/pointers/
- name: Pack framework-dependent fallback packages
run: |
dotnet pack src/ProjGraph.Cli --configuration Release --runtime any -p:PublishAot=false -p:Version="$VERSION" --output artifacts/packages
dotnet pack src/ProjGraph.Mcp --configuration Release --runtime any -p:PublishAot=false -p:Version="$VERSION" --output artifacts/packages
- name: Verify the portable packages
run: |
bash .github/scripts/verify-packages.sh artifacts/packages "$VERSION" libraries any
bash .github/scripts/verify-packages.sh artifacts/pointers "$VERSION" pointers
# The fallback packages are JIT builds, so the native-build guard is filtered out; every parity
# test still runs them against the JIT build of the same commit.
- name: Smoke test the fallback packages
env:
PROJGRAPH_SMOKE_REQUIRED: 'true'
PROJGRAPH_SMOKE_CLI_NATIVE: artifacts/fallback/cli/tools/net10.0/any/ProjGraph.Cli.dll
PROJGRAPH_SMOKE_CLI_REFERENCE: src/ProjGraph.Cli/bin/Release/net10.0/ProjGraph.Cli.dll
PROJGRAPH_SMOKE_MCP_NATIVE: artifacts/fallback/mcp/tools/net10.0/any/ProjGraph.Mcp.dll
PROJGRAPH_SMOKE_MCP_REFERENCE: src/ProjGraph.Mcp/bin/Release/net10.0/ProjGraph.Mcp.dll
run: |
mkdir -p artifacts/fallback
unzip -q "artifacts/packages/ProjGraph.Cli.any.$VERSION.nupkg" -d artifacts/fallback/cli
unzip -q "artifacts/packages/ProjGraph.Mcp.any.$VERSION.nupkg" -d artifacts/fallback/mcp
dotnet test tests/ProjGraph.Tests.Smoke.Aot --no-build --configuration Release \
--filter "FullyQualifiedName!~ProjGraph.Tests.Smoke.Aot.NativeBuildGuardTests" \
--logger "console;verbosity=normal" --logger "trx;LogFileName=fallback-smoke.trx" \
--results-directory artifacts/smoke-results
- name: Upload fallback smoke test results
if: failure()
uses: actions/upload-artifact@v7
with:
name: smoke-results-portable
path: artifacts/smoke-results
if-no-files-found: ignore
retention-days: 14
- name: Upload libraries and fallback packages
uses: actions/upload-artifact@v7
with:
name: packages-portable
path: |
artifacts/packages/*.nupkg
artifacts/packages/*.snupkg
if-no-files-found: error
retention-days: 7
- name: Upload pointer packages
uses: actions/upload-artifact@v7
with:
name: pointers
path: artifacts/pointers/*.nupkg
if-no-files-found: error
retention-days: 7