Skip to content

Commit ee48086

Browse files
committed
Use jurplel/install-qt-action to install Qt
1 parent 777e603 commit ee48086

1 file changed

Lines changed: 44 additions & 58 deletions

File tree

.github/workflows/cmake.yml

Lines changed: 44 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,54 @@ on:
44
push:
55
branches:
66
- cmake1
7+
8+
defaults:
9+
run:
10+
shell: bash
711

812
jobs:
913
build-and-test:
10-
runs-on: ${{ matrix.os }}
1114
strategy:
12-
matrix:
13-
os: [ubuntu-latest, windows-latest]
14-
qt_version: [5, 6]
15-
python_version: ["3.8", "3.9", "3.10"]
1615
fail-fast: false
16+
matrix:
17+
os: ['ubuntu', 'windows']
18+
qt-version: [ '5.12.*', '5.15.*', '6.7.*', '6.8.*' ]
19+
python-version: [ '3.12' ]
20+
runs-on: ${{ matrix.os }}-latest
1721

1822
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v3
21-
22-
- name: Set up Python
23-
uses: actions/setup-python@v4
24-
with:
25-
python-version: ${{ matrix.python_version }}
26-
27-
- name: Install dependencies (Linux)
28-
if: runner.os == 'Linux'
29-
run: |
30-
sudo apt-get update
31-
if [ "${{ matrix.qt_version }}" = "5" ]; then
32-
sudo apt-get install -y qtbase5-dev qtbase5-private-dev qtchooser qt5-qmake qtbase5-dev-tools \
33-
libqt5svg5-dev qttools5-dev libqt5xmlpatterns5-dev qtmultimedia5-dev qtdeclarative5-dev \
34-
qtwebengine5-dev libqt5webkit5-dev
35-
echo "QTDIR=/usr/lib/x86_64-linux-gnu/qt5" | tee -a $GITHUB_ENV
36-
else
37-
sudo apt-get install -y qt6-base-dev qt6-base-private-dev qt6-5compat-dev qt6-base-dev-tools \
38-
libqt6svg6-dev qt6-multimedia-dev qt6-declarative-dev qt6-webengine-dev
39-
echo "QTDIR=/usr/lib/x86_64-linux-gnu/qt6" | tee -a $GITHUB_ENV
40-
fi
41-
42-
- name: Install dependencies (Windows)
43-
if: runner.os == 'Windows'
44-
run: |
45-
if ("${{ matrix.qt_version }}" -eq "5") {
46-
pip install aqtinstall
47-
aqt install-qt windows desktop 5.15.2 win64_msvc2019 -m all
48-
$Qt5Dir = "$env:USERPROFILE\Qt\5.15.2\msvc2019_64"
49-
echo "Qt5Dir=$Qt5Dir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
50-
echo "$Qt5Dir\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
51-
echo "QTDIR=$Qt5Dir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
52-
} else {
53-
choco install -y qt6-base-dev qt6-base-private-dev qt6-5compat-dev qt6-base-dev-tools `
54-
libqt6svg6-dev qt6-multimedia-dev qt6-declarative-dev qt6-webengine-dev `
55-
--params "/InstallationFolder C:/Qt/${{ matrix.qt_version }}"
56-
echo "C:/Qt/${{ matrix.qt_version }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
57-
echo "QTDIR=C:/Qt/${{ matrix.qt_version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
58-
}
59-
60-
- name: Configure CMake
61-
run: |
62-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
63-
64-
- name: Build project
65-
run: |
66-
cmake --build build --parallel --target all install
67-
68-
- name: Run tests
69-
run: |
70-
cd build
71-
ctest --output-on-failure
23+
24+
- name: Install MSVC
25+
if: ${{ matrix.os == 'windows' }}
26+
uses: ilammy/msvc-dev-cmd@v1
27+
with:
28+
arch: amd64
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: ${{ matrix.python_version }}
34+
35+
- name: Install Qt ${{matrix.qt-version}}
36+
uses: jurplel/install-qt-action@v4
37+
with:
38+
version: ${{ matrix.qt-version }}
39+
modules: ${{startsWith(matrix.qt-version, '6') && 'qt5compat qtscxml qtpositioning qtwebchannel qtmultimedia qtwebengine' || '' }}
40+
arch: ${{ (matrix.os == 'ubuntu' && (startsWith(matrix.qt-version, '5') && 'gcc_64' || 'linux_gcc_64')) || startsWith(matrix.qt-version, '5.12') && 'win64_msvc2017_64' || startsWith(matrix.qt-version, '6.8') && 'win64_msvc2022_64' || 'win64_msvc2019_64' }}
41+
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Configure CMake
46+
run: |
47+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
48+
49+
- name: Build project
50+
run: |
51+
cmake --build build --parallel --target all install
52+
53+
- name: Run tests
54+
run: |
55+
cd build
56+
ctest --output-on-failure
57+

0 commit comments

Comments
 (0)