diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 74acfdb8a46..a419dd475e9 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -62,6 +62,8 @@ jobs: arch: x86_64 - runs-on: macos-12-arm arch: arm64 + - runs-on: windows-2022 + arch: x86_64 continue-on-error: true env: BUILDTYPE: ${{github.ref == 'refs/heads/main' && 'Release' || 'Debug'}} @@ -72,21 +74,24 @@ jobs: shell: bash steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 with: - submodules: recursive 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: Setup node - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install dependencies macOS - if: runner.os == 'macOS' + - name: Install dependencies (MacOS) + if: runner.os == 'MacOS' env: HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 @@ -98,7 +103,7 @@ jobs: brew list glfw || brew install glfw brew list libuv || brew install libuv - - name: Install dependencies Linux + - name: Install dependencies (Linux) if: runner.os == 'Linux' env: DEBIAN_FRONTEND: noninteractive @@ -118,63 +123,98 @@ jobs: libc++abi-9-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: Prepare ccache - run: ccache --clear --set-config cache_dir=~/.ccache + - name: Set up msvc dev cmd (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 - - name: Cache ccache - uses: actions/cache@v3 - env: - cache-name: ccache-v1 - with: - path: ~/.ccache - key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} - restore-keys: | - ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }} - ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }} - ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }} - - - name: Clear ccache statistics + - name: Update ccache (Windows) + if: runner.os == 'Windows' run: | - ccache --zero-stats --set-config cache_dir=~/.ccache - ccache --max-size=2G --set-config cache_dir=~/.ccache - ccache --show-stats --set-config cache_dir=~/.ccache + choco.exe upgrade ccache + ccache.exe --version + echo "CCACHE_CONFIGPATH=C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf" >> $GITHUB_ENV - - name: CMake + - name: Set up ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.runs-on }} + + - name: Configure maplibre-gl-native (MacOS) if: runner.os == 'MacOS' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} + cmake . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - - name: CMake + - name: Configure maplibre-gl-native (Linux) if: runner.os == 'Linux' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 + 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: Configure maplibre-gl-native (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + cmake . -B build ^ + -G Ninja ^ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} ^ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache.exe - - name: Build + - 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: Run render tests on macOS - if: runner.os == 'macOS' + - name: Build maplibre-gl-native (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + cmake --build build + + - name: Run render tests on (MacOS) + if: runner.os == 'MacOS' run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json - - name: Upload render test artifacts + - name: Upload render test artifacts (MacOS) + if: runner.os == 'MacOS' uses: actions/upload-artifact@v3 - if: always() with: name: render-query-test-results path: metrics/macos-xcode11-release-style.html - - name: Test + - name: Test (Linux) if: runner.os == 'Linux' run: xvfb-run --auto-servernum npm test - - name: Test - if: runner.os == 'macOS' + - 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' diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml index b5da78a41e7..b72cc0ea594 100644 --- a/.github/workflows/node-release.yml +++ b/.github/workflows/node-release.yml @@ -70,24 +70,27 @@ jobs: shell: bash steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 with: - submodules: recursive fetch-depth: 0 - name: Get Latest Version run: git pull + - 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 --depth=1 || true + - name: Get OS Architecture + if: runner.os == 'MacOS' || runner.os == 'Linux' run: uname -m - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install dependencies macOS - if: runner.os == 'macOS' + - name: Install dependencies (MacOS) + if: runner.os == 'MacOS' env: HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 @@ -99,7 +102,7 @@ jobs: brew list glfw || brew install glfw brew list libuv || brew install libuv - - name: Install dependencies Linux + - name: Install dependencies (Linux) if: runner.os == 'Linux' env: DEBIAN_FRONTEND: noninteractive @@ -119,68 +122,67 @@ jobs: libc++abi-9-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: Prepare ccache - run: ccache --clear --set-config cache_dir=~/.ccache + - name: Set up msvc dev cmd (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 - - name: Cache ccache - uses: actions/cache@v3 - env: - cache-name: ccache-v1 - with: - path: ~/.ccache - key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} - restore-keys: | - ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }} - ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }} - ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }} - - - name: Clear ccache statistics + - name: Update ccache (Windows) + if: runner.os == 'Windows' run: | - ccache --zero-stats --set-config cache_dir=~/.ccache - ccache --max-size=2G --set-config cache_dir=~/.ccache - ccache --show-stats --set-config cache_dir=~/.ccache + choco.exe upgrade ccache + ccache.exe --version + echo "CCACHE_CONFIGPATH=C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf" >> $GITHUB_ENV + + - name: Set up ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.runs-on }} - - name: CMake + - name: Configure maplibre-gl-native (MacOS) if: runner.os == 'MacOS' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} + cmake . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - - name: CMake + - name: Configure maplibre-gl-native (Linux) if: runner.os == 'Linux' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 + 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: Configure maplibre-gl-native (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + cmake . -B build ^ + -G Ninja ^ + -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} ^ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache.exe - - name: Build + - 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: Run render tests on macOS - # if: runner.os == 'macOS' - # run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json - - #- name: Upload render test artifacts - # uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: render-query-test-results - # path: metrics/macos-xcode11-release-style.html - - #- name: Test - # if: runner.os == 'Linux' - # run: xvfb-run --auto-servernum npm test - - #- name: Test - # if: runner.os == 'macOS' && matrix.arch != 'arm64' - # run: 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 + - name: Build maplibre-gl-native (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + cmake --build build - name: Publish X64 Release to Github if: github.ref == 'refs/heads/main' && matrix.arch == 'x86_64'