Skip to content

Commit

Permalink
Support GitHub Actions's new macOS 14 runners
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 8211872
Author: Paul Colby <git@colby.id.au>
Date:   Wed Apr 24 20:50:20 2024 +1000

    Exclude Qt 6.2 on macOS 14

commit 1bebfa9
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 22:01:47 2024 +1000

    Exclude CI builds with Qt 5.x and GCC on macOS 13

commit 5c7a381
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 22:00:27 2024 +1000

    Restore Linux and Windows CI builds

commit b26a09b
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:58:49 2024 +1000

    Restore Qt5 builds for macOS on GitHub Actions

commit a4d36c5
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:55:23 2024 +1000

    Include macOS version in artifact names

commit 8db5007
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:51:07 2024 +1000

    Don't use `matrix` in `jobs.if`

    GitHub Actions does not allow out.

commit 5f4625a
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:47:02 2024 +1000

    Build and test all supported macOS versions

commit 6d5e416
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:44:57 2024 +1000

    Skip yet another unsafe test on GitHhub Action's macOS 14 runners

commit cb83271
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:44:23 2024 +1000

    Skip one more unsafe test on GitHhub Action's macOS 14 runners

commit f8faae2
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:41:29 2024 +1000

    Skip more unsafe tests on GitHhub Action's macOS 14 runners

commit 4d993ab
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:37:17 2024 +1000

    Restrict to just MacOs w/ Qt6 builds for now

commit 3a65f33
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:36:02 2024 +1000

    Skip unsafe tests on GitHhub Action's macOS 14 runners

commit 9679720
Author: Paul Colby <git@colby.id.au>
Date:   Tue Apr 23 21:35:14 2024 +1000

    Stick with MacOS 12 for Qt5 builds

    Later MacOS versions are not supported by Qt5.
  • Loading branch information
pcolby committed Apr 24, 2024
1 parent f713a7d commit 6252912
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 4 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,35 @@ jobs:
if-no-files-found: error

mac:
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
qt: [ '5.9.9', '5.10.1', '5.11.3', '5.12.12', '5.13.2', '5.14.2', '5.15.2', '6.2.4', '6.3.2', '6.4.3', '6.5.3', '6.6.3' ]
os: [ 'macos-12', 'macos-13', 'macos-14' ]
env:
- { cc: clang, cxx: clang++, coverage: false }
- { cc: gcc-12, cxx: g++-12, coverage: false }
- { cc: gcc-12, cxx: g++-12, coverage: true }
exclude:
# Exclude Qt 5.x with GCC on macOS 13 (Qt5 only officially supports up to macOS 12).
- { qt: '5.9.9', os: 'macos-13', env: { cc: gcc-12 } }
- { qt: '5.10.1', os: 'macos-13', env: { cc: gcc-12 } }
- { qt: '5.11.3', os: 'macos-13', env: { cc: gcc-12 } }
- { qt: '5.12.12', os: 'macos-13', env: { cc: gcc-12 } }
- { qt: '5.13.2', os: 'macos-13', env: { cc: gcc-12 } }
- { qt: '5.14.2', os: 'macos-13', env: { cc: gcc-12 } }
- { qt: '5.15.2', os: 'macos-13', env: { cc: gcc-12 } }
# Exclude Qt 5.x on macOS 14+ (Qt5 only officially supports up to macOS 12).
- { qt: '5.9.9', os: 'macos-14' }
- { qt: '5.10.1', os: 'macos-14' }
- { qt: '5.11.3', os: 'macos-14' }
- { qt: '5.12.12', os: 'macos-14' }
- { qt: '5.13.2', os: 'macos-14' }
- { qt: '5.14.2', os: 'macos-14' }
- { qt: '5.15.2', os: 'macos-14' }
# Exclude Qt 6.2 on macOS 14+ (Qt6 only officially supports macOS 14 from Qt 6.4+, and some 6.2.n LTS update).
- { qt: '6.2.4', os: 'macos-14' }
# Exclude Qt 5.10 with GCC on macOS. See https://bugreports.qt.io/browse/QTBUG-66585
- { qt: '5.10.1', env: { cc: gcc-12 } }
# Exclude Qt6 with GCC on macOS for now, as GCC (only) has lots of false compiler
Expand Down Expand Up @@ -218,7 +237,7 @@ jobs:
CC: ${{ matrix.env.cc }}
CXX: ${{ matrix.env.cxx }}
CMAKE_OSX_ARCHITECTURES: ${{ startsWith(matrix.qt, '6') && 'arm64;' || '' }}x86_64
PROJECT_BUILD_ID: ${{ github.run_number }}.mac.${{ startsWith(matrix.qt, '6') && 'arm64-' || '' }}x86_64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}
PROJECT_BUILD_ID: ${{ github.run_number }}.${{ matrix.os }}.${{ startsWith(matrix.qt, '6') && 'arm64-' || '' }}x86_64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release \
-D CODECOV_GCOV=${{ startsWith(matrix.env.cc, 'gcc') && '/usr/local/bin/gcov-12' || '/usr/bin/gcov'}} \
Expand Down
2 changes: 1 addition & 1 deletion test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
find_package(Qt${QT_VERSION_MAJOR}Test REQUIRED)

function(add_dokit_unit_test name)
add_executable(test${name} ${ARGN})
add_executable(test${name} ${ARGN} ../github.h)

target_include_directories(test${name} PRIVATE ${CMAKE_SOURCE_DIR}/src/lib)

Expand Down
7 changes: 6 additions & 1 deletion test/unit/cli/testdevicecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "testdevicecommand.h"
#include "../github.h"

#include "devicecommand.h"

Expand Down Expand Up @@ -32,7 +33,7 @@ class MockDeviceCommand : public DeviceCommand
};

// Mock device command class that does nothing (but log) if real devices are actually discovered. That is, if testing
// while real (physical) Pokit devices are withing BLE range. This never happes in CI environments of course.
// while real (physical) Pokit devices are within BLE range. This never happes in CI environments of course.
class StartableDeviceCommand : public MockDeviceCommand
{
protected slots:
Expand All @@ -44,6 +45,10 @@ protected slots:

void TestDeviceCommand::start()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

StartableDeviceCommand command;

QVERIFY(command.deviceToScanFor.isNull());
Expand Down
9 changes: 9 additions & 0 deletions test/unit/cli/testdsocommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "testdsocommand.h"
#include "outputstreamcapture.h"
#include "testdata.h"
#include "../github.h"

#include "dsocommand.h"

Expand Down Expand Up @@ -367,6 +368,10 @@ void TestDsoCommand::processOptions_data()

void TestDsoCommand::processOptions()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(QStringList, arguments);
QFETCH(DsoService::Settings, expectedSettings);
QFETCH(minRangeFunc, expectedMinRangeFunc);
Expand Down Expand Up @@ -487,6 +492,10 @@ void TestDsoCommand::outputSamples_data()

void TestDsoCommand::outputSamples()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(DsoService::Metadata, metadata);
QFETCH(QList<DsoService::Samples>, samplesList);
QFETCH(AbstractCommand::OutputFormat, format);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/cli/testinfocommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "testinfocommand.h"
#include "outputstreamcapture.h"
#include "testdata.h"
#include "../github.h"

#include "infocommand.h"

Expand Down Expand Up @@ -87,6 +88,10 @@ void TestInfoCommand::serviceDetailsDiscovered_data()

void TestInfoCommand::serviceDetailsDiscovered()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(QBluetoothDeviceInfo, info);
QFETCH(AbstractCommand::OutputFormat, format);
LOADTESTDATA(expected);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/cli/testloggerfetchcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "testloggerfetchcommand.h"
#include "outputstreamcapture.h"
#include "testdata.h"
#include "../github.h"

#include "loggerfetchcommand.h"

Expand Down Expand Up @@ -95,6 +96,10 @@ void TestLoggerFetchCommand::outputSamples_data()

void TestLoggerFetchCommand::outputSamples()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(DataLoggerService::Metadata, metadata);
QFETCH(QList<DataLoggerService::Samples>, samplesList);
QFETCH(AbstractCommand::OutputFormat, format);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/cli/testmetercommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "testmetercommand.h"
#include "outputstreamcapture.h"
#include "testdata.h"
#include "../github.h"

#include "metercommand.h"

Expand Down Expand Up @@ -406,6 +407,10 @@ void TestMeterCommand::outputReading_data()

void TestMeterCommand::outputReading()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(QList<MultimeterService::Reading>, readings);
QFETCH(AbstractCommand::OutputFormat, format);
LOADTESTDATA(expected);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/cli/testscancommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "testscancommand.h"
#include "outputstreamcapture.h"
#include "testdata.h"
#include "../github.h"

#include "scancommand.h"

Expand Down Expand Up @@ -70,6 +71,10 @@ void TestScanCommand::processOptions()

void TestScanCommand::start()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

ScanCommand command(this);
QTest::ignoreMessage(QtInfoMsg, "Scanning for Pokit devices...");
command.start();
Expand Down
9 changes: 9 additions & 0 deletions test/unit/cli/teststatuscommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "teststatuscommand.h"
#include "outputstreamcapture.h"
#include "testdata.h"
#include "../github.h"

#include "statuscommand.h"

Expand Down Expand Up @@ -58,6 +59,10 @@ void TestStatusCommand::getService()

void TestStatusCommand::serviceDetailsDiscovered()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

StatusCommand command(this);
command.device = new PokitDevice(QBluetoothDeviceInfo(), &command);
command.service = command.device->status();
Expand Down Expand Up @@ -98,6 +103,10 @@ void TestStatusCommand::outputDeviceStatus_data()

void TestStatusCommand::outputDeviceStatus()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(StatusService::DeviceCharacteristics, chrs);
QFETCH(AbstractCommand::OutputFormat, format);
LOADTESTDATA(expected);
Expand Down
27 changes: 27 additions & 0 deletions test/unit/github.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: 2022-2024 Paul Colby <git@colby.id.au>
// SPDX-License-Identifier: LGPL-3.0-or-later

#ifndef DOKIT_TESTS_GITHUB_H
#define DOKIT_TESTS_GITHUB_H

#include <QOperatingSystemVersion>

/*!
* Returns \c true if the application is executing on a GitHub Actions runner, \c false otherwise.
*/
inline bool isGitHubActionsRunner()
{
return qgetenv("GITHUB_ACTIONS") == "true";
}

/*!
* Returns the host operating system's version information if executing on a GitHub Actions runners, otherwise
* a QOperatingSystemVersion::Unknown version.
*/
inline QOperatingSystemVersion gitHubActionsRunnerOsVersion()
{
return isGitHubActionsRunner() ? QOperatingSystemVersion::current()
: QOperatingSystemVersion(QOperatingSystemVersion::Unknown, -1);
}

#endif // DOKIT_TESTS_GITHUB_H
17 changes: 17 additions & 0 deletions test/unit/lib/testabstractpokitservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "testabstractpokitservice.h"
#include "../github.h"

#include <qtpokit/abstractpokitservice.h>
#include "abstractpokitservice_p.h"
Expand Down Expand Up @@ -63,6 +64,10 @@ void TestAbstractPokitService::service_()

void TestAbstractPokitService::createServiceObject()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

// Verify that creation will fail without a Bluetooth device controller
MockPokitService service(nullptr);
QCOMPARE(service.service(), nullptr);
Expand All @@ -88,6 +93,10 @@ void TestAbstractPokitService::createServiceObject()

void TestAbstractPokitService::getCharacteristic()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

{ // Verify an invalid characteristic is returned safely, when no controller is set.
MockPokitService service(nullptr);
const QLowEnergyCharacteristic characteristic = service.d_ptr->getCharacteristic(QUuid::createUuid());
Expand Down Expand Up @@ -198,6 +207,10 @@ void TestAbstractPokitService::toHexString()

void TestAbstractPokitService::connected()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

// Verify safe error handling.
{
MockPokitService service(nullptr);
Expand All @@ -211,6 +224,10 @@ void TestAbstractPokitService::connected()

void TestAbstractPokitService::discoveryFinished()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

// Verify safe error handling.
{
MockPokitService service(nullptr);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/lib/testcalibrationservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "testcalibrationservice.h"
#include "../github.h"

#include <qtpokit/calibrationservice.h>
#include "calibrationservice_p.h"
Expand All @@ -11,6 +12,10 @@

void TestCalibrationService::readCharacteristics()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

// readCharacteristics always returns true, since the service has no readable characterstics.
CalibrationService service(QLowEnergyController::createCentral(QBluetoothDeviceInfo()));
QVERIFY(service.readCharacteristics());
Expand Down
9 changes: 9 additions & 0 deletions test/unit/lib/testpokitdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "testpokitdevice.h"
#include "../github.h"

#include <qtpokit/pokitdevice.h>
#include "pokitdevice_p.h"
Expand Down Expand Up @@ -176,6 +177,10 @@ void TestPokitDevice::charcteristicToString()

void TestPokitDevice::setController()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

// Verify safe error handling (can't do much else without a Bluetooth device).
PokitDevice device(nullptr);
QCOMPARE(device.controller(), nullptr);
Expand Down Expand Up @@ -207,6 +212,10 @@ void TestPokitDevice::setController()

void TestPokitDevice::connected()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

// Verify safe error handling (can't do much else without a Bluetooth device).
PokitDevice device(nullptr);
QTest::ignoreMessage(QtCriticalMsg,
Expand Down
9 changes: 9 additions & 0 deletions test/unit/lib/testpokitproducts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "testpokitproducts.h"
#include "../github.h"

#include "pokitproducts_p.h"

Expand Down Expand Up @@ -117,6 +118,10 @@ void TestPokitProducts::isPokitProduct_Controller_data()

void TestPokitProducts::isPokitProduct_Controller()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(QBluetoothUuid, uuid);
QFETCH(bool, expected);

Expand Down Expand Up @@ -160,6 +165,10 @@ void TestPokitProducts::pokitProduct_Controller_data()

void TestPokitProducts::pokitProduct_Controller()
{
if (gitHubActionsRunnerOsVersion() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 14)) {
QSKIP("BLE controller operations hang on GitHub Actions's macOS 14 runners");
}

QFETCH(QBluetoothUuid, uuid);
QFETCH(PokitProduct, expected);

Expand Down

0 comments on commit 6252912

Please sign in to comment.