-
-
Notifications
You must be signed in to change notification settings - Fork 63
128 lines (112 loc) · 5.13 KB
/
ubuntu.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
# Author: Kang Lin <[email protected]>
name: build_ubuntu
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_ubuntu.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build_ubuntu:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
os: [ubuntu-24.04, ubuntu-24.04-arm, ubuntu-22.04-arm]
# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
# See: https://github.com/actions/runner-images/
runs-on: ${{matrix.os}}
env:
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOLS_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.os}}_${{matrix.BUILD_TYPE}}
artifact_name: build_ubuntu
SerialPortAssistant_VERSION: 0.5.30
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Make directories
run: |
cmake -E make_directory ${{env.BUILD_DIR}}
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOLS_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Install dependency libraries
run: |
sudo ./Script/build_depend.sh --apt_update --base --default \
--install ${{env.INSTALL_DIR}} \
--source ${{env.SOURCE_DIR}} \
--tools ${{env.TOOLS_DIR}} \
--build ${{env.BUILD_DIR}}
if [ "ubuntu-22.04-arm" != ${{matrix.os}} ]; then
sudo apt install -y -q qt6-5compat-dev
fi
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: install_ubuntu_${{matrix.os}}_${{matrix.BUILD_TYPE}}
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: build_debpackage.sh
working-directory: ${{github.workspace}}
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
./Script/build_debpackage.sh
- name: Update configure file
working-directory: ${{github.workspace}}
if: ${{ matrix.BUILD_TYPE == 'Release' }}
run: |
sudo Xvfb :97 -ac -screen 0 1200x900x24 &
export DISPLAY=:97.0
export ARCH=`dpkg --print-architecture`
export OS_NAME="ubuntu-`lsb_release -s -r`"
cp ../serialportassistant_${{env.SerialPortAssistant_VERSION}}_${ARCH}.deb serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb
sudo apt install ./serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb
echo "test ......"
./Script/test_linux.sh
echo "Update configure file ......"
MD5=`md5sum serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb | awk '{print $1}'`
export QT_XCB_GL_INTEGRATION=none
ulimit -c unlimited
echo "# sudo sysctl -w kernel.core_pattern=core"
sudo sysctl -w kernel.core_pattern=${{github.workspace}}/core
/opt/SerialPortAssistant/bin/SerialPortAssistant.sh \
-f "`pwd`/update_ubuntu_${OS_NAME}_${ARCH}.json" \
--foc 1 \
--md5 ${MD5} \
-m "${{env.SerialPortAssistant_VERSION}}" \
-p serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb \
-u "https://github.com/KangLin/SerialPortAssistant/releases/download/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb;https://sourceforge.net/projects/SerialPortAssistant/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb?viasf=1"
- name: Update version configure file
if: ${{ matrix.BUILD_TYPE == 'Release' }}
working-directory: ${{github.workspace}}
run: |
sudo Xvfb :98 -ac &
export DISPLAY=:98.0
/opt/SerialPortAssistant/bin/SerialPortAssistant.sh \
-f "${{github.workspace}}/version.json" \
--foc 0 \
--pv ${{env.SerialPortAssistant_VERSION}}
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}_${{matrix.os}}
path: |
${{github.workspace}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}*.deb
${{github.workspace}}/update_*.json
${{github.workspace}}/version.json