-
-
Notifications
You must be signed in to change notification settings - Fork 347
141 lines (126 loc) · 4.92 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
name: Build CKAN + NetKAN
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mono: ['6.8', '6.10', '6.12', 'latest']
configuration: [Debug, Release]
container:
image: mono:${{ matrix.mono }}
steps:
- uses: actions/checkout@v3
- name: Adding HTTPS support to APT for old Mono images
run: |
apt-get update || true
apt-get install -y apt-transport-https
- name: Installing build dependencies
run: apt-get update && apt-get install -y git
- name: Install runtime dependencies
run: apt-get install -y xvfb
- name: Restore cache for _build/tools
uses: actions/cache@v1
with:
path: _build/tools
key: build-tools-${{ hashFiles('build', 'build.ps1', 'build.cake') }}
- name: Restore cache for _build/cake
uses: actions/cache@v1
with:
path: _build/cake
key: build-cake-${{ hashFiles('build.cake') }}
- name: Restore cache for _build/lib/nuget
uses: actions/cache@v1
with:
path: _build/lib/nuget
key: nuget-oldref-modules-${{ hashFiles('**/packages.config') }}-${{ hashFiles('**/*.csproj') }}
- name: Restore cache for ~/.nuget/packages
uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: nuget-packref-modules-${{ hashFiles('**/packages.config') }}-${{ hashFiles('**/*.csproj') }}
- name: Build ckan.exe and netkan.exe
run: ./build --configuration=${{ matrix.configuration}}
- name: Run tests
run: xvfb-run ./build test+only --configuration=${{ matrix.configuration }} --where="Category!=FlakyNetwork"
- name: Run inflator container smoke test
run: |
cd _build
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
docker build --tag inflator --file ../Dockerfile.netkan .
docker run --rm --name inflator --entrypoint /bin/bash inflator -c "
curl -O https://raw.githubusercontent.com/KSP-CKAN/NetKAN/master/NetKAN/ZeroMiniAVC.netkan && \
mono netkan.exe ZeroMiniAVC.netkan
"
if: matrix.configuration == 'release' && ( matrix.mono == '6.8' || matrix.mono == 'latest' )
- name: Upload ckan.exe artifact
uses: actions/upload-artifact@v2
with:
name: ckan.exe
path: _build/repack/Release/ckan.exe
retention-days: 7
if: matrix.configuration == 'release' && matrix.mono == 'latest' && github.event_name == 'pull_request'
- name: Send Discord Notification
env:
JOB_STATUS: ${{ job.status }}
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: ${{ failure() && env.WEBHOOK_URL }}
run: |
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
shell: bash
build_NetCore:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
configuration: [Debug_NetCore, Release_NetCore]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Restore cache for _build/tools
uses: actions/cache@v1
with:
path: _build/tools
key: build-tools-${{ hashFiles('build', 'build.ps1', 'build.cake') }}
- name: Restore cache for _build/cake
uses: actions/cache@v1
with:
path: _build/cake
key: build-cake-${{ hashFiles('build.cake') }}
- name: Restore cache for _build/lib/nuget
uses: actions/cache@v1
with:
path: _build/lib/nuget
key: nuget-oldref-modules-${{ hashFiles('**/packages.config') }}-${{ hashFiles('**/*.csproj') }}
- name: Restore cache for ~/.nuget/packages
uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: nuget-packref-modules-${{ hashFiles('**/packages.config') }}-${{ hashFiles('**/*.csproj') }}
- name: Build with .NET Core
run: ./build --configuration=${{ matrix.configuration }}
- name: Test with .NET Core
run: ./build test+only --configuration=${{ matrix.configuration }}
- name: Send Discord Notification
env:
JOB_STATUS: ${{ job.status }}
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: ${{ failure() && env.WEBHOOK_URL }}
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL