Skip to content

Commit ec21878

Browse files
committed
Improve CI
1 parent 48b9781 commit ec21878

File tree

1 file changed

+84
-21
lines changed

1 file changed

+84
-21
lines changed

.github/workflows/ci.yml

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ on:
99
- main
1010

1111
jobs:
12-
build-and-test:
12+
install-dependencies:
1313
runs-on: ubuntu-latest
14-
1514
steps:
1615
- name: Checkout repository
1716
uses: actions/checkout@v3
@@ -26,68 +25,132 @@ jobs:
2625
sudo apt-get update
2726
sudo apt-get install -y qt6-base-dev qt6-declarative-dev qt6-serialport-dev
2827
28+
build-qt5:
29+
runs-on: ubuntu-latest
30+
needs: install-dependencies
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
2935
- name: Configure CMake for Qt5
3036
run: cmake -B build_qt5 -DQT_VERSION=5
3137

3238
- name: Build project with Qt5
3339
run: cmake --build build_qt5
3440

35-
- name: Configure CMake for Qt6
36-
run: cmake -B build_qt6 -DQT_VERSION=6
37-
38-
- name: Build project with Qt6
39-
run: cmake --build build_qt6
40-
4141
- name: Compile C test client
4242
run: gcc -o test/test_tcp test/test_tcp.c
4343

4444
- name: Compile C++ test client
4545
run: g++ -std=c++17 -o test/test_tcp_cpp test/test_tcp.cpp
4646

47+
- name: Upload Qt5 build artifacts
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: qt5-build-artifacts
51+
path: |
52+
build_qt5/qCommTest
53+
test/test_tcp
54+
test/test_tcp_cpp
55+
test/test_tcp.py
56+
57+
test-qt5:
58+
runs-on: ubuntu-latest
59+
needs: build-qt5
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v3
63+
64+
- name: Download Qt5 build artifacts
65+
uses: actions/download-artifact@v3
66+
with:
67+
name: qt5-build-artifacts
68+
4769
- name: Run Qt5 application and C test
4870
run: |
49-
QT_QPA_PLATFORM=offscreen ./build_qt5/qCommTest -p 6666 &
71+
QT_QPA_PLATFORM=offscreen ./qCommTest -p 6666 &
5072
sleep 2 # Give the server time to start
51-
./test/test_tcp
73+
./test_tcp
5274
killall qCommTest || true # Kill the application, '|| true' to prevent failure if not found
5375
working-directory: ${{ github.workspace }}
5476

5577
- name: Run Qt5 application and C++ test
5678
run: |
57-
QT_QPA_PLATFORM=offscreen ./build_qt5/qCommTest -p 6666 &
79+
QT_QPA_PLATFORM=offscreen ./qCommTest -p 6666 &
5880
sleep 2 # Give the server time to start
59-
./test/test_tcp_cpp
81+
./test_tcp_cpp
6082
killall qCommTest || true
6183
working-directory: ${{ github.workspace }}
6284

6385
- name: Run Qt5 application and Python test
6486
run: |
65-
QT_QPA_PLATFORM=offscreen ./build_qt5/qCommTest -p 6666 &
87+
QT_QPA_PLATFORM=offscreen ./qCommTest -p 6666 &
6688
sleep 2 # Give the server time to start
67-
python3 test/test_tcp.py
89+
python3 test_tcp.py
6890
killall qCommTest || true
6991
working-directory: ${{ github.workspace }}
7092

93+
build-qt6:
94+
runs-on: ubuntu-latest
95+
needs: install-dependencies
96+
steps:
97+
- name: Checkout repository
98+
uses: actions/checkout@v3
99+
100+
- name: Configure CMake for Qt6
101+
run: cmake -B build_qt6 -DQT_VERSION=6
102+
103+
- name: Build project with Qt6
104+
run: cmake --build build_qt6
105+
106+
- name: Compile C test client
107+
run: gcc -o test/test_tcp test/test_tcp.c
108+
109+
- name: Compile C++ test client
110+
run: g++ -std=c++17 -o test/test_tcp_cpp test/test_tcp.cpp
111+
112+
- name: Upload Qt6 build artifacts
113+
uses: actions/upload-artifact@v3
114+
with:
115+
name: qt6-build-artifacts
116+
path: |
117+
build_qt6/qCommTest
118+
test/test_tcp
119+
test/test_tcp_cpp
120+
test/test_tcp.py
121+
122+
test-qt6:
123+
runs-on: ubuntu-latest
124+
needs: build-qt6
125+
steps:
126+
- name: Checkout repository
127+
uses: actions/checkout@v3
128+
129+
- name: Download Qt6 build artifacts
130+
uses: actions/download-artifact@v3
131+
with:
132+
name: qt6-build-artifacts
133+
71134
- name: Run Qt6 application and C test
72135
run: |
73-
QT_QPA_PLATFORM=offscreen ./build_qt6/qCommTest -p 6666 &
136+
QT_QPA_PLATFORM=offscreen ./qCommTest -p 6666 &
74137
sleep 2 # Give the server time to start
75-
./test/test_tcp
138+
./test_tcp
76139
killall qCommTest || true
77140
working-directory: ${{ github.workspace }}
78141

79142
- name: Run Qt6 application and C++ test
80143
run: |
81-
QT_QPA_PLATFORM=offscreen ./build_qt6/qCommTest -p 6666 &
144+
QT_QPA_PLATFORM=offscreen ./qCommTest -p 6666 &
82145
sleep 2 # Give the server time to start
83-
./test/test_tcp_cpp
146+
./test_tcp_cpp
84147
killall qCommTest || true
85148
working-directory: ${{ github.workspace }}
86149

87150
- name: Run Qt6 application and Python test
88151
run: |
89-
QT_QPA_PLATFORM=offscreen ./build_qt6/qCommTest -p 6666 &
152+
QT_QPA_PLATFORM=offscreen ./qCommTest -p 6666 &
90153
sleep 2 # Give the server time to start
91-
python3 test/test_tcp.py
154+
python3 test_tcp.py
92155
killall qCommTest || true
93-
working-directory: ${{ github.workspace }}
156+
working-directory: ${{ github.workspace }}

0 commit comments

Comments
 (0)