build: Bump nixpkgs to recent unstable #887
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull request | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
jobs: | |
lint: | |
name: Lint content | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
fetch-depth: 0 # Enable gitlint to check all PR commit messages | |
- uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 | |
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 | |
with: | |
name: linz | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: Cache pre-commit | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: ~/.cache/pre-commit | |
key: | |
${{ secrets.CACHE_SEED }}-${{ hashFiles('.pre-commit-config.yaml') | |
}} | |
- name: Run pre-commit hooks | |
run: nix-shell --pure --run 'pre-commit run --all-files' | |
- name: Check all commit messages in Pull Request | |
run: | |
nix-shell --pure --run 'gitlint --commits origin/${{ github.base_ref | |
}}..${{ github.event.pull_request.head.sha }}' | |
test-machine-readable-to-human-readable-date-time: | |
name: Test machine readable to human-readable date/time using Nix | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
working-directory: machine-readable-to-human-readable-date-time | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 | |
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 | |
with: | |
name: linz | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: Run test | |
run: nix-shell --pure --run 'LC_MESSAGES=C TZ=UTC mocha' | |
test-sentinel-water-extraction-nix: | |
name: Test Sentinel-${{ matrix.sentinel }} using Nix | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
working-directory: | |
flooding/sentinel${{ matrix.sentinel }}_water_extraction | |
strategy: | |
fail-fast: false | |
matrix: | |
sentinel: | |
- "1" | |
- "2" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 | |
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 | |
with: | |
name: linz | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: Run test | |
run: | |
nix-shell --pure --run 'jupyter nbconvert --debug --execute --inplace | |
--to=notebook sentinel${{ matrix.sentinel }}_water_extraction.ipynb' | |
test-sentinel-water-extraction-poetry: | |
name: | |
Test Sentinel-${{ matrix.sentinel }} on ${{ matrix.runner }}, using Poetry | |
with Python ${{ matrix.python }} | |
runs-on: ${{ matrix.runner }} | |
defaults: | |
run: | |
shell: bash --login -o errexit {0} # https://github.com/conda-incubator/setup-miniconda/tree/7e642bb2e4ca56ff706818a0febf72bb226d348d#use-a-default-shell | |
working-directory: | |
flooding/sentinel${{ matrix.sentinel }}_water_extraction | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: | |
- macos-12 | |
- ubuntu-22.04 | |
- ubuntu-24.04 | |
- windows-2022 | |
python: | |
- "3.9" | |
- "3.12" | |
sentinel: | |
- "1" | |
- "2" | |
include: | |
- runner: macos-12 | |
pip-cache-dir: ~/Library/Caches/pip | |
- runner: ubuntu-22.04 | |
pip-cache-dir: ~/.cache/pip | |
- runner: ubuntu-24.04 | |
pip-cache-dir: ~/.cache/pip | |
- runner: windows-2022 | |
pip-cache-dir: ~\AppData\Local\pip\Cache | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- name: Cache pip packages | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: ${{ matrix.pip-cache-dir }} | |
key: | |
${{ runner.os }}-pip-${{ secrets.CACHE_SEED }}-${{ matrix.python | |
}}-${{ hashFiles('./flooding/sentinel${{ matrix.sentinel | |
}}_water_extraction/poetry.lock') }} | |
restore-keys: | |
${{ runner.os }}-pip-${{ secrets.CACHE_SEED }}-${{ matrix.python }} | |
- name: Cache Conda packages | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ secrets.CACHE_SEED }}-${{ matrix.python | |
}} | |
- name: Get GDAL Python package version | |
run: | | |
GDAL_VERSION="$(grep --max-count=1 --only-matching 'file = "gdal-.*\.tar\.gz"' poetry.lock)" | |
# Use character removal compatible with macOS 12 | |
GDAL_VERSION="${GDAL_VERSION#?????????????}" | |
GDAL_VERSION="${GDAL_VERSION%????????}" | |
echo "GDAL_VERSION=$GDAL_VERSION" >> $GITHUB_ENV | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4 | |
with: | |
channels: conda-forge | |
python-version: ${{ matrix.python }} | |
- name: Install GDAL | |
run: | |
conda install --channel=conda-forge --quiet --yes gdal=${{ | |
env.GDAL_VERSION }} | |
- name: Install Poetry | |
run: pipx install poetry==1.8.3 | |
- name: Install Python packages on non-Windows runner | |
run: poetry install --only=main --no-root | |
if: ${{ !startsWith(runner.os, 'Windows') }} | |
- name: | |
Install Python packages on Windows runner (Workaround for | |
https://github.com/python-poetry/poetry/issues/1031) | |
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 | |
with: | |
timeout_minutes: 9999 # Workaround for https://github.com/nick-fields/retry/issues/107 | |
max_attempts: 6 | |
command: bash --login -o errexit -c 'cd flooding/sentinel${{ | |
matrix.sentinel }}_water_extraction && poetry install --only=main | |
--no-root' # Workaround for https://github.com/python-poetry/poetry/issues/7363 / https://github.com/nick-fields/retry/issues/89 | |
shell: bash | |
if: ${{ startsWith(runner.os, 'Windows') }} | |
- name: Run test | |
run: | |
poetry run jupyter nbconvert --debug --execute --inplace --to=notebook | |
sentinel${{ matrix.sentinel }}_water_extraction.ipynb | |
finalise: | |
if: always() | |
needs: | |
- lint | |
- test-machine-readable-to-human-readable-date-time | |
- test-sentinel-water-extraction-nix | |
- test-sentinel-water-extraction-poetry | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 | |
with: | |
jobs: ${{ toJSON(needs) }} |