name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
defaults:
run:
shell: bash
env:
EGL_PLATFORM: surfaceless
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: { persist-credentials: false }
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - run: rustup update stable && rustup default stable && rustup component add rustfmt && rustup component add clippy
- uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 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:
- runs-on: ubuntu-latest
backend: vulkan
- runs-on: ubuntu-latest
backend: opengl
- runs-on: ubuntu-24.04-arm
backend: vulkan
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: { persist-credentials: false }
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 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:
- runs-on: ubuntu-latest
backend: vulkan
- runs-on: ubuntu-latest
backend: opengl
- runs-on: ubuntu-24.04-arm
backend: opengl
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: { persist-credentials: false }
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 - uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 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 }}
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-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 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 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 with: { command: release-pr }
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}