-
Notifications
You must be signed in to change notification settings - Fork 3
153 lines (137 loc) · 4.29 KB
/
build-linux.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
name: Build Linux
on:
workflow_dispatch:
workflow_call:
push:
branches:
- 'master'
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
MODE: release
TARGET_OS: linux
ARCH: ${{ matrix.arch }}
TARGET_CPUREV: ${{ matrix.cpurev }}
JOBS: 4
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
arch: [amd64, i386, arm64, armhf]
cpurev: [legacy, default, modern]
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
# Purge PPA
- name: Purge PPA
run: |
sudo apt-get update
sudo apt-get install -y ppa-purge aptitude
sudo ppa-purge -y ppa:ubuntu-toolchain-r/test
# Cross-Compile Support
- name: Cross-Compile Support
uses: cyberjunk/gha-ubuntu-cross@v4
if: matrix.arch != 'amd64'
with:
arch: ${{ matrix.arch }}
# Ubuntu Packages
- name: Ubuntu Packages
run: sudo apt-get install clang llvm libx11-dev:$ARCH
# QEMU (ARM64/ARMHF)
- name: QEMU (ARM64/ARMHF)
if: matrix.arch == 'arm64' || matrix.arch == 'armhf' || matrix.arch == 'armel'
run: sudo apt-get install qemu-user qemu-user-static
# Set Environment Vars
- name: Set Environment Vars
run: |
if [ $ARCH == amd64 ]; then \
echo "TARGET_ARCH=x64" >> $GITHUB_ENV; \
echo "TARGET=x86_64-linux-gnu" >> $GITHUB_ENV; \
fi
if [ $ARCH == i386 ]; then \
echo "TARGET_ARCH=x86" >> $GITHUB_ENV; \
echo "TARGET=i686-linux-gnu" >> $GITHUB_ENV; \
fi
if [ $ARCH == arm64 ]; then \
echo "TARGET_ARCH=arm64" >> $GITHUB_ENV; \
echo "TARGET=aarch64-linux-gnu" >> $GITHUB_ENV; \
fi
if [ $ARCH == armhf ]; then \
echo "TARGET_ARCH=arm" >> $GITHUB_ENV; \
echo "TARGET=arm-linux-gnueabihf" >> $GITHUB_ENV; \
fi
# Clang Version
- name: Clang Version
run: clang --version
# Build
- name: Build
run: |
echo MODE: $MODE
echo ARCH: $ARCH
echo TARGET: $TARGET
echo TARGET_ARCH: $TARGET_ARCH
echo TARGET_CPUREV: $TARGET_CPUREV
clang++ --target=$TARGET -v
make -v
make -j${{ env.JOBS }}
# Binary Info
- name: Binary Info
if: matrix.arch == 'amd64' || matrix.arch == 'i386'
run: |
echo CppCore.Example.Server
ldd ./build/make/bin/linux-${{ env.TARGET_ARCH }}/CppCore.Example.Server
echo CppCore.Example.Client
ldd ./build/make/bin/linux-${{ env.TARGET_ARCH }}/CppCore.Example.Client
echo CppCore.Example.UI
ldd ./build/make/bin/linux-${{ env.TARGET_ARCH }}/CppCore.Example.UI
echo CppCore.Test
ldd ./build/make/bin/linux-${{ env.TARGET_ARCH }}/CppCore.Test
echo CppCore.Debug
ldd ./build/make/bin/linux-${{ env.TARGET_ARCH }}/CppCore.Debug
echo CppCore.Interface.C
ldd ./build/make/lib/linux-${{ env.TARGET_ARCH }}/libcppcore.so
# Test Native
- name: Test Native
run: make test
# Make (dist)
- name: Make (dist)
run: make dist -j${{ env.JOBS }}
# Install Python
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
# Make (dist-python)
- name: Make (dist-python)
run: |
python --version
python -m pip install build
make CppCore.Interface.Python
# Test Python
- name: Test Python
if: matrix.arch == 'amd64'
run: |
cd src/CppCore.Interface.Python
python -m pip install pytest crc32c pbkdf2-reboot
pytest
# Upload Packages
- name: Upload Packages
uses: actions/upload-artifact@v4
with:
name: Packages (${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.cpurev }})
path: |
./dist/${{ matrix.os }}/*.deb
./dist/${{ matrix.os }}/*.whl
# Upload to Github Release
- name: Upload to Github Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && (matrix.cpurev == 'default')
with:
token: ${{ secrets.PAT_GITHUB_ACTIONS }}
files: ./dist/${{ matrix.os }}/*.deb