From 75f710625e8c3e3eddcc9b8ec8f90ef5c4d629b6 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 30 Jan 2024 13:10:11 -0800 Subject: [PATCH] [ci] Upgrade to new macOS runner https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/ --- .github/workflows/cmake.yml | 12 ++++++------ .github/workflows/comment-command.yml | 4 ++-- .github/workflows/gradle.yml | 4 ++-- .github/workflows/lint-format.yml | 8 ++++---- cscore/src/main/native/objcpp/UsbCameraImpl.mm | 4 ++++ cscore/src/main/native/objcpp/UsbCameraListener.mm | 4 ++++ sysid/src/test/native/cpp/analysis/OLSTest.cpp | 8 ++++---- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6db3659e1ad..9e9769e527d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,11 +16,11 @@ jobs: name: Linux container: wpilib/roborio-cross-ubuntu:2024-22.04 flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON" - - os: macOS-12 + - os: macOS-14 name: macOS container: "" - env: "PATH=\"/usr/local/opt/protobuf@3/bin:$PATH\"" - flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF -DWITH_EXAMPLES=ON -DCMAKE_LIBRARY_PATH=/usr/local/opt/protobuf@3/lib -DProtobuf_INCLUDE_DIR=/usr/local/opt/protobuf@3/include -DProtobuf_PROTOC_EXECUTABLE=/usr/local/opt/protobuf@3/bin/protoc" + env: "PATH=\"/opt/homebrew/opt/protobuf@3/bin:$PATH\"" + flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF -DWITH_EXAMPLES=ON -DCMAKE_LIBRARY_PATH=/opt/homebrew/opt/protobuf@3/lib -DProtobuf_INCLUDE_DIR=/opt/homebrew/opt/protobuf@3/include -DProtobuf_PROTOC_EXECUTABLE=/opt/homebrew/opt/protobuf@3/bin/protoc" name: "Build - ${{ matrix.name }}" runs-on: ${{ matrix.os }} @@ -34,15 +34,15 @@ jobs: if: runner.os == 'Linux' run: wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf_1.3.3_amd64.deb && sudo apt install ./protoc-gen-quickbuf_1.3.3_amd64.deb - - name: Install opencv (macOS) + - name: Install dependencies (macOS) run: brew install opencv protobuf@3 ninja if: runner.os == 'macOS' - - name: Set up Python 3.8 (macOS) + - name: Set up Python 3.10 (macOS) if: runner.os == 'macOS' uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: '3.10' - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 diff --git a/.github/workflows/comment-command.yml b/.github/workflows/comment-command.yml index abb7acda929..0efdebb985f 100644 --- a/.github/workflows/comment-command.yml +++ b/.github/workflows/comment-command.yml @@ -33,10 +33,10 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}" NUMBER: ${{ github.event.issue.number }} - - name: Set up Python 3.8 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: '3.10' - name: Setup Java uses: actions/setup-java@v4 with: diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fa17ad13915..6f6d1b7fca6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -94,9 +94,9 @@ jobs: task: "copyAllOutputs" outputs: "build/allOutputs" build-dir: "c:\\work" - - os: macOS-12 + - os: macOS-14 artifact-name: macOS - architecture: x64 + architecture: aarch64 task: "build" outputs: "build/allOutputs" build-dir: "." diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 436f1650763..afbcde895c1 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -22,10 +22,10 @@ jobs: run: | git checkout -b pr git branch -f main origin/main - - name: Set up Python 3.8 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: '3.10' - name: Install wpiformat run: pip3 install wpiformat==2023.36 - name: Run @@ -61,10 +61,10 @@ jobs: git config --global --add safe.directory /__w/allwpilib/allwpilib git checkout -b pr git branch -f main origin/main - - name: Set up Python 3.8 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: '3.10' - name: Install wpiformat run: pip3 install wpiformat - name: Create compile_commands.json diff --git a/cscore/src/main/native/objcpp/UsbCameraImpl.mm b/cscore/src/main/native/objcpp/UsbCameraImpl.mm index 5607fbf30ff..ce0744a45cd 100644 --- a/cscore/src/main/native/objcpp/UsbCameraImpl.mm +++ b/cscore/src/main/native/objcpp/UsbCameraImpl.mm @@ -135,7 +135,11 @@ CS_Source CreateUsbCameraPath(std::string_view name, std::string_view path, std::vector retval; NSArray* deviceTypes = @[ AVCaptureDeviceTypeBuiltInWideAngleCamera, +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 140000 + AVCaptureDeviceTypeExternal +#else AVCaptureDeviceTypeExternalUnknown +#endif ]; AVCaptureDeviceDiscoverySession* session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:deviceTypes diff --git a/cscore/src/main/native/objcpp/UsbCameraListener.mm b/cscore/src/main/native/objcpp/UsbCameraListener.mm index b6b59d37df3..049c781ac9d 100644 --- a/cscore/src/main/native/objcpp/UsbCameraListener.mm +++ b/cscore/src/main/native/objcpp/UsbCameraListener.mm @@ -76,7 +76,11 @@ - (void)camerasChanged:(NSNotification*)notification { if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera] || [device.deviceType +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 140000 + isEqualToString:AVCaptureDeviceTypeExternal]) { +#else isEqualToString:AVCaptureDeviceTypeExternalUnknown]) { +#endif self.notifier->NotifyUsbCamerasChanged(); } }); diff --git a/sysid/src/test/native/cpp/analysis/OLSTest.cpp b/sysid/src/test/native/cpp/analysis/OLSTest.cpp index 00d14b983cb..380a53d0865 100644 --- a/sysid/src/test/native/cpp/analysis/OLSTest.cpp +++ b/sysid/src/test/native/cpp/analysis/OLSTest.cpp @@ -14,8 +14,8 @@ TEST(OLSTest, TwoVariablesTwoPoints) { auto [coeffs, rSquared, rmse] = sysid::OLS(X, y); EXPECT_EQ(coeffs.size(), 2u); - EXPECT_DOUBLE_EQ(coeffs[0], 1.0); - EXPECT_DOUBLE_EQ(coeffs[1], 2.0); + EXPECT_NEAR(coeffs[0], 1.0, 1e-12); + EXPECT_NEAR(coeffs[1], 2.0, 1e-12); EXPECT_DOUBLE_EQ(rSquared, 1.0); } @@ -28,8 +28,8 @@ TEST(OLSTest, TwoVariablesFivePoints) { auto [coeffs, rSquared, rmse] = sysid::OLS(X, y); EXPECT_EQ(coeffs.size(), 2u); - EXPECT_DOUBLE_EQ(coeffs[0], 0.30487804878048774); - EXPECT_DOUBLE_EQ(coeffs[1], 1.5182926829268293); + EXPECT_NEAR(coeffs[0], 0.30487804878048774, 1e-12); + EXPECT_NEAR(coeffs[1], 1.5182926829268293, 1e-12); EXPECT_DOUBLE_EQ(rSquared, 0.91906029466386019); }