-
Notifications
You must be signed in to change notification settings - Fork 2
186 lines (160 loc) · 7.21 KB
/
linux.yml
File metadata and controls
186 lines (160 loc) · 7.21 KB
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
name: Build Linux
on:
push:
branches: develop
pull_request:
branches: develop
jobs:
build-core-server-client-desktop:
name: ${{ format('{0} {1} {2}', matrix.config.prefix, matrix.config.build_type, matrix.config.suffix) }}
runs-on: ${{ matrix.config.os }}
env:
CMAKE_TOOL_VERSION: "3.22.0"
CMAKE_TOOL_PATH: "cmake-tool"
CONAN_VERSION: "1.42.2"
strategy:
fail-fast: false
matrix:
config:
- {
os: "ubuntu-20.04",
prefix: "Linux x86_64",
suffix: "",
artifact: "linux-x86_64-release",
build_type: "Release",
cc: "gcc-10",
cxx: "g++-10",
}
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Install required packages (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt update -y
sudo apt install build-essential -y
sudo apt install libstdc++-10-dev gcc-10 g++-10 -y
sudo apt install ninja-build -y
sudo apt install libxml2 libxml2-dev libxml2-utils -y # for libpskc
sudo apt install pkg-config -y
sudo apt install libgl-dev # for Qt
sudo apt install p7zip-full -y
sudo apt install python3 python3-pip -y
- name: Create necessary symlinks (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
version=10
priority=100
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${version} ${priority}
sudo update-alternatives --install /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-${version} ${priority}
sudo update-alternatives --install /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-${version} ${priority}
sudo update-alternatives --install /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-${version} ${priority}
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-${version} ${priority}
sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-${version} ${priority}
sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-${version} ${priority}
sudo update-alternatives --install /usr/bin/lto-dump lto-dump /usr/bin/lto-dump-${version} ${priority}
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${version} ${priority}
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${version} ${priority}
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${version} ${priority}
- name: Set environment variables
shell: python3 {0}
run: |
import os
repo = os.path.normpath(os.environ['GITHUB_WORKSPACE'])
root = os.path.normpath(os.path.dirname(repo))
with open(os.environ['GITHUB_ENV'], 'a') as env_file:
env_file.write("REPO_PATH={}\n".format(repo))
env_file.write("ROOT_PATH={}\n".format(root))
cmake_tool_path = os.environ['CMAKE_TOOL_PATH']
env_file.write("CMAKE_TOOL_BINARY_PATH={}\n".format(os.path.join(root, cmake_tool_path, "bin")))
- name: CMake cache
uses: actions/cache@v2
id: cache_cmake
with:
path: ${{ env.ROOT_PATH }}/${{ env.CMAKE_TOOL_PATH }}
key: ${{ runner.os }}-cmake-${{ env.CMAKE_TOOL_VERSION }}
- name: Download CMake
if: ${{ steps.cache_cmake.outputs.cache-hit != 'true' }}
shell: python3 {0}
run: |
import os
import requests
import subprocess
def execute_command(cmd):
ret = subprocess.call(cmd, shell=True)
if ret != 0:
raise RuntimeError('Exit code {} while executing "{}"'.format(ret, cmd))
root = os.environ['ROOT_PATH']
repo = os.environ['REPO_PATH']
os.chdir(root)
cmake_version = os.environ['CMAKE_TOOL_VERSION']
cmake_tool_path = os.environ['CMAKE_TOOL_PATH']
cmake_tool_binary_path = os.environ['CMAKE_TOOL_BINARY_PATH']
cmake_suffix = "linux-x86_64.tar.gz"
cmake_dir = "cmake-{}-linux-x86_64".format(cmake_version)
cmake_url = "https://github.com/Kitware/CMake/releases/download/v{}/cmake-{}-{}".format(cmake_version, cmake_version, cmake_suffix)
open("cmake.tar.gz", "wb").write(requests.get(cmake_url, allow_redirects=True).content)
execute_command("tar -xf cmake.tar.gz")
os.rename(cmake_dir, cmake_tool_path)
execute_command("chmod +x {}/cmake".format(cmake_tool_binary_path))
os.chdir(repo)
- name: Install conan
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: |
cd $ROOT_PATH
wget https://github.com/conan-io/conan/releases/download/${{ env.CONAN_VERSION }}/conan-ubuntu-64.deb
sudo dpkg -i conan-ubuntu-64.deb
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
cd $REPO_PATH
- name: Install conan dependencies
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: |
conan create conan/oath-toolkit oath-toolkit/2.6.7@user/stable -o *:shared=True
mkdir $REPO_PATH/build
conan install $REPO_PATH -if $REPO_PATH/build -g deploy -o *:shared=True
mv $REPO_PATH/build/gcrypt.pc $REPO_PATH/build/libgcrypt.pc
- name: Configure
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: |
export PKG_CONFIG_PATH="$REPO_PATH/build"
"$CMAKE_TOOL_BINARY_PATH/cmake" \
-G Ninja \
-S . \
-B build \
-D CMAKE_MODULE_PATH="$REPO_PATH/build" \
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-D CMAKE_INSTALL_PREFIX="$REPO_PATH/prefix" \
-D CMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
-D CMAKE_VERBOSE_MAKEFILE=ON
- name: Build
run: |
cmake --build build --target install
- name: Create AppImage
run: |
mkdir -p $ROOT_PATH/otp-desktop.AppDir/usr
cp -r deploy/* $ROOT_PATH/otp-desktop.AppDir/
cd $ROOT_PATH
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
export QMAKE=$REPO_PATH/build/qt/bin/qmake
./linuxdeploy-x86_64.AppImage -e $REPO_PATH/prefix/bin/otp-desktop --appdir $ROOT_PATH/otp-desktop.AppDir --plugin qt
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage $ROOT_PATH/otp-desktop.AppDir
- name: Upload binaries
if: ${{ matrix.config.artifact != '' }}
uses: actions/upload-artifact@v2
with:
path: ${{ env.ROOT_PATH }}/otp-desktop-x86_64.AppImage
name: ${{ matrix.config.artifact }}