forked from actions/runner
-
-
Notifications
You must be signed in to change notification settings - Fork 17
248 lines (248 loc) · 16.4 KB
/
nuget.yml
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: dotnet tool
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
PUBLISH_PREVIEW_TO_NUGET:
type: boolean
default: false
jobs:
package:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: GenerateConstant
run: dotnet msbuild ./dir.proj -t:GenerateConstant /p:RunnerVersion=$(Get-Content ./runnerversion) /p:PackageRuntime=any
shell: pwsh
working-directory: ./src
- name: Restore
run: dotnet restore /p:RuntimeFrameworkVersion=6.0.0
shell: pwsh
working-directory: ./src/Runner.Client
- name: Build
id: build
run: |
$d = Get-Date
$version = $("$(gh release view --repo ${{ github.server_url }}/${{ github.repository }} --json tagName -t "{{.tagName}}")".TrimStart("v") + "-preview." + $d.Year + "." + $d.Month + "." + $d.Day + "." + $d.Hour + "." + $d.Minute + "." + $d.Second + "." + $ENV:GITHUB_RUN_ID)
dotnet build --no-restore -c Release /p:BUILD_OS=Any /p:Version=$version /p:RuntimeFrameworkVersion=6.0.0
echo "version=$version" > $env:GITHUB_OUTPUT
shell: pwsh
working-directory: ./src/Runner.Client
env:
GH_TOKEN: ${{ github.token }}
- name: Pack
run: |
dotnet pack --no-restore -c Release --no-build /p:Version=${{steps.build.outputs.version}} /p:RuntimeFrameworkVersion=6.0.0 /p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }}
dotnet pack --no-restore -c Release --no-build /p:Version=${{steps.build.outputs.version}} /p:RuntimeFrameworkVersion=6.0.0 /p:LegacyDotnetTool=1 /p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }}
shell: pwsh
working-directory: ./src/Runner.Client
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nupkg
path: src/Runner.Client/nupkg
- name: Push to Nuget
if: (vars.PUBLISH_PREVIEW_TO_NUGET == 'true' && github.event_name == 'push' || inputs.PUBLISH_PREVIEW_TO_NUGET) && env.GHARUN != ''
run: dotnet nuget push ./*.nupkg --api-key $($ENV:GHARUN) --source https://api.nuget.org/v3/index.json
shell: pwsh
working-directory: ./src/Runner.Client/nupkg
env:
GHARUN: ${{secrets.GHARUN}}
- name: Push to GitHub Packages
if: ${{ github.server_url == 'https://github.com' && github.event_name == 'push' && github.ref_name == 'main' }}
run: |
dotnet nuget push ./*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols
working-directory: ./src/Runner.Client/nupkg
continue-on-error: true
test:
defaults:
run:
# It seems pwsh doesn't failfast, windows jobs succeeded with errors
shell: ${{ matrix.shell || 'bash' }}
needs:
- package
strategy:
fail-fast: false
matrix:
os:
- windows-2022
- ubuntu-latest
- macos-latest
dotnet-version:
# - '6.0.100'
- '6.0.x'
image:
- ''
include:
- os: windows-2022
tag: ltsc2022
- os: ubuntu-latest
image: mcr.microsoft.com/dotnet/sdk:6.0-alpine3.15
shell: sh
runs-on: ${{matrix.os}}
container: ${{matrix.image}}
steps:
- uses: actions/checkout@v3
- if: matrix.dotnet-version
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{matrix.dotnet-version}}
- run: mkdir src/Runner.Client/nupkg
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: nupkg
path: src/Runner.Client/nupkg
- name: Install
run: |
dotnet tool install -g Runner.Client --add-source src/Runner.Client/nupkg --version ${{needs.package.outputs.version}}
# Make shure to have Runner.Client in path in job container
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Test
run: |
set -x
Runner.Client -C testworkflows/workflowerrors || :
Runner.Client -C testworkflows/workflowerrors --trace --var system.runner.server.sendlostevents=true || :
Runner.Client -W testworkflows/testlocalcheckout.yml
Runner.Client -W testworkflows/testhashfiles.yml
Runner.Client -W testworkflows/dumpcontexts.yml
Runner.Client -W testworkflows/multiline_secrets.yml --secret-file testworkflows/multiline_secrets.secrets
Runner.Client -W testworkflows/multiline_env.yml --env-file testworkflows/multiline_secrets.secrets
Runner.Client -W testworkflows/multiline_secrets.yml --secret-file testworkflows/multiline_secrets.secrets.yaml
Runner.Client -W testworkflows/multiline_env.yml --env-file testworkflows/multiline_secrets.secrets.yaml
cd testworkflows/environment-test
Runner.Client -W sample.yml --environment-secret-file prod=prod.secrets --environment-secret-file develop=develop.yml --environment-secret-file staging=staging.yaml --environment-secret-file prod=prod.secrets
cd ../..
Runner.Client -W testworkflows/dumpcontexts.yml --list
Runner.Client -C testworkflows/case-insensitive-keys-matrix
Runner.Client -C testworkflows/matrix-eq-test --parallel 2
${{matrix.image && 'echo "Skipping additional testcases" && exit 0' || ''}}
Runner.Client -W testworkflows/cache.yml -P ubuntu-latest=-self-hosted
Runner.Client -P ubuntu-latest=-self-hosted -W testworkflows/matrixtest.yml --parallel 1
Runner.Client -W testworkflows/artifact.yml
Runner.Client -W testworkflows/issue70/main.yml
Runner.Client -W testworkflows/called.yml -e testworkflows/called_workflow_dispatch_event.json --env "input_x=Hello World 2" workflow_dispatch
Runner.Client -W testworkflows/called.yml --env "input_x=Hello World" workflow_dispatch
Runner.Client --workflow testworkflows/test_template_runs_on.yml --workflow testworkflows/called_template_runs_on.yml
Runner.Client --workflow testworkflows/test_template_runs_on2.yml --workflow testworkflows/called_template_runs_on.yml -P self-hosted,testsystem=-self-hosted
Runner.Client --workflow testworkflows/test_template_runs_on3.yml --workflow testworkflows/called_template_runs_on.yml -P testsystem2,self-hosted,testsystem=-self-hosted
Runner.Client --workflow testworkflows/test_template_runs_on3.yml --workflow testworkflows/called_template_runs_on.yml -P testsystem2,SELF-HOSTED,testsystem=-self-hosted
Runner.Client --workflow testworkflows/test_template_runs_on4.yml --workflow testworkflows/called_template_runs_on.yml -P testsystem2,self-hosted,testsystem=-self-hosted
Runner.Client --workflow testworkflows/test_template_runs_on4.yml --workflow testworkflows/called_template_runs_on.yml -P Testsystem2,SELF-hosted,TESTSYSTEM=-self-hosted
Runner.Client -W testworkflows/skippedjob.yml
Runner.Client --workflow testworkflows/test_with_required_secret.yml --workflow testworkflows/called_with_required_secret.yml
Runner.Client -W testworkflows/job-continue-on-error.yml
Runner.Client -W testworkflows/continue-on-error-bug-3.6.0-4-test.yml
Runner.Client -W testworkflows/expect-matrix-error-on-missing-exclude-key.yml && exit 1 || [[ "$?" = "1" ]]
cd testworkflows/node16_complex_reusable_workflows
Runner.Client
cd ../..
cd testworkflows/db-disposed-issue
Runner.Client -P ubuntu-latest=-self-hosted
Runner.Client -P ubuntu-latest=-self-hosted --parallel 8
cd ../..
Runner.Client -W testworkflows/test-setup-node.yml
Runner.Client -C testworkflows/actions_checkout_v1
Runner.Client -C testworkflows/case_insensitive_needs
Runner.Client -C testworkflows/inherit_secrets -s misc=topSecretVal
Runner.Client -C testworkflows/reusablesCaseInsensitive
Runner.Client -C testworkflows/workflow_dispatch workflow_dispatch -i misc=myInput -i si=UdHe -i bval=true -i bval2=false
Runner.Client -C testworkflows/workflow_dispatch workflow_dispatch -i Misc=myInput -i SI=UdHe -i bVal=true -i BVAL2=false
Runner.Client -C testworkflows/matrix-selector push -j test -m fail:false
Runner.Client -C testworkflows/oidc-provider
Runner.Client -C testworkflows/reusablesConsistentWorkflowName
Runner.Client -C testworkflows/matrix-partial-test
Runner.Client -C testworkflows/workflow_ref_and_job_workflow_ref
Runner.Client -C testworkflows/reusable-workflows-secrets-inherit-with-required-secrets -s TEST=topsecret -s OPT=testsec
Runner.Client -C testworkflows/inherit_vars --var ACTIONS_STEP_DEBUG=true
Runner.Client -C testworkflows/actions_artifacts_v4 -s ACTIONS_STEP_DEBUG=true -s ACTIONS_RUNNER_DEBUG=true --runner-version v2.311.0
Runner.Client -C testworkflows/actions_artifacts_v4 -s ACTIONS_STEP_DEBUG=true -s ACTIONS_RUNNER_DEBUG=true
Runner.Client -C testworkflows/cache-save-restore-order-tests -s ACTIONS_STEP_DEBUG=true -s ACTIONS_RUNNER_DEBUG=true
Runner.Client --event azpipelines -C testworkflows/azpipelines/cross-repo-checkout -W testworkflows/azpipelines/cross-repo-checkout/pipeline.yml --local-repository az/containermatrix@main=testworkflows/azpipelines/containermatrix
Runner.Client --event azpipelines -C testworkflows/azpipelines/typedtemplates -W testworkflows/azpipelines/typedtemplates/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/untypedtemplates -W testworkflows/azpipelines/untypedtemplates/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/stagetostagedeps -W testworkflows/azpipelines/stagetostagedeps/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/staticvars -W testworkflows/azpipelines/staticvars/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/staticvarfromcli -W testworkflows/azpipelines/staticvarfromcli/pipeline.yml --var myvar=myval --var myvarwitheq=my=val --env myenvar=myval
Runner.Client --event azpipelines -C testworkflows/azpipelines/staticvargroupfromcli -W testworkflows/azpipelines/staticvargroupfromcli/pipeline.yml --environment-var B=myvar=myval --environment-var b=myvarwitheq=my=val --environment-var C=myenvar=myval
Runner.Client --event azpipelines -C testworkflows/azpipelines/matrixgenerator -W testworkflows/azpipelines/matrixgenerator/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/matrixjoboutputs -W testworkflows/azpipelines/matrixjoboutputs/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/runoncedeployonlyoutput -W testworkflows/azpipelines/runoncedeployonlyoutput/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/runoncedeployoutput -W testworkflows/azpipelines/runoncedeployoutput/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/cross-repo-template -W testworkflows/azpipelines/cross-repo-template/pipeline.yml --local-repository az/typedtemplates@main=testworkflows/azpipelines/typedtemplates --local-repository az/untypedtemplates@main=testworkflows/azpipelines/untypedtemplates
Runner.Client --event azpipelines -C testworkflows/azpipelines/expressions-docs -W testworkflows/azpipelines/expressions-docs --var Build.SourceBranch=refs/heads/main
Runner.Client --event azpipelines -C testworkflows/azpipelines/typedtemplates-extends -W testworkflows/azpipelines/typedtemplates-extends/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/version-literal -W testworkflows/azpipelines/version-literal/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/relative-and-absolute-paths -W testworkflows/azpipelines/relative-and-absolute-paths/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/null-each-loop -W testworkflows/azpipelines/null-each-loop/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/cross-repo-relative-paths/repo1 -W testworkflows/azpipelines/cross-repo-relative-paths/repo1/pipeline.yml --local-repository central/shared@main=testworkflows/azpipelines/cross-repo-relative-paths/repo2
Runner.Client --event azpipelines -C testworkflows/azpipelines/extend-variables -W testworkflows/azpipelines/extend-variables/pipeline.yml
- name: Windows Container Change Firewall Settings
if: contains(matrix.os, 'windows') && !job.container
run: |
New-NetFirewallRule -Name Runner.Client -DisplayName Runner.Client -Enabled True -Action Allow -Direction Inbound -Program ($env:USERPROFILE + '\.dotnet\tools\Runner.Client.exe') -Protocol tcp
Get-NetFirewallProfile | Set-NetFirewallProfile -Enabled False
shell: pwsh
- name: Test Windows Container
if: contains(matrix.os, 'windows') && !job.container
run: |
set -x
Runner.Client -W testworkflows/windows.yml -P windows-latest=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
Runner.Client -W testworkflows/testlocalcheckout.yml -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
# depends on bash, therefore disabled for now
# Runner.Client -W testworkflows/artifact.yml -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
Runner.Client -W testworkflows/cachewindowscontainer.yml -P windows-latest=mcr.microsoft.com/powershell:lts-windowsservercore-${{matrix.tag}}
Runner.Client -W testworkflows/test-setup-node.yml -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
Runner.Client -C testworkflows/windows-container-test1
Runner.Client -C testworkflows/windows-container-test2
Runner.Client -C testworkflows/windows-container-test3-invalid-problem-matcher && exit 1 || [[ "$?" = "1" ]]
Runner.Client -C testworkflows/windows-add-path
Runner.Client -C testworkflows/windows-add-path -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
Runner.Client --event azpipelines -C testworkflows/azpipelines/windows-container-docs -W testworkflows/azpipelines/windows-container-docs
- name: Test Linux Container
if: contains(matrix.os, 'ubuntu') && !job.container
run: |
set -x
Runner.Client -W testworkflows/testlocalcheckout.yml -P self-hosted=ubuntu:latest
Runner.Client -W testworkflows/artifact.yml -P self-hosted=ubuntu:latest
Runner.Client -W testworkflows/cache.yml -P ubuntu-latest=ubuntu:latest
Runner.Client -W testworkflows/test-setup-node.yml -P self-hosted=ubuntu:latest
Runner.Client -C testworkflows/linux-container-problem-matcher-test1
Runner.Client -C testworkflows/linux-container-i386
Runner.Client --event azpipelines -C testworkflows/azpipelines/containermatrix -W testworkflows/azpipelines/containermatrix/pipeline.yml
Runner.Client --event azpipelines -C testworkflows/azpipelines/container-docs -W testworkflows/azpipelines/container-docs
shell: bash
- name: Test sqlite support
if: contains(matrix.os, 'ubuntu') && !job.container
run: |
mkdir Runner.Client
cd Runner.Client
unzip ../src/Runner.Client/nupkg/Runner.Client.${{needs.package.outputs.version}}.nupkg
chmod -R +rw tools/
dotnet tools/net6.0/any/Runner.Server.dll --urls http://*:5000 "--ConnectionStrings:sqlite=Data Source=Agents.db;" &
sleep 2
echo "Check for creation of sqlite db"
stat Agents.db
echo "Configure Runner"
dotnet tools/net6.0/any/Runner.Listener.dll configure --url http://localhost:5000 --token nothing
echo "Start Runner"
dotnet tools/net6.0/any/Runner.Listener.dll run&
sleep 2
echo "Send job"
cd ..
set -x
Runner.Client --server http://localhost:5000 -W testworkflows/testlocalcheckout.yml
Runner.Client --server http://localhost:5000 -W testworkflows/cache.yml -P ubuntu-latest=-self-hosted
Runner.Client --server http://localhost:5000 -W testworkflows/testhashfiles.yml
Runner.Client --server http://localhost:5000 -W testworkflows/dumpcontexts.yml
Runner.Client --server http://localhost:5000 -P ubuntu-latest=-self-hosted -W testworkflows/matrixtest.yml --parallel 1
Runner.Client --server http://localhost:5000 -W testworkflows/artifact.yml
shell: bash