proj 0.31.0

High-level Rust bindings for the latest stable version of PROJ
Documentation
name: proj ci

on:
  push:
    branches:
      - main
      - staging
      - trying
  pull_request:
  merge_group:
  schedule: [cron: "45 6 * * *"]

env:
  LIBPROJ_VERSION: 9.6.2
  RUST_MSRV: "1.85"
  RUST_LATEST: "1.88"

jobs:
  # work around GHA env strictness
  compute:
    runs-on: ubuntu-latest
    outputs:
      RUST_MSRV: ${{ env.RUST_MSRV }}
      RUST_LATEST: ${{ env.RUST_LATEST }}
      LIBPROJ_VERSION: ${{ env.LIBPROJ_VERSION }}
    steps:
      - name: Compute outputs
        run: |
          echo "RUST_MSRV=${{ env.RUST_MSRV }}" >> $GITHUB_OUTPUT
          echo "RUST_LATEST=${{ env.RUST_LATEST }}" >> $GITHUB_OUTPUT
          echo "LIBPROJ_VERSION=${{ env.LIBPROJ_VERSION }}" >> $GITHUB_OUTPUT
  # The `ci-result` job doesn't actually test anything - it just aggregates the
  # overall build status, otherwise the merge queue would need an entry
  # for each individual job produced by the job-matrix.
  #
  # Ref: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
  #
  # ALL THE SUBSEQUENT JOBS NEED THEIR key ADDED TO THE `needs` SECTION OF THIS JOB!
  ci-success:
    name: ci result
    runs-on: ubuntu-latest
    if: ${{ success() }}
    needs:
      - proj-ubuntu
      - proj-sys-ubuntu
      - proj-macos
      - proj-sys-macos
    steps:
      - name: Mark the job as a success
        run: exit 0

  ci-failure:
    name: ci result
    runs-on: ubuntu-latest
    if: ${{ failure() }}
    needs:
      - proj-ubuntu
      - proj-sys-ubuntu
      - proj-macos
      - proj-sys-macos
    steps:
      - name: Mark the job as a failure
        run: exit 1

  proj-ubuntu:
    name: proj ubuntu
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    needs: compute
    strategy:
      fail-fast: false
      matrix:
        rust_version:
          # Minimum supported rust (MSRV)
          - ${{ needs.compute.outputs.RUST_MSRV }}
          # Latest stable rust
          - ${{ needs.compute.outputs.RUST_LATEST }}
        features:
          - ""
          - "--features network"
          - "--features bundled_proj"
          - "--no-default-features"
          - '--features "network bundled_proj"'
          - '--features "network geo-types"'
          - '--features "bundled_proj geo-types"'
          - '--features "network bundled_proj geo-types"'
    container:
      image: ghcr.io/georust/proj-ci:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - if: matrix.rust_version  == env.RUST_LATEST
        run: |
          cargo build ${{ matrix.features }}
          cargo test ${{ matrix.features }}
      - uses: taiki-e/install-action@cargo-hack
        if: matrix.rust_version == env.RUST_MSRV
      - uses: taiki-e/install-action@cargo-minimal-versions
        if: matrix.rust_version == env.RUST_MSRV
      - if: matrix.rust_version == env.RUST_MSRV
        run: |
          cargo minimal-versions build ${{ matrix.features }} --direct
          cargo minimal-versions test ${{ matrix.features }} --direct

  proj-macos:
    name: proj macos
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: macos-latest
    strategy:
      fail-fast: false
      matrix:
        features: ["", "--features network"]
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - run: cargo build ${{ matrix.features }}
      - run: cargo test ${{ matrix.features }}

  proj-sys-ubuntu:
    name: proj-sys ubuntu
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    needs: compute
    defaults:
      run:
        working-directory: proj-sys
    container: ${{ matrix.container }}
    strategy:
      matrix:
        include:
          # Minimum supported rust (MSRV)
          - container:
              image: ghcr.io/georust/proj-ci:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ needs.compute.outputs.RUST_MSRV }}
              env:
                _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 0
            features: ""
          - container:
              image: ghcr.io/georust/proj-ci:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ needs.compute.outputs.RUST_MSRV }}
              env:
                _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 1
            features: "--features bundled_proj"
          - container:
              image: ghcr.io/georust/proj-ci-without-system-proj:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ needs.compute.outputs.RUST_MSRV }}
              env:
                _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 1
            features: ""

          # Latest stable rust
          - container:
              image: ghcr.io/georust/proj-ci:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ needs.compute.outputs.RUST_LATEST }}
              env:
                _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 0
            features: ""
          - container:
              image: ghcr.io/georust/proj-ci:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ needs.compute.outputs.RUST_LATEST }}
              env:
                _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 1
            features: "--features bundled_proj"
          - container:
              image: ghcr.io/georust/proj-ci-without-system-proj:proj-${{ needs.compute.outputs.LIBPROJ_VERSION }}-rust-${{ needs.compute.outputs.RUST_LATEST }}
              env:
                _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 1
            features: ""
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - if: matrix.rust_version  == env.RUST_LATEST
        run: |
          cargo build ${{ matrix.features }}
          cargo test ${{ matrix.features }}
      - uses: taiki-e/install-action@cargo-hack
        if: matrix.rust_version == env.RUST_MSRV
      - uses: taiki-e/install-action@cargo-minimal-versions
        if: matrix.rust_version == env.RUST_MSRV
      - if: matrix.rust_version == env.RUST_MSRV
        run: |
          cargo minimal-versions build ${{ matrix.features }} --direct
          cargo minimal-versions test ${{ matrix.features }} --direct

  proj-sys-macos:
    name: proj-sys macos
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: macos-latest
    env:
      _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC: 0
      HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: TRUE
    defaults:
      run:
        working-directory: proj-sys
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      # At some point around Feb. 2023, the GH macos CI runner no longer had
      # pkg-config installed by default, so we need to install it manually.
      #
      # This PR (merged a couple days ago) adds pkg-config back to the macos
      # build: https://github.com/actions/runner-images/pull/7125
      #
      # but it seems like it hasn't been deployed yet. At some point we should
      # be able to delete this step if CI passes.
      - run: brew update
      - run: brew install pkg-config
      - run: brew install proj
      - run: cargo test