-
Notifications
You must be signed in to change notification settings - Fork 9
134 lines (117 loc) · 4.85 KB
/
cmake-ninja.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
name: cmake-ninja
on:
push:
#pull_request:
release:
types: published
schedule:
# * is a special character in YAML so you have to quote this string
# 20:00 every Sunday UTC (which is 21:00 CET or 22:00 CEST)
- cron: '0 20 * * 0'
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
# Use centos7
container:
image: centos:7
options: --privileged
steps:
- name: Install GIT
run: |
date
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum -y install git
git --version
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Dependencies
run: |
git config --global --add safe.directory '*'
git status
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.sh
chmod +x cmake-3.16.4-Linux-x86_64.sh
./cmake-3.16.4-Linux-x86_64.sh --skip-license --prefix=/usr/local
curl -L -O https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/p7zip-16.02-20.el7.x86_64.rpm
curl -L -O https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/p7zip-plugins-16.02-20.el7.x86_64.rpm
rpm -U --quiet p7zip-16.02-20.el7.x86_64.rpm
rpm -U --quiet p7zip-plugins-16.02-20.el7.x86_64.rpm
yum install -y epel-release
yum install -y make libasan gcc-gfortran gcc-c++ unzip openblas-devel lapack-devel zlib-devel tree fuse-sshfs fuse-libs file
groupadd fuse
user="$(whoami)"
usermod -a -G fuse "$user"
curl -L -O https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip
unzip ninja-linux.zip
mv ./ninja /usr/bin
- name: Configure CMake
shell: bash
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -G Ninja -B build -DHOPR_INSTRUCTION=-mtune=generic -DCMAKE_BUILD_TYPE=Release -DLIBS_USE_MPI=OFF -DCMAKE_INSTALL_PREFIX=/usr
- name: Build
shell: bash
# Build your program with the given configuration
run: cmake --build build
- name: Create AppImage
shell: bash
run: |
cd build
DESTDIR=AppDir ninja install
mkdir -p AppDir/usr/share/icons
cp ../docs/Meshformat/pics/HOPR_logo.png AppDir/usr/share/icons/hopr.png
curl -L -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps/
ln -sf ../../../hopr.png AppDir/usr/share/icons/hicolor/64x64/apps/
tree AppDir
./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage --desktop-file=../hopr.desktop
- name: Set env
run: |
echo "BINARYPATH=$(ls build/hopr*x86_64.AppImage)" >> $GITHUB_ENV
echo "BINARYNAME=$(basename $(ls build/hopr*x86_64.AppImage))" >> $GITHUB_ENV
#- name: Test env variable
#run: |
#echo ${BINARYPATH}
#echo ${{env.BINARYPATH}}
#echo ${BINARYNAME}
#echo ${{env.BINARYNAME}}
#cat src/buildinfo.h
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "${{ env.BINARYPATH }}"
- name: Fail if binary does not exist
if: steps.check_files.outputs.files_exists == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('no binary found under build/hopr*x86_64.AppImage.')
- name: Create archives
run: |
mkdir artifacts
mkdir assets
cp ${BINARYPATH} .
md5sum ${BINARYNAME} > md5sum.txt
7z a assets/hopr-linux64.zip ${BINARYNAME} md5sum.txt
mv ${BINARYNAME} md5sum.txt artifacts/.
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: hopr-binary-v1.2.1
path: artifacts
- name: Upload release asset
if: github.event.action == 'published'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/hopr-linux64.zip
asset_name: hopr-linux64.zip
asset_content_type: application/zip