From 2499baf748b426bae4a1391bfffcad344ba07cbf Mon Sep 17 00:00:00 2001 From: Tadej Novak Date: Wed, 19 Apr 2023 19:41:13 +0200 Subject: [PATCH] Run macOS workflows only on `opengl-2` branch (#1039) Co-authored-by: Bart Louwers --- .github/workflows/macos-ci.yml | 3 + .github/workflows/node-ci-mac.yml | 259 +++++++++++++++++++++++++++++ .github/workflows/node-ci.yml | 4 - .github/workflows/node-release.yml | 11 +- 4 files changed, 269 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/node-ci-mac.yml diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index c47d9c934bb..47cf3ca8227 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - opengl-2 tags: - 'macos-*' paths: @@ -27,6 +28,7 @@ on: pull_request: branches: - main + - opengl-2 paths: - 'platform/ios/**' - 'platform/darwin/**' @@ -131,6 +133,7 @@ jobs: ctest -VV --test-dir $BUILD_DIR -R mbgl-test-runner env: BUILD_DIR: ../../../maplibre-gl-native-macostestbuild + if: ${{ github.ref != 'refs/heads/main' }} - name: Check public symbols run: make darwin-check-public-symbols diff --git a/.github/workflows/node-ci-mac.yml b/.github/workflows/node-ci-mac.yml new file mode 100644 index 00000000000..f5407eb71ed --- /dev/null +++ b/.github/workflows/node-ci-mac.yml @@ -0,0 +1,259 @@ +# Note: this workflow has been copied from node-ci.yml +# That workflow runs for main, this one runs for opengl-2 due to +# the lacking OpenGL ES 3.0 support on macOS. +# Once the Metal backend is completed this workflow can be removed. + +name: node-ci + +on: + workflow_dispatch: + push: + branches: + - opengl-2 + tags: + - 'node-*' + paths: + - "platform/default/**" + - 'platform/node/**' + - 'platform/windows/**' + - 'platform/darwin/**' + - 'platform/macos/**' + - 'platform/ios/platform/darwin/**' + - 'platform/ios/platform/macos/**' + - ".github/workflows/node-ci.yml" + - "bin/**" + - "expression-test/**" + - "include/**" + - "metrics/**" + - "render-test/**" + - "scripts/**" + - "src/**" + - "test/**" + - "vendor/**" + - ".gitmodules" + - "!**/*.md" + + pull_request: + branches: + - opengl-2 + paths: + - "platform/default/**" + - 'platform/node/**' + - 'platform/windows/**' + - 'platform/darwin/**' + - 'platform/macos/**' + - 'platform/ios/platform/darwin/**' + - 'platform/ios/platform/macos/**' + - ".github/workflows/node-ci.yml" + - "bin/**" + - "expression-test/**" + - "include/**" + - "metrics/**" + - "render-test/**" + - "scripts/**" + - "src/**" + - "test/**" + - "vendor/**" + - ".gitmodules" + - "!**/*.md" + +concurrency: + # cancel jobs on PRs only + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + test: + runs-on: ${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + include: + - runs-on: macos-12 + arch: x86_64 + - runs-on: macos-12-arm + arch: arm64 + continue-on-error: true + env: + BUILDTYPE: 'Release' + + defaults: + run: + working-directory: ./ + shell: bash + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup submodules + shell: bash + run: | + auth_header="$(git config --local --get http.https://github.com/.extraheader)" + git submodule sync --recursive + git -c core.longpaths=true -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive || true + + - name: Get OS Architecture + if: runner.os == 'MacOS' || runner.os == 'Linux' + run: uname -m + + - name: Install dependencies (MacOS) + if: runner.os == 'MacOS' + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + run: | + brew list cmake || brew install cmake + brew list ccache || brew install ccache + brew list ninja || brew install ninja + brew list pkg-config || brew install pkg-config + brew list glfw || brew install glfw + brew list libuv || brew install libuv + + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get update + sudo apt-get install -y \ + ccache \ + cmake \ + ninja-build \ + pkg-config \ + xvfb \ + libcurl4-openssl-dev \ + libglfw3-dev \ + libuv1-dev \ + g++-10 \ + libc++-9-dev \ + libc++abi-9-dev \ + libjpeg-dev \ + libpng-dev + /usr/sbin/update-ccache-symlinks + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: npm ci + run: npm ci --ignore-scripts + + - name: Set up msvc dev cmd (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + + - name: Set up ccache (MacOS/Linux) + if: runner.os == 'MacOS' || runner.os == 'Linux' + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} + restore-keys: | + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }} + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }} + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }} + + - name: Set up ccache (Windows) + if: runner.os == 'Windows' + uses: hendrikmuhs/ccache-action@v1 + with: + variant: 'sccache' + key: ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} + restore-keys: | + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }} + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }} + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }} + + - name: Configure maplibre-gl-native (MacOS) + if: runner.os == 'MacOS' + run: | + cmake . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + + - name: Configure maplibre-gl-native (Linux) + if: runner.os == 'Linux' + run: | + cmake . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER=gcc-10 \ + -DCMAKE_CXX_COMPILER=g++-10 + + - name: "Create directory '${{ github.workspace }}/platform/windows/vendor/vcpkg/bincache' (Windows)" + if: runner.os == 'Windows' + run: mkdir -p ${{ github.workspace }}/platform/windows/vendor/vcpkg/bincache + shell: bash + + - name: Restore vcpkg cache (Windows) + if: runner.os == 'Windows' + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/platform/windows/vendor/vcpkg + !${{ github.workspace }}/platform/windows/vendor/vcpkg/buildtrees + !${{ github.workspace }}/platform/windows/vendor/vcpkg/packages + !${{ github.workspace }}/platform/windows/vendor/vcpkg/downloads + !${{ github.workspace }}/platform/windows/vendor/vcpkg/installed + key: | + ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ hashFiles( '.git/modules/platform/windows/vendor/vcpkg/HEAD' ) }}-${{ hashFiles( 'platform/windows/Get-VendorPackages.ps1' ) }} + + - name: Configure maplibre-gl-native (Windows) + if: runner.os == 'Windows' + run: | + cmake . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + + - name: Build maplibre-gl-native (MacOS/Linux) + if: runner.os == 'MacOS' || runner.os == 'Linux' + run: | + cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null) + + - name: Build maplibre-gl-native (Windows) + if: runner.os == 'Windows' + run: | + cmake --build build + + - name: Run render tests on macOS + if: runner.os == 'macOS' + run: set -o pipefail && ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json + + - name: Upload render test artifacts (MacOS) + if: runner.os == 'MacOS' + uses: actions/upload-artifact@v3 + with: + name: render-query-test-results + path: metrics/macos-xcode11-release-style.html + + - name: Test (Linux) + if: runner.os == 'Linux' + run: xvfb-run --auto-servernum npm test + + - name: Test (MacOS) + if: runner.os == 'MacOS' + run: npm test + + - name: Test (Windows) + if: runner.os == 'Windows' + shell: pwsh + env: + LIBGL_ALWAYS_SOFTWARE: true + GALLIUM_DRIVER: softpipe + run: | + Invoke-WebRequest https://github.com/pal1000/mesa-dist-win/releases/download/22.3.5/mesa3d-22.3.5-release-msvc.7z -OutFile mesa3d.7z + & 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v108 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll + npm test + + # On PRs make sure that the npm package can be packaged. + - name: Pack + if: github.ref != 'refs/heads/main' + run: | + npm pack --dry-run + diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index f40054fe6d5..375a5eb5647 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -68,10 +68,6 @@ jobs: arch: x86_64 - runs-on: [self-hosted, linux, ARM64] arch: arm64 - - runs-on: macos-12 - arch: x86_64 - - runs-on: macos-12-arm - arch: arm64 - runs-on: windows-2022 arch: x86_64 continue-on-error: true diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml index 44c28df895e..4fdd6382a88 100644 --- a/.github/workflows/node-release.yml +++ b/.github/workflows/node-release.yml @@ -57,10 +57,13 @@ jobs: arch: x86_64 - runs-on: [self-hosted, linux, ARM64] arch: arm64 - - runs-on: macos-12 - arch: x86_64 - - runs-on: macos-12-arm - arch: arm64 + # Disabled until Metal backend is complete + # A release for macOS can be made from the opengl-2 branch + + # - runs-on: macos-12 + # arch: x86_64 + # - runs-on: macos-12-arm + # arch: arm64 - runs-on: windows-2022 arch: x86_64 needs: bump_version