-
-
Notifications
You must be signed in to change notification settings - Fork 19
171 lines (147 loc) · 6.93 KB
/
windows_build_test_and_push.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
name: Build, test and publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_test_and_publish:
name: Build, test and publish local
if: github.repository_owner == 'ParadoxGameConverters'
runs-on: [self-hosted, windows]
steps:
- name: work around permission issue
run: git config --global --add safe.directory /github/workspace
- name: "Cloning repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: "Cloning selective submodules"
run: |
git submodule update --init --recursive external\commonItems
git -c submodule."external/commonItems".update=none `
submodule update --init --recursive external\Fronter
- name: "Fetching tags"
run: |
git fetch --tags
git tag
- name: "Generate semantic version number"
uses: paulhatch/semantic-version@v5.4.0
id: version_number
with:
# The prefix to use to identify tags
tag_prefix: ""
# A string which, if present in a git commit, indicates that a change represents a
# major (breaking) change, supports regular expressions wrapped with '/'
major_pattern: "(MAJOR)"
# A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs
major_regexp_flags: ""
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
minor_pattern: "(MINOR)"
# A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs
minor_regexp_flags: ""
# A string to determine the format of the version output
version_format: "v${major}.${minor}.${patch}"
# If this is set to true, *every* commit will be treated as a new version.
bump_each_commit: true
# If true, the body of commits will also be searched for major/minor patterns to determine the version type.
search_commit_body: false
# The output method used to generate list of users, 'csv' or 'json'.
user_format_type: "csv"
- name: "Echo version number"
run: |
echo ${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.${{ steps.version_number.outputs.patch }}
- name: "Create version file"
run: |
echo '# Version info' | out-file data/version.txt -encoding ASCII
echo '' | out-file data/version.txt -encoding ASCII -append
echo 'version = "${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.${{ steps.version_number.outputs.patch }}"' | out-file data/version.txt -encoding ASCII -append
echo 'name = "Chen"' | out-file data/version.txt -encoding ASCII -append
echo 'source = "Vic3"' | out-file data/version.txt -encoding ASCII -append
echo 'minSource = "1.3"' | out-file data/version.txt -encoding ASCII -append
echo 'maxSource = "1.5"' | out-file data/version.txt -encoding ASCII -append
echo 'target = "HoI4"' | out-file data/version.txt -encoding ASCII -append
echo 'minTarget = "1.13"' | out-file data/version.txt -encoding ASCII -append
echo 'maxTarget = "1.13"' | out-file data/version.txt -encoding ASCII -append
cat data/version.txt
- name: "Build solution"
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\"
.\MSBuild.exe -m -p:Configuration=Release $Env:GITHUB_WORKSPACE\Vic3ToHoi4.sln
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\test\Release
.\Vic3ToHoI4Tests.exe
- name: "Prepare release"
run: |
cd "C:\Program Files\7-Zip\"
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-latest-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
- name: "Prepare installer"
run: |
c:\"Program Files (x86)\Inno Setup 6\iscc" Vic3ToHoI4-Installer.iss
cp $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-latest-win-x64.exe $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.exe
- name: "Upload binaries to named release"
if: ${{ github.event_name == 'push' }}
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.0
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifacts: Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.zip, Output\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.exe
token: ${{ secrets.API_TOKEN_GITHUB }}
- name: "Upload binaries to latest release"
if: ${{ github.event_name == 'push' }}
uses: ncipollo/release-action@v1
with:
tag: latest
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifacts: Vic3ToHoI4-latest-win-x64.zip, Output\Vic3ToHoI4-latest-win-x64.exe
token: ${{ secrets.API_TOKEN_GITHUB }}
- name: "Prepare pull request artifact"
if: ${{ github.event_name == 'pull_request' }}
run: |
cd "C:\Program Files\7-Zip\"
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-pull-request-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: pull-request-version
path: Vic3ToHoI4-pull-request-win-x64.zip
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse
build_test:
name: Build and test foreign
if: github.repository_owner != 'ParadoxGameConverters'
runs-on: windows-2022
steps:
- name: "Cloning repo"
uses: actions/checkout@v4
with:
submodules: true
- name: "Cloning selective submodules"
run: |
git submodule update --init --recursive external\commonItems
git -c submodule."external/commonItems".update=none `
submodule update --init --recursive external\Fronter
- name: "Build solution"
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\"
.\MSBuild.exe -m -p:Configuration=Release $Env:GITHUB_WORKSPACE\Vic3ToHoI4.sln
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\test\Release
.\Vic3ToHoI4Tests.exe
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse