-
Notifications
You must be signed in to change notification settings - Fork 1
227 lines (209 loc) · 7.77 KB
/
main.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
create_release:
name: Create release
runs-on: ubuntu-16.04
# Note this. We are going to use that in further jobs.
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
release_name: ${{ env.SHORT_SHA }}
tag_name: ${{ env.SHORT_SHA }}
draft: false
prerelease: false
build:
if: "!contains(github.event.head_commit.message, 'cmake skip')"
name: Build artifacts
needs: create_release # we need to know the upload URL
# The type of runner that the job will run on
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-16.04
- os: macos-10.15
- os: windows-2019
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get CMake
uses: lukka/get-cmake@v3.19.2
- name: Get RandR Lib for Ubuntu
if: matrix.config.os == 'ubuntu-16.04'
run: |
sudo apt-get update
sudo apt-get install xorg-dev libglu1-mesa-dev
sudo apt-get install libxrandr-dev
- name: Install vcpkg & box2d
working-directory: ./tools/vcpkg
timeout-minutes: 10
shell: pwsh
run: |
$os="${{matrix.config.os}}"
if ($os -like '*windows*') {
.\bootstrap-vcpkg.bat
.\vcpkg update
.\vcpkg integrate install
.\vcpkg install box2d:x64-windows
} else {
./bootstrap-vcpkg.sh
./vcpkg update
./vcpkg integrate install
./vcpkg install box2d
}
# - name: Swith to clang++ on Ubuntu
# if: matrix.config.os == 'ubuntu-16.04'
# run: |
# sudo apt-get install clang
# sudo update-alternatives --set cc `which clang`
# sudo update-alternatives --set c++ `which clang++`
- name: Add msbuild to PATH
if: matrix.config.os == 'windows-2019'
uses: microsoft/setup-msbuild@v1.0.2
- name: Build the executable
shell: pwsh
run: |
$os="${{matrix.config.os}}"
if ($os -like '*ubuntu*') {
echo "applying patch..."
ls -al ./tools/vcpkg/installed
patch ./tools/vcpkg/installed/x64-linux/include/box2d/b2_math.h ./tools/b2_math.patch
echo "patch applied"
}
mkdir ./bin
cd ./bin
if ($os -like '*windows*') {
echo "build on windows"
cmake -DCMAKE_BUILD_TYPE=Release ..
echo "generated project files. now build..."
msbuild egg2021.sln /p:Configuration=Release
} else {
echo "build on *nix"
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
}
ls .
cd ..
- name: Upload Windows release - Private
if: matrix.config.os == 'windows-2019'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: eggs-windows-x86_64.exe
asset_path: ./bin/Release/main.exe
asset_content_type: application/octet-stream
- name: Upload Windows release - Public
shell: pwsh
if: matrix.config.os == 'windows-2019'
run: |
git clone https://${{secrets.PAT}}@github.com/ssast-tech/thuai-egg-releases ./remote_repo
cp ./bin/Release/main.exe ./remote_repo/eggs-windows-x86_64
cd ./remote_repo
git config --global user.name "panda2134"
git config --global user.email "ljypanda@live.com"
git add ./*
git commit -m "Update executable of ${{ matrix.config.os }}"
git status
git push
while (! $?) { git pull; git push; }
- name: Upload unix-like releases - Private
if: matrix.config.os != 'windows-2019'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: eggs-${{ matrix.config.os }}-x86_64
asset_path: ./bin/main
asset_content_type: application/octet-stream
- name: Upload unix-like release - Public
if: matrix.config.os != 'windows-2019'
shell: pwsh
run: |
git clone https://${{secrets.PAT}}@github.com/ssast-tech/thuai-egg-releases ./remote_repo
cp ./bin/main ./remote_repo/eggs-${{matrix.config.os}}-x86_64
cd ./remote_repo
git config --global user.name "panda2134"
git config --global user.email "ljypanda@live.com"
git add ./*
git commit -m "Update executable of ${{ matrix.config.os }}"
git status
git push
while (! $?) { git pull; git push; }
docs:
runs-on: ubuntu-latest
needs: create_release
name: Generate statements
steps:
- uses: actions/checkout@v2
- name: Compile statements with XeLaTeX
uses: xu-cheng/latex-action@v2
with:
working_directory: ./statements/
root_file: statements.tex
latexmk_use_xelatex: true
- name: Upload statements - Private
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: statements.pdf
asset_path: ./statements/statements.pdf
asset_content_type: application/pdf
- name: Upload statements - Public
shell: pwsh
run: |
git clone https://${{secrets.PAT}}@github.com/ssast-tech/thuai-egg-releases ./remote_repo
cp ./statements/statements.pdf ./remote_repo/statements.pdf
cd ./remote_repo
git config --global user.name "panda2134"
git config --global user.email "ljypanda@live.com"
git add ./*
git commit -m "Update statements"
git status
git push
while (! $?) { git pull; git push; }
update_public_repo_tag:
name: Tag the public release
needs: [build, docs]
runs-on: ubuntu-16.04
steps:
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Modify version file
run: |
git clone https://${{secrets.PAT}}@github.com/ssast-tech/thuai-egg-releases $GITHUB_WORKSPACE
cd $GITHUB_WORKSPACE
echo ${{ env.SHORT_SHA }} > ./latest_version
git config --global user.name "panda2134"
git config --global user.email "ljypanda@live.com"
git add .
git commit -m "Update version to ${{ env.SHORT_SHA }}"
git tag -a ${{ env.SHORT_SHA }} -m "Tag ${{env.SHORT_SHA}}"
git status
git push --tags
git push
- uses: EndBug/latest-tag@latest