-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (136 loc) · 4.73 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
147
148
# github actions help: https://git.io/JvXDl
name: "CI build"
on:
push:
#branches: [ master_ ]
#pull_request:
# The branches below must be a subset of the branches above
#branches: [ master ]
schedule:
# 5.01am GMT = 1.01pm WST
- cron: '01 5 * * *'
jobs:
info:
name: info (ubuntu)
runs-on: ubuntu-latest
steps:
- name: current path
run: cd
- name: directory
run: dir -R
- name: dotnet
run: dotnet --info
- name: git context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo expand above
- name: job context
env:
JOB_CONTEXT: ${{ toJSON(job) }}
run: echo expand above
- name: steps context
env:
STEPS_CONTEXT: ${{ toJSON(steps) }}
run: echo expand above
- name: runner context
env:
RUNNER_CONTEXT: ${{ toJSON(runner) }}
run: echo expand above
- name: strategy context
env:
STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
run: echo expand above
- name: matrix context
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
run: echo expand above
- name: inputs context
env:
INPUTS_CONTEXT: ${{ toJSON(inputs) }}
run: echo expand above
- name: env context
env:
ENV_CONTEXT: ${{ toJSON(env) }}
run: echo expand above
build:
name: build, test, analyse, artifact (windows)
# windows runner required because..
# - setup-msbuild can only be run on Windows runners, i.e. not available on ubuntu-latest
# - in theory, we could run a matrix here.. ubuntu for CI and windows for release (tag only) --> but likely not worth the overhead
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: checkout
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: analysis setup (master and tag only)
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
uses: github/codeql-action/init@v1
with:
languages: 'csharp'
# building via msbuild (as used by VS) instead of dotnet because Wix v3 lacks dotnet support
# - https://github.com/wixtoolset/issues/issues/5627
# - setup latest msbuild (v17.1 at time of writing), refer https://github.com/marketplace/actions/setup-msbuild
- name: add msbuild to PATH
uses: microsoft/[email protected]
- name: info
run: |
dir "C:\Program Files (x86)"
dir "C:\Program Files"
echo path
echo 1
echo $VERSION
echo 2
echo $env:VERSION
echo 2.1
echo %VERSION%
echo 4
echo $env:VERSION
- name: build
env:
# extact version from ref_name if this is a tag, otherwise provide a default value (since msbuild won't accept a null value)
# default to 0.0.2 instead of 0.0.1 because the version must excceed the minimum allowed version (refer wix proj)
VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '0.0.2-no-tag' }}
run: |
msbuild ./ClrVpin.sln -t:restore,build -p:Configuration=Release -p:UseSharedCompilation=false -m -p:Version=$env:VERSION
- name: tests
# unfortunately need to specify individual folders/projects instead of the solution file because of WiX v3 compatibility
run: dotnet test ClrVpin.tests --no-restore && dotnet test Utils.tests --no-restore
- name: analysis (master and tag only)
# codeQL is rather slow, so only perform for master commits and tagging
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
uses: github/codeql-action/analyze@v1
- name: upload artifact (tag only)
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: installer
path: ClrVpin.setup\bin\release\*.msi
retention-days: 5
release:
name: release (tag only - ubuntu)
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
permissions:
contents: write # required for release notes only
steps:
# checkout required for access to the release notes template
- name: checkout
uses: actions/checkout@v3
- name: download artifacts
uses: actions/download-artifact@v3
with:
name: installer
- name: release
uses: ncipollo/release-action@v1
with:
artifactErrorsFailBuild: true
artifacts: ClrVpin.Setup.msi
draft: true
name: '${{github.ref_name}}: tba'
generateReleaseNotes: true
bodyFile: docs/release/releaseNotesBody.md