Skip to content

Commit 9bd3827

Browse files
committed
Updating CI to support building and publishing per RID tools
1 parent c93ac90 commit 9bd3827

5 files changed

Lines changed: 61 additions & 64 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ jobs:
2828
./artifacts/pkg/**/*
2929
./artifacts/tst/**/*
3030
if-no-files-found: error
31-
linux-x64:
32-
runs-on: ${{ matrix.os }}-latest
31+
windows-arm64:
32+
runs-on: ${{ matrix.os }}-11-arm
3333
strategy:
3434
matrix:
35-
architecture: [ x64 ]
35+
architecture: [ arm64 ]
3636
configuration: [ debug, release ]
37-
os: [ ubuntu ]
37+
os: [ windows ]
3838
steps:
3939
- uses: actions/checkout@v4
40-
- run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }}
41-
shell: bash
40+
- run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }}
41+
shell: cmd
4242
- uses: actions/upload-artifact@v4
4343
with:
4444
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
@@ -48,13 +48,13 @@ jobs:
4848
./artifacts/pkg/**/*
4949
./artifacts/tst/**/*
5050
if-no-files-found: error
51-
macos-arm64:
51+
linux-x64:
5252
runs-on: ${{ matrix.os }}-latest
5353
strategy:
5454
matrix:
55-
architecture: [ arm64 ]
55+
architecture: [ x64 ]
5656
configuration: [ debug, release ]
57-
os: [ macos ]
57+
os: [ ubuntu ]
5858
steps:
5959
- uses: actions/checkout@v4
6060
- run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }}
@@ -68,96 +68,78 @@ jobs:
6868
./artifacts/pkg/**/*
6969
./artifacts/tst/**/*
7070
if-no-files-found: error
71-
build-nuget-preview:
72-
runs-on: windows-latest
71+
linux-arm64:
72+
runs-on: ${{ matrix.os }}-24.04-arm
73+
strategy:
74+
matrix:
75+
architecture: [ arm64 ]
76+
configuration: [ debug, release ]
77+
os: [ ubuntu ]
7378
steps:
7479
- uses: actions/checkout@v4
75-
- run: ./scripts/cibuild.cmd -configuration release -architecture x64
76-
shell: cmd
77-
env:
78-
EXCLUDE_RUN_ID_FROM_PACKAGE: true
79-
EXCLUDE_SUFFIX_FROM_VERSION: false
80+
- run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }}
81+
shell: bash
8082
- uses: actions/upload-artifact@v4
8183
with:
82-
name: nuget_preview
84+
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
8385
path: |
8486
./artifacts/bin/**/*
8587
./artifacts/log/**/*
8688
./artifacts/pkg/**/*
8789
./artifacts/tst/**/*
8890
if-no-files-found: error
89-
sign-nuget-preview:
90-
runs-on: windows-latest
91-
if: ${{ github.event_name == 'push' }}
92-
needs: [ build-nuget-preview ]
93-
permissions:
94-
id-token: write
95-
steps:
96-
- uses: actions/checkout@v4
97-
- uses: actions/download-artifact@v4
98-
with:
99-
name: nuget_preview
100-
path: ./artifacts
101-
- uses: actions/setup-dotnet@v4
102-
with:
103-
global-json-file: ./global.json
104-
- run: dotnet tool install --tool-path ./artifacts/tools sign --version 0.9.1-beta.24170.3
105-
- run: ./artifacts/tools/sign code azure-key-vault "**/*.nupkg" --timestamp-url "http://timestamp.digicert.com" --base-directory "${{ github.workspace }}/artifacts/pkg" --file-list "${{ github.workspace }}/scripts/SignClientFileList.txt" --publisher-name ".NET Foundation" --description "ClangSharp" --description-url "https://github.com/dotnet/clangsharp" --azure-key-vault-certificate "${{ secrets.SC_KEY_VAULT_CERTIFICATE_ID }}" --azure-key-vault-client-id "${{ secrets.SC_AZURE_CLIENT_ID }}" --azure-key-vault-client-secret "${{ secrets.SC_AZURE_CLIENT_SECRET }}" --azure-key-vault-tenant-id "${{ secrets.SC_AZURE_TENANT_ID }}" --azure-key-vault-url "${{ secrets.SC_KEY_VAULT_URL }}"
106-
- uses: actions/upload-artifact@v4
107-
with:
108-
name: sign_nuget_preview
109-
path: |
110-
./artifacts/pkg/**/*
111-
if-no-files-found: error
112-
build-nuget-release:
113-
runs-on: windows-latest
91+
macos-arm64:
92+
runs-on: ${{ matrix.os }}-latest
93+
strategy:
94+
matrix:
95+
architecture: [ arm64 ]
96+
configuration: [ debug, release ]
97+
os: [ macos ]
11498
steps:
11599
- uses: actions/checkout@v4
116-
- run: ./scripts/cibuild.cmd -configuration release -architecture x64
117-
shell: cmd
118-
env:
119-
EXCLUDE_RUN_ID_FROM_PACKAGE: true
120-
EXCLUDE_SUFFIX_FROM_VERSION: true
100+
- run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }}
101+
shell: bash
121102
- uses: actions/upload-artifact@v4
122103
with:
123-
name: nuget_release
104+
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
124105
path: |
125106
./artifacts/bin/**/*
126107
./artifacts/log/**/*
127108
./artifacts/pkg/**/*
128109
./artifacts/tst/**/*
129110
if-no-files-found: error
130-
sign-nuget-release:
111+
sign-nuget:
131112
runs-on: windows-latest
132113
if: ${{ github.event_name == 'push' }}
133-
needs: [ build-nuget-release ]
114+
needs: [ windows-x64, windows-arm64, linux-x64, linux-arm64, macos-arm64 ]
134115
permissions:
135116
id-token: write
136117
steps:
137118
- uses: actions/checkout@v4
138119
- uses: actions/download-artifact@v4
139120
with:
140-
name: nuget_release
121+
merge-multiple: true
141122
path: ./artifacts
123+
pattern: "./artifacts/pkg/Release/*"
142124
- uses: actions/setup-dotnet@v4
143125
with:
144126
global-json-file: ./global.json
145127
- run: dotnet tool install --tool-path ./artifacts/tools sign --version 0.9.1-beta.24170.3
146128
- run: ./artifacts/tools/sign code azure-key-vault "**/*.nupkg" --timestamp-url "http://timestamp.digicert.com" --base-directory "${{ github.workspace }}/artifacts/pkg" --file-list "${{ github.workspace }}/scripts/SignClientFileList.txt" --publisher-name ".NET Foundation" --description "ClangSharp" --description-url "https://github.com/dotnet/clangsharp" --azure-key-vault-certificate "${{ secrets.SC_KEY_VAULT_CERTIFICATE_ID }}" --azure-key-vault-client-id "${{ secrets.SC_AZURE_CLIENT_ID }}" --azure-key-vault-client-secret "${{ secrets.SC_AZURE_CLIENT_SECRET }}" --azure-key-vault-tenant-id "${{ secrets.SC_AZURE_TENANT_ID }}" --azure-key-vault-url "${{ secrets.SC_KEY_VAULT_URL }}"
147129
- uses: actions/upload-artifact@v4
148130
with:
149-
name: sign_nuget_release
131+
name: sign_nuget
150132
path: |
151-
./artifacts/pkg/**/*
133+
./artifacts/pkg/Release/*
152134
if-no-files-found: error
153135
publish-nightlies-azure:
154136
runs-on: ubuntu-latest
155137
if: ${{ github.event_name == 'push' }}
156-
needs: [ windows-x64, linux-x64, macos-arm64, sign-nuget-preview, sign-nuget-release ]
138+
needs: [ sign-nuget ]
157139
steps:
158140
- uses: actions/download-artifact@v4
159141
with:
160-
name: windows_release_x64
142+
name: sign-nuget
161143
path: ./artifacts
162144
- uses: actions/setup-dotnet@v4
163145
with:
@@ -173,7 +155,7 @@ jobs:
173155
steps:
174156
- uses: actions/download-artifact@v4
175157
with:
176-
name: windows_release_x64
158+
name: sign-nuget
177159
path: ./artifacts
178160
- uses: actions/setup-dotnet@v4
179161
with:

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
<Company>.NET Foundation</Company>
4444
<ContinuousIntegrationBuild Condition="'$(GITHUB_RUN_ID)' != ''">true</ContinuousIntegrationBuild>
4545
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
46-
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
46+
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/$(PACKAGE_PUBLISH_MODE)</PackageOutputPath>
4747
<PackageValidationBaselineVersion>17.0.0</PackageValidationBaselineVersion>
4848
<Product>ClangSharp</Product>
4949
<RootNamespace>ClangSharp</RootNamespace>
5050
<VersionPrefix>20.1.2.2</VersionPrefix>
51-
<VersionSuffix Condition="'$(EXCLUDE_SUFFIX_FROM_VERSION)' != 'true'">rc1</VersionSuffix>
51+
<VersionSuffix Condition="'$(PACKAGE_PUBLISH_MODE)' != 'stable'">rc1</VersionSuffix>
5252
<VersionSuffix Condition="'$(GITHUB_EVENT_NAME)' == 'pull_request'">pr</VersionSuffix>
5353
</PropertyGroup>
5454

Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<!-- Settings that are only set for CI builds -->
1919
<PropertyGroup Condition="'$(GITHUB_RUN_ID)' != ''">
20-
<PackageVersion Condition="'$(EXCLUDE_RUN_ID_FROM_PACKAGE)' != 'true'">$(Version).$(GITHUB_RUN_ID)</PackageVersion>
20+
<PackageVersion Condition="'$(PACKAGE_PUBLISH_MODE)' == ''">$(Version).$(GITHUB_RUN_ID)</PackageVersion>
2121
</PropertyGroup>
2222

2323
<!-- Settings that are only set for executables -->

scripts/build.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ function Help() {
5656
}
5757

5858
function Pack() {
59-
$logFile = Join-Path -Path $LogDir -ChildPath "$configuration\pack.binlog"
60-
& dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err $properties "$solution"
59+
$logFile = Join-Path -Path $LogDir -ChildPath "$configuration\pack"
60+
& dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.binlog" /err $properties "$solution"
61+
62+
if ($ci) {
63+
& dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.preview.binlog" /err /p:PACKAGE_PUBLISH_MODE=preview $properties "$solution"
64+
& dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.stable.binlog" /err /p:PACKAGE_PUBLISH_MODE=stable $properties "$solution"
65+
}
6166

6267
if ($LastExitCode -ne 0) {
6368
throw "'Pack' failed for '$solution'"

scripts/build.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,24 @@ function Help {
115115
}
116116

117117
function Pack {
118-
logFile="$LogDir/$configuration/pack.binlog"
118+
logFile="$LogDir/$configuration/pack"
119119

120120
if [[ -z "$properties" ]]; then
121-
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "$solution"
121+
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.binlog" /err "$solution"
122122
else
123-
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "${properties[@]}" "$solution"
123+
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.binlog" /err "${properties[@]}" "$solution"
124124
fi
125125

126+
if $ci; then
127+
if [[ -z "$properties" ]]; then
128+
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.preview.binlog" /err /p:PACKAGE_PUBLISH_MODE=preview "$solution"
129+
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.stable.binlog" /err /p:PACKAGE_PUBLISH_MODE=stable "$solution"
130+
else
131+
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.preview.binlog" /err /p:PACKAGE_PUBLISH_MODE=preview "${properties[@]}" "$solution"
132+
dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile.stable.binlog" /err /p:PACKAGE_PUBLISH_MODE=stable "${properties[@]}" "$solution"
133+
fi
134+
fi
135+
126136
LASTEXITCODE=$?
127137

128138
if [ "$LASTEXITCODE" != 0 ]; then

0 commit comments

Comments
 (0)