maplibre_native 0.4.2

Rust bindings to the MapLibre Native map rendering engine
Documentation
name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:

defaults:
  run:
    shell: bash

env:
  # Otherwise egl initialisation fails
  # In CI we don't have a display-surface to render to
  EGL_PLATFORM: surfaceless
jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with: { persist-credentials: false }
      - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
      - run: rustup update stable && rustup default stable && rustup component add rustfmt && rustup component add clippy
      - uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 # v2.68.32
        with: { tool: 'just' }
      - run: just ci-lint
  test:
    name: Test ${{ matrix.runs-on }} - ${{ matrix.backend }}
    runs-on: ${{ matrix.runs-on }}
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        include:
          # Linux x86
          - runs-on: ubuntu-latest
            backend: vulkan
          - runs-on: ubuntu-latest
            backend: opengl
          # Linux ARM
          - runs-on: ubuntu-24.04-arm
            backend: vulkan
          # macOS ARM
          #- runs-on: macos-latest
          #  backend: metal
          #- runs-on: macos-latest
          #  backend: vulkan
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with: { persist-credentials: false }
      - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
      - uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 # v2.68.32
        with: { tool: 'just' }
      - run: just env-info install-dependencies '${{ matrix.backend }}'
      - run: rustup update stable && rustup default stable
      - run: just ci-test ${{ matrix.backend }}

  test-msrv:
    name: Test MSRV ${{ matrix.runs-on }} - ${{ matrix.backend }}
    runs-on: ${{ matrix.runs-on }}
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        include:
          # Linux x86
          - runs-on: ubuntu-latest
            backend: vulkan
          - runs-on: ubuntu-latest
            backend: opengl
          # Linux ARM
          - runs-on: ubuntu-24.04-arm
            backend: opengl
          # macOS ARM
          #- runs-on: macos-latest
          #  backend: metal
          #- runs-on: macos-latest
          #  backend: vulkan
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with: { persist-credentials: false }
      - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
      - uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 # v2.68.32
        with: { tool: 'just' }
      - run: just env-info install-dependencies '${{ matrix.backend }}'
      - name: Read MSRV
        id: msrv
        run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
      - name: Install MSRV Rust ${{ steps.msrv.outputs.value }}
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ steps.msrv.outputs.value }}
      - run: just ci_mode=0 ci-test-msrv ${{ matrix.backend }}  # Ignore warnings in MSRV

  # This final step is needed to mark the whole workflow as successful
  # Don't change its name - it is used by the merge protection rules
  ci-passed:
    needs: [ lint, test, test-msrv ]
    if: always()
    runs-on: ubuntu-latest
    permissions: {}
    steps:
      - name: Result of the needed steps
        run: echo "${{ toJSON(needs) }}"
      - if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
        run: exit 1

  # Release unpublished packages or create a PR with changes
  release-plz:
    needs: [ ci-passed ]
    if: |
      always()
      && needs.ci-passed.result == 'success'
      && github.event_name == 'push'
      && github.ref == 'refs/heads/main'
      && github.repository_owner == 'maplibre'
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
    concurrency:
      group: release-plz-${{ github.ref }}
      cancel-in-progress: false
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with: { persist-credentials: false }
      - uses: dtolnay/rust-toolchain@stable
      - name: Publish to crates.io if crate's version is newer
        uses: release-plz/action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5.128
        id: release
        with: { command: release }
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - if: ${{ steps.release.outputs.releases_created == 'false' }}
        name: If version is the same, create a PR proposing new version and changelog for the next release
        uses: release-plz/action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5.128
        with: { command: release-pr }
        env:
          GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}