-
Notifications
You must be signed in to change notification settings - Fork 56
284 lines (279 loc) · 10.6 KB
/
supercell-cicd.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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Build jobs
run-name:
on:
push:
paths:
- 'src/**'
- 'lib/**'
- '3rd_party/**'
pull_request:
branches:
- master
release:
types: [published]
jobs:
build-develop-linux:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
compiler: [gcc, gcc-9, gcc-10, gcc-11, gcc-12, gcc-13, clang]
include:
- os: ubuntu-latest
compiler: gcc
- os: ubuntu-latest
compiler: clang
- os: ubuntu-20.04
compiler: clang-11
- os: ubuntu-22.04
compiler: clang-13
- os: ubuntu-24.04
compiler: gcc-14
exclude:
- os: ubuntu-20.04
compiler: gcc-12
- os: ubuntu-20.04
compiler: gcc-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup C++
uses: aminya/[email protected]
with:
compiler: ${{ matrix.compiler }}
cmake: true
make: true
- name: "Install dependencies"
run: |
sudo apt update && sudo apt install -y \
cmake build-essential libboost-test-dev libtbb-dev \
libarchive-dev libboost-program-options-dev libboost-filesystem-dev \
libboost-system-dev libeigen3-dev liblzma-dev libbz2-dev zlib1g-dev zip
- name: "Compile supercell."
run: cmake . -DCMAKE_BUILD_TYPE=Release && make supercell -j 4
- name: "Check supercell"
run: 'src/sc_cli/supercell -d -i ./data/examples/Ca2Al2SiO7/Ca2Al2SiO7.cif | grep -q "The total number of combinations is 6"'
deploy-build-macos:
strategy:
fail-fast: false
runs-on: macos-13
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: "Install brew dependencies"
run: |
brew install boost eigen libarchive zlib
- name: "Get TBB"
uses: actions/checkout@v4
with:
repository: oneapi-src/oneTBB
ref: v2021.13.0
path: ./tbb
submodules: true
- name: "Compile and install tbb"
working-directory: ./tbb
run: |
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DTBB_TEST=OFF
make -j 4
sudo make install
- uses: actions/checkout@v4
with:
path: ./supercell
submodules: true
- name: "Compile supercell."
working-directory: ./supercell
run: |
export PKG_CONFIG_PATH="/usr/local/opt/libarchive/lib/pkgconfig"
cmake . -DCMAKE_BUILD_TYPE=Release -DLINK_STATIC_LIBS=ON -DLibArchive_INCLUDE_DIR=/usr/local/opt/libarchive/include && make supercell -j 4
- name: "Check supercell"
working-directory: ./supercell
run: 'src/sc_cli/supercell -d -i ./data/examples/Ca2Al2SiO7/Ca2Al2SiO7.cif | grep -q "The total number of combinations is 6"'
- name: "Check supercell dynamic libs."
working-directory: ./supercell
run: 'otool -l src/sc_cli/supercell'
- name: Upload Supercell
uses: actions/upload-artifact@v4
with:
name: macos-bin
path: ./supercell/src/sc_cli/supercell
deploy-build-linux:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
steps:
- name: "Clone supercell"
uses: actions/checkout@v4
with:
path: ./supercell
submodules: true
- name: "Clone oneTBB"
uses: actions/checkout@v4
with:
repository: oneapi-src/oneTBB
ref: v2021.13.0
path: ./oneTBB
submodules: true
- name: "Compile supercell with deps"
uses: addnab/docker-run-action@v3
with:
image: ubuntu:18.04
options: -v ${{ github.workspace }}:/work
run: |
apt-get update && apt-get full-upgrade -y
apt-get install -y software-properties-common wget tar cmake build-essential \
ccache libboost-program-options-dev libboost-filesystem-dev libboost-test-dev \
libarchive-dev liblzma-dev libbz2-dev zlib1g-dev zip libboost-system-dev automake
add-apt-repository ppa:git-core/ppa
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install -y git gcc-9 g++-9
export CC=gcc-9
export CXX=g++-9
export PATH="/usr/lib/ccache:$PATH"
export BASE_DIR="/work"
mkdir ${BASE_DIR}/eigen && cd ${BASE_DIR}/eigen
wget -nv https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz -O - | tar -zxf -
mkdir build && cd build
cmake ../eigen-3.4.0
make install
cd $BASE_DIR/oneTBB
mkdir cmake-build && cd cmake-build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DTBB_TEST=OFF
make -j 4 && make install
wget -nv https://github.com/libarchive/libarchive/releases/download/v3.7.4/libarchive-3.7.4.tar.gz -O - | tar -zxf -
cd libarchive-3.7.4
./configure --without-openssl --without-libb2 --without-xml2 --without-expat --disable-bsdtar
sed -ir '/^.*#define HAVE_LZMA_STREAM_ENCODER_MT 1.*$/d' config.h
make -j 4
make install
cd $BASE_DIR/supercell
cmake . -DCMAKE_BUILD_TYPE=Release -DLINK_STATIC_LIBS=ON && make supercell -j 4
ccache -s
supercell/src/sc_cli/supercell -d -i supercell/data/examples/Ca2Al2SiO7/Ca2Al2SiO7.cif | grep -q "The total number of combinations is 6"
- name: Upload Supercell
uses: actions/upload-artifact@v4
with:
name: linux-bin
path: ./supercell/src/sc_cli/supercell
deploy-build-windows:
runs-on: ubuntu-22.04
steps:
- name: "Install dependencies"
run: |
sudo apt update && sudo apt -y full-upgrade
sudo apt install -y gcc cmake build-essential wine-stable autopoint gperf intltool libtool libtool-bin lzip p7zip-full python3 python3-mako
- name: "Download MXE"
uses: actions/checkout@v4
with:
repository: mxe/mxe
path: ./mxe
submodules: true
- name: Cache
uses: actions/cache@v4
with:
save-always: true
path: ./mxe/.ccache
key: win-cache-${{ github.run_id }} # Can use time based key as well
restore-keys: |
win-cache-
- name: "Compile MXE"
working-directory: ./mxe
run: |
sed -i -r 's/ nettle / /g' src/libarchive.mk && sed -i -r 's/with-nettle/without-nettle --without-openssl --without-iconv /g' src/libarchive.mk
make MXE_TARGETS=x86_64-w64-mingw32.static MXE_PLUGIN_DIRS=plugins/gcc13 ccache
echo 'max_size = 15.0G' > .ccache/ccache/ccache.conf
.ccache/bin/ccache -s
make MXE_TARGETS=x86_64-w64-mingw32.static MXE_PLUGIN_DIRS=plugins/gcc13 ccache cc cmake intel-tbb boost eigen libarchive --jobs=4 JOBS=4
.ccache/bin/ccache -s
echo "${PWD}/usr/bin" >> $GITHUB_PATH
- name: "Clone supercell"
uses: actions/checkout@v4
with:
path: ./supercell
submodules: true
- name: "Compile Supercell"
working-directory: ./supercell
run: |
x86_64-w64-mingw32.static-cmake . -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_DOC=OFF -DLINK_STATIC_LIBS=ON
make supercell
- name: "Run supercell"
working-directory: ./supercell
run: 'wine64 src/sc_cli/supercell.exe -d -i ./data/examples/Ca2Al2SiO7/Ca2Al2SiO7.cif | grep -q "The total number of combinations is 6"'
- name: Upload Supercell
uses: actions/upload-artifact@v4
with:
name: windows-bin
path: ./supercell/src/sc_cli/supercell.exe
deploy-to-site:
if: github.event_name == 'release'
needs: [ deploy-build-linux, deploy-build-macos, deploy-build-windows ]
runs-on: ubuntu-latest
steps:
- name: "Install dependencies"
run: |
sudo apt-get update && sudo apt-get full-upgrade -y
sudo apt-get update
sudo apt-get install -y git wget tar openssh-client zip
- uses: actions/download-artifact@v4
with:
name: linux-bin
path: ./art/linux
- uses: actions/download-artifact@v4
with:
name: windows-bin
path: ./art/windows
- uses: actions/download-artifact@v4
with:
name: macos-bin
path: ./art/osx
- name: "Deploy to file"
env:
SITE_REPO_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
mkdir ./site && cd ./site
# Save some useful information
ART_DIR=${PWD}/../art/
DEPLOY_REPO="[email protected]:orex/orex.github.io.git"
DEPLOY_BRANCH="master"
DEPLOY_DIR="supercell/external"
#
mkdir ~/.ssh
eval `ssh-agent -s`
echo "${SITE_REPO_KEY}" | ssh-add -
ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
# Clone the existing gh-pages for this repo into out/
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply)
git clone --recurse-submodules "${DEPLOY_REPO}" --branch "${DEPLOY_BRANCH}" out && cd out
REPO_PATH=${PWD}
# Now let's go have some fun with the cloned repo
git config user.name "Github Action"
git config user.email "[email protected]"
#Main code
mkdir -p "${REPO_PATH}/${DEPLOY_DIR}/exe/."
cd `mktemp -d -t XXXXXX`
wget -nv https://github.com/orex/supercell/raw/deploy/README -O README
for i in ${ART_DIR}/*
do
cp -a "${i}"/* .
OS=`basename "${i}"`
if [[ "$OS" == "windows" ]]; then
zip -9 supercell-$OS.zip README supercell.exe
else
chmod +x supercell
tar czvf supercell-$OS.tar.gz README supercell
fi
rm -f supercell supercell.exe
done
cp -afv supercell-* "${REPO_PATH}/${DEPLOY_DIR}/exe/."
cd ${REPO_PATH}
ls -lah
# Commit the "changes", i.e. the new version.
# The delta will show diffs between new and old version
git add --no-ignore-removal .
git status
git commit -m "Deploy to GitHub Pages: ${GITHUB_SHA}"
# Now that we're all set up, we can push.
git push $DEPLOY_REPO $DEPLOY_BRANCH