forked from actions/runner
-
-
Notifications
You must be signed in to change notification settings - Fork 17
146 lines (132 loc) · 5.98 KB
/
build.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
name: Runner CI
on:
workflow_dispatch:
push:
branches:
- main
- gha_test
- releases/*
paths-ignore:
- '**.md'
pull_request:
branches:
- '*'
paths-ignore:
- '**.md'
jobs:
build:
strategy:
matrix:
runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, osx-x64, osx-arm64 ]
include:
- runtime: linux-x64
os: ubuntu-latest
devScript: ./dev.sh
scriptSuffix: .sh
elevate: "sudo "
- runtime: linux-arm64
os: ubuntu-latest
devScript: ./dev.sh
scriptSuffix: .sh
elevate: "sudo "
- runtime: linux-arm
os: ubuntu-latest
devScript: ./dev.sh
scriptSuffix: .sh
elevate: "sudo "
- runtime: osx-x64
os: macOS-latest
devScript: ./dev.sh
scriptSuffix: .sh
elevate: "sudo "
- runtime: osx-arm64
os: macOS-latest
devScript: ./dev.sh
- runtime: win-x64
os: windows-2019
devScript: ./dev
exeSuffix: .exe
scriptSuffix: .cmd
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
# Build runner layout
- name: Build & Layout Release
run: |
${{ matrix.devScript }} layout Release ${{ matrix.runtime }}
working-directory: src
# Create runner package tar.gz/zip
- name: Package Release
if: github.event_name != 'pull_request'
run: |
${{ matrix.devScript }} package Release
working-directory: src
# Upload runner package tar.gz/zip as artifact
- name: Publish Artifact
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: runner-package-${{ matrix.runtime }}
path: |
_package
- name: Unit Tests
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64'
run: |
${{ matrix.devScript }} test
working-directory: src
- name: Setup
if: 'false' # Disabled due to 403 of statuses api with this token and rate limit
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$obj = Get-Content "_layout/bin/appsettings.json" | ConvertFrom-Json
$obj.'Runner.Server'.GITHUB_TOKEN = $Env:GITHUB_TOKEN
$obj | ConvertTo-Json -Depth 20 | Set-Content "_layout/bin/appsettings.json"
- name: Test
shell: bash
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64'
run: |
pushd _layout/bin
./Runner.Server${{ matrix.exeSuffix }} --urls http://localhost:5000 &
serverpid=$!
sleep 20
# Test run job without a runner
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../src/Runner.Client/workflow.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 && exit 1 || [[ "$?" = "1" ]]
pushd ..
./config${{ matrix.scriptSuffix }} --unattended --url http://localhost:5000/runner/server --token "ThisIsIgnored"
./run${{ matrix.scriptSuffix }} &
workerpid=$!
sleep 20
popd
# Test run job with runner
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../src/Runner.Client/workflow.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/globalenv.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/localenv.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/stepenv.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/matrixtest.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/skipped.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/eventwithnulltoken.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000
#Test using parallel 1
./Runner.Client${{ matrix.exeSuffix }} -P ubuntu-latest=-self-hosted -W ../../testworkflows/matrixtest.yml --parallel 1
#Test using parallel 0, this have to fail
./Runner.Client${{ matrix.exeSuffix }} -P ubuntu-latest=-self-hosted -W ../../testworkflows/matrixtest.yml --parallel 0 && exit 1 || [[ "$?" = "1" ]]
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/artifact.yml
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main.yml
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main2.yml && exit 1 || [[ "$?" = "1" ]]
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main3.yml && exit 1 || [[ "$?" = "1" ]]
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main4.yml && exit 1 || [[ "$?" = "1" ]]
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/skippedjob.yml
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/testlocalcheckout.yml
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/testhashfiles.yml
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/dumpcontexts.yml
kill $workerpid
kill $serverpid
popd
- name: Test cache
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64'
shell: bash
run: |
pushd _layout/bin
./Runner.Client${{ matrix.exeSuffix }} -P ubuntu-latest=-self-hosted -W ../../testworkflows/cache.yml
popd