forked from MirisWisdom/HCE
-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (137 loc) · 5.34 KB
/
release-hxe.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
# Ref: Building .NET Framework Applications with Github Actions
# https://www.codingwithcalvin.net/building-net-framework-applications-with-github-actions/
name: release-hxe
# TODO: Get branch name
# https://stackoverflow.com/a/58035262/14894786
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif
on:
push:
branches: [ main, develop ]
paths:
# Match
- 'hxe/kernel/src/**'
- '.gitmodules'
# Ignore
- '!**.md'
- '!**.txt'
pull_request:
branches: [ main, develop ]
paths:
# Match
- 'hxe/kernel/src/**'
- 'spv3/loader/src/**'
- '.gitmodules'
# Ignore
- '!**.md'
- '!**.txt'
workflow_dispatch: # Allow manually runs
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# However, each Job uses separate Runners
jobs:
build:
name: Build
runs-on: windows-latest # The type of runner that the job will run on
strategy:
fail-fast: false
matrix:
build-cfg: [ Release, Debug ]
steps:
################
# SETUP
################
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Required by tj-actions/changed-files and GitVersion
- name: Navigate to Workspace # https://www.codingwithcalvin.net/building-net-framework-applications-with-github-actions/
run: cd $GITHUB_WORKSPACE
- name: Init-Update Git Submodules
run: git submodule update --init --recursive
- name: Extract branch name
uses: nelonoel/branch-name@v1
id: extract_branch
################
# SETUP - Node, NPM
################
- name: Setup Node
uses: actions/setup-node@v2
# Dependents: Semantic Release
- name: Setup NPM
uses: bahmutov/npm-install@v1
# Dependents: Semantic Release
################
# SETUP - MSBuild
################
# https://github.com/marketplace/actions/setup-msbuild
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
################
# BUILD
################
# Package restore handled by MSBuild '-t:restore' flag, but we'll do this anyway
- name: Restore NuGet Packages
run: nuget restore hxe/kernel/src/HXE.sln;
- name: Build Solutions
run: |
cd hxe/kernel/src/;
msbuild.exe -restore -p:platform="Any CPU" -p:configuration="Release" HXE.sln;
msbuild.exe -restore -p:platform="Any CPU" -p:configuration="Debug" HXE.sln;
# TODO: Finish Post-Build commands
# .NET Framework apps cannot be built by DotNet CLI
# We have to fallback to MSBuild
# This section will remain until our apps are ported to .NET 5 or 6
#- name: DotNet build prep
# run: dotnet build /p:ContinuousIntegrationBuild=true
#- name: Build
# run: dotnet build /p:Version="$env:{{ steps.gitversion.outputs.assemblySemVer }}"
#- name: Pack
# run: dotnet pack /p:PackageVersion="$env:{{ steps.gitversion.outputs.semVer}}-$env:{{ steps.gitversion.outputs.shortSha }}"
################
# UNIT TESTS TODO: Move to separate worflows
################
- name: Setup OpenCover, XUnit for .NET Framework
run: |
choco install opencover.portable
choco install xunit
# docs: https://github.com/codecov/example-csharp
- name: Write Unit Test Reports
working-directory: ./hxe/kernel/src/
run: OpenCover.Console.exe -register:user -target:"xunit.console.x86.exe" -targetargs:"..\MyUnitTests\bin\Debug\MyUnitTests.dll -noshadow" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:"..\hxe_coverage.xml"
- name: Upload unit test reports to CodeCoverage
uses: codecov/codecov-action@v1
with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./hxe/kernel/hxe_coverage.xml
flags: unittests # optional
functionalities: recursesubs # search for code in git submodules as well
# name: codecov-umbrella # optional
# fail_ci_if_error: true # optional (default = false)
# verbose: true # optional (default = false)
################
# RELEASE
################
# https://github.com/marketplace/actions/gittools
- name: Setup GitTools
uses: GitTools/[email protected]
- name: Setup GitVersion
uses: GitTools/actions/gitversion/[email protected]
id: gitV
with:
versionSpec: '5.x'
- run: echo "${{ steps.gitversion.outputs.fullSemVer }}"
# https://github.com/GitTools/actions/blob/main/docs/examples/github/gitreleasemanager/index.md
- name: Setup GitReleaseManager
id: gitRM
uses: gittools/actions/gitreleasemanager/[email protected]
with:
versionSpec: '0.10.x'
- name: Setup Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_NPM_TOKEN }}
#- name: Determine if Release needed
# if: ${{ env.GIT_BRANCH_NAME == 'main' }}
# GitReleaseManager or Semantic Release?
#- name: Publish via GitReleaseManager
# run: