forked from actions/runner
-
-
Notifications
You must be signed in to change notification settings - Fork 17
243 lines (243 loc) · 15.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
name: dotnet tool
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
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 }}
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: false && 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 io.github.christopherhx.gharun --add-source src/Runner.Client/nupkg --version ${{needs.package.outputs.version}}
# Make shure to have gharun in path in job container
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Test
run: |
set -x
gharun -C testworkflows/workflowerrors || :
gharun -C testworkflows/workflowerrors --trace --var system.runner.server.sendlostevents=true || :
gharun -W testworkflows/testlocalcheckout.yml
gharun -W testworkflows/testhashfiles.yml
gharun -W testworkflows/dumpcontexts.yml
gharun -W testworkflows/multiline_secrets.yml --secret-file testworkflows/multiline_secrets.secrets
gharun -W testworkflows/multiline_env.yml --env-file testworkflows/multiline_secrets.secrets
gharun -W testworkflows/multiline_secrets.yml --secret-file testworkflows/multiline_secrets.secrets.yaml
gharun -W testworkflows/multiline_env.yml --env-file testworkflows/multiline_secrets.secrets.yaml
cd testworkflows/environment-test
gharun -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 ../..
gharun -W testworkflows/dumpcontexts.yml --list
gharun -C testworkflows/case-insensitive-keys-matrix
gharun -C testworkflows/matrix-eq-test --parallel 2
${{matrix.image && 'echo "Skipping additional testcases" && exit 0' || ''}}
gharun -W testworkflows/cache.yml -P ubuntu-latest=-self-hosted
gharun -P ubuntu-latest=-self-hosted -W testworkflows/matrixtest.yml --parallel 1
gharun -W testworkflows/artifact.yml
gharun -W testworkflows/issue70/main.yml
gharun -W testworkflows/called.yml -e testworkflows/called_workflow_dispatch_event.json --env "input_x=Hello World 2" workflow_dispatch
gharun -W testworkflows/called.yml --env "input_x=Hello World" workflow_dispatch
gharun --workflow testworkflows/test_template_runs_on.yml --workflow testworkflows/called_template_runs_on.yml
gharun --workflow testworkflows/test_template_runs_on2.yml --workflow testworkflows/called_template_runs_on.yml -P self-hosted,testsystem=-self-hosted
gharun --workflow testworkflows/test_template_runs_on3.yml --workflow testworkflows/called_template_runs_on.yml -P testsystem2,self-hosted,testsystem=-self-hosted
gharun --workflow testworkflows/test_template_runs_on3.yml --workflow testworkflows/called_template_runs_on.yml -P testsystem2,SELF-HOSTED,testsystem=-self-hosted
gharun --workflow testworkflows/test_template_runs_on4.yml --workflow testworkflows/called_template_runs_on.yml -P testsystem2,self-hosted,testsystem=-self-hosted
gharun --workflow testworkflows/test_template_runs_on4.yml --workflow testworkflows/called_template_runs_on.yml -P Testsystem2,SELF-hosted,TESTSYSTEM=-self-hosted
gharun -W testworkflows/skippedjob.yml
gharun --workflow testworkflows/test_with_required_secret.yml --workflow testworkflows/called_with_required_secret.yml
gharun -W testworkflows/job-continue-on-error.yml
gharun -W testworkflows/continue-on-error-bug-3.6.0-4-test.yml
gharun -W testworkflows/expect-matrix-error-on-missing-exclude-key.yml && exit 1 || [[ "$?" = "1" ]]
cd testworkflows/node16_complex_reusable_workflows
gharun
cd ../..
cd testworkflows/db-disposed-issue
gharun -P ubuntu-latest=-self-hosted
gharun -P ubuntu-latest=-self-hosted --parallel 8
cd ../..
gharun -W testworkflows/test-setup-node.yml
gharun -C testworkflows/actions_checkout_v1
gharun -C testworkflows/case_insensitive_needs
gharun -C testworkflows/inherit_secrets -s misc=topSecretVal
gharun -C testworkflows/reusablesCaseInsensitive
gharun -C testworkflows/workflow_dispatch workflow_dispatch -i misc=myInput -i si=UdHe -i bval=true -i bval2=false
gharun -C testworkflows/workflow_dispatch workflow_dispatch -i Misc=myInput -i SI=UdHe -i bVal=true -i BVAL2=false
gharun -C testworkflows/matrix-selector push -j test -m fail:false
gharun -C testworkflows/oidc-provider
gharun -C testworkflows/reusablesConsistentWorkflowName
gharun -C testworkflows/matrix-partial-test
gharun -C testworkflows/workflow_ref_and_job_workflow_ref
gharun -C testworkflows/reusable-workflows-secrets-inherit-with-required-secrets -s TEST=topsecret -s OPT=testsec
gharun -C testworkflows/inherit_vars --var ACTIONS_STEP_DEBUG=true
gharun -C testworkflows/actions_artifacts_v4 -s ACTIONS_STEP_DEBUG=true -s ACTIONS_RUNNER_DEBUG=true --runner-version v2.311.0
gharun -C testworkflows/actions_artifacts_v4 -s ACTIONS_STEP_DEBUG=true -s ACTIONS_RUNNER_DEBUG=true
gharun -C testworkflows/cache-save-restore-order-tests -s ACTIONS_STEP_DEBUG=true -s ACTIONS_RUNNER_DEBUG=true
gharun --event azpipelines -C testworkflows/azpipelines/cross-repo-checkout -W testworkflows/azpipelines/cross-repo-checkout/pipeline.yml --local-repository az/containermatrix@main=testworkflows/azpipelines/containermatrix
gharun --event azpipelines -C testworkflows/azpipelines/typedtemplates -W testworkflows/azpipelines/typedtemplates/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/untypedtemplates -W testworkflows/azpipelines/untypedtemplates/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/stagetostagedeps -W testworkflows/azpipelines/stagetostagedeps/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/staticvars -W testworkflows/azpipelines/staticvars/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/staticvarfromcli -W testworkflows/azpipelines/staticvarfromcli/pipeline.yml --var myvar=myval --var myvarwitheq=my=val --env myenvar=myval
gharun --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
gharun --event azpipelines -C testworkflows/azpipelines/matrixgenerator -W testworkflows/azpipelines/matrixgenerator/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/matrixjoboutputs -W testworkflows/azpipelines/matrixjoboutputs/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/runoncedeployonlyoutput -W testworkflows/azpipelines/runoncedeployonlyoutput/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/runoncedeployoutput -W testworkflows/azpipelines/runoncedeployoutput/pipeline.yml
gharun --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
gharun --event azpipelines -C testworkflows/azpipelines/expressions-docs -W testworkflows/azpipelines/expressions-docs --var Build.SourceBranch=refs/heads/main
gharun --event azpipelines -C testworkflows/azpipelines/typedtemplates-extends -W testworkflows/azpipelines/typedtemplates-extends/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/version-literal -W testworkflows/azpipelines/version-literal/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/relative-and-absolute-paths -W testworkflows/azpipelines/relative-and-absolute-paths/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/null-each-loop -W testworkflows/azpipelines/null-each-loop/pipeline.yml
gharun --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
gharun --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 gharun -DisplayName gharun -Enabled True -Action Allow -Direction Inbound -Program ($env:USERPROFILE + '\.dotnet\tools\gharun.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
gharun -W testworkflows/windows.yml -P windows-latest=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
gharun -W testworkflows/testlocalcheckout.yml -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
# depends on bash, therefore disabled for now
# gharun -W testworkflows/artifact.yml -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
gharun -W testworkflows/cachewindowscontainer.yml -P windows-latest=mcr.microsoft.com/powershell:lts-windowsservercore-${{matrix.tag}}
gharun -W testworkflows/test-setup-node.yml -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
gharun -C testworkflows/windows-container-test1
gharun -C testworkflows/windows-container-test2
gharun -C testworkflows/windows-container-test3-invalid-problem-matcher && exit 1 || [[ "$?" = "1" ]]
gharun -C testworkflows/windows-add-path
gharun -C testworkflows/windows-add-path -P self-hosted=mcr.microsoft.com/windows/servercore:${{matrix.tag}}
gharun --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
gharun -W testworkflows/testlocalcheckout.yml -P self-hosted=ubuntu:latest
gharun -W testworkflows/artifact.yml -P self-hosted=ubuntu:latest
gharun -W testworkflows/cache.yml -P ubuntu-latest=ubuntu:latest
gharun -W testworkflows/test-setup-node.yml -P self-hosted=ubuntu:latest
gharun -C testworkflows/linux-container-problem-matcher-test1
gharun -C testworkflows/linux-container-i386
gharun --event azpipelines -C testworkflows/azpipelines/containermatrix -W testworkflows/azpipelines/containermatrix/pipeline.yml
gharun --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 gharun
cd gharun
unzip ../src/Runner.Client/nupkg/io.github.christopherhx.gharun.${{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
gharun --server http://localhost:5000 -W testworkflows/testlocalcheckout.yml
gharun --server http://localhost:5000 -W testworkflows/cache.yml -P ubuntu-latest=-self-hosted
gharun --server http://localhost:5000 -W testworkflows/testhashfiles.yml
gharun --server http://localhost:5000 -W testworkflows/dumpcontexts.yml
gharun --server http://localhost:5000 -P ubuntu-latest=-self-hosted -W testworkflows/matrixtest.yml --parallel 1
gharun --server http://localhost:5000 -W testworkflows/artifact.yml
shell: bash