-
Notifications
You must be signed in to change notification settings - Fork 11
198 lines (173 loc) · 7.29 KB
/
nightly.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
#
# GitHub action to build and deploy nightly releases.
#
name: Nightly
# Note: This is performed "only" on the default branch of the repository!
on:
schedule:
- cron: '0 0 * * *' # At the end of every day (midnight UTC).
jobs:
nightly_build:
name: Nightly
strategy:
fail-fast: false
runs-on: windows-latest
steps:
# Activity check
# uses GitHub API to check last non-automagic commit in repository
# if it's older than a week, all other steps are skipped
- name: Activity check
run: |
:
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/commits | jq -r '[.[] | select(.author.login != "${{ secrets.GITHUB_TOKEN }}")][0]' > $HOME/commit.json
date="$(jq -r '.commit.author.date' $HOME/commit.json)"
timestamp=$(date --utc -d "$date" +%s)
author="$(jq -r '.commit.author.name' $HOME/commit.json)"
url="$(jq -r '.html_url' $HOME/commit.json)"
days=$(( ( $(date --utc +%s) - $timestamp ) / 86400 ))
rm -f $HOME/commit.json
echo "Repository activity : $timestamp $author $url"
alive=0
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
echo "[WARNING] Ignoring activity limits : workflow triggered manually"
alive=1
else
if [ $days -gt 2 ]; then
echo "[WARNING] Repository activity : $days days ago"
fi
if [ $days -lt 8 ]; then
echo Repository active : $days days
alive=1
else
echo "[WARNING] Repository not updated : event<${{ github.event_name }}> not allowed to modify stale repository"
fi
fi
if [ $alive -eq 1 ]; then
echo "Repository alive!"
echo "::set-output name=GHA_REPO_ALIVE::true"
fi
shell: bash
- name: Clone Repository
if: ${{ steps.vars.outputs.GHA_REPO_ALIVE }} == 'true'
uses: actions/checkout@v4
- name: Checkout Files
uses: actions/checkout@v4
with:
repository: Vinifera-Developers/Vinifera-Files
path: vinifera-files
- name: Set Variables
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Install Dependencies
run: |
Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile $Env:TEMP\ninja-win.zip
Expand-Archive $Env:TEMP\ninja-win.zip -DestinationPath $Env:TEMP\ninja
echo "$Env:TEMP\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: ilammy/[email protected]
with:
arch: x86
- name: Configure Project
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build -DNIGHTLY=ON
- name: Build Project
run: |
cmake --build build --config RelWithDebInfo
- name: Copy Binaries
shell: bash
run: |
mkdir artifact
mkdir artifact/Movies
ls -p | grep -v /
cp ./build/Vinifera.dll ./artifact/Vinifera.dll
cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb
cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.exe
cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb
cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb
cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: vinifera-nightly-${{ steps.vars.outputs.sha_short }}
path: artifact
nightly_build_ts_client:
name: Nightly (TS-Client)
strategy:
fail-fast: false
runs-on: windows-latest
steps:
# Activity check
# uses GitHub API to check last non-automagic commit in repository
# if it's older than a week, all other steps are skipped
- name: Activity check
run: |
:
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/commits | jq -r '[.[] | select(.author.login != "${{ secrets.GITHUB_TOKEN }}")][0]' > $HOME/commit.json
date="$(jq -r '.commit.author.date' $HOME/commit.json)"
timestamp=$(date --utc -d "$date" +%s)
author="$(jq -r '.commit.author.name' $HOME/commit.json)"
url="$(jq -r '.html_url' $HOME/commit.json)"
days=$(( ( $(date --utc +%s) - $timestamp ) / 86400 ))
rm -f $HOME/commit.json
echo "Repository activity : $timestamp $author $url"
alive=0
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
echo "[WARNING] Ignoring activity limits : workflow triggered manually"
alive=1
else
if [ $days -gt 2 ]; then
echo "[WARNING] Repository activity : $days days ago"
fi
if [ $days -lt 8 ]; then
echo Repository active : $days days
alive=1
else
echo "[WARNING] Repository not updated : event<${{ github.event_name }}> not allowed to modify stale repository"
fi
fi
if [ $alive -eq 1 ]; then
echo "Repository alive!"
echo "::set-output name=GHA_REPO_ALIVE::true"
fi
shell: bash
- name: Clone Repository
if: ${{ steps.vars.outputs.GHA_REPO_ALIVE }} == 'true'
uses: actions/checkout@v4
- name: Checkout Files
uses: actions/checkout@v4
with:
repository: Vinifera-Developers/Vinifera-Files
path: vinifera-files
- name: Set Variables
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Install Dependencies
run: |
Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile $Env:TEMP\ninja-win.zip
Expand-Archive $Env:TEMP\ninja-win.zip -DestinationPath $Env:TEMP\ninja
echo "$Env:TEMP\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: ilammy/[email protected]
with:
arch: x86
- name: Configure Project
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build -DNIGHTLY=ON -DOPTION_TS_CLIENT_BUILD=ON
- name: Build Project
run: |
cmake --build build --config RelWithDebInfo
- name: Copy Binaries
shell: bash
run: |
mkdir artifact
mkdir artifact/Movies
ls -p | grep -v /
cp ./build/Vinifera.dll ./artifact/Vinifera.dll
cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb
cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.dat
cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb
cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb
cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: vinifera-nightly-${{ steps.vars.outputs.sha_short }}-ts_client
path: artifact