Skip to content

Test against recent GDAL tags #394

Test against recent GDAL tags

Test against recent GDAL tags #394

name: Test against recent GDAL tags
on:
schedule:
- cron: '0 3,15 * * *'
pull_request: # also build on PRs touching this file
paths:
- ".github/workflows/test_gdal_tags.yaml"
- ".github/workflows/test_gdal_build.yaml"
- "ci/gdal-compile.sh"
- "ci/get-new-tags.py"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
get_tags:
name: Find recent tags and generate test job matrix
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.fetch-tags.outputs.tags }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get artifacts of last workflow run
continue-on-error: true
run: |
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/rasterio/rasterio/actions/workflows/test_gdal_tags.yaml/runs > runs.json
jq '[.workflow_runs[0] | select(.conclusion != "cancelled") | select(.head_branch == "${{ github.ref_name }}")][0]' runs.json > last-run.json
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/rasterio/rasterio/actions/runs/$(jq '.id' last-run.json)/artifacts > artifacts.json
jq '.' artifacts.json
- name: Get failed GDAL refs from last workflow run
continue-on-error: true
run: |
jq '.artifacts[] | select(.name == "failures")' artifacts.json > artifact.json
jq '.archive_download_url' artifact.json
curl $(jq -r '.archive_download_url' artifact.json) > failed-gdal-refs.zip
unzip failed-gdal-refs.zip
ls -l *.json*
cat failed-gdal-refs.json
- run: test -f failed-gdal-refs.json || echo '[]' > failed-gdal-refs.json
- id: fetch-tags
run: |
curl -O https://github.com/osgeo/gdal/tags.atom
python3 ci/get-new-tags.py tags.atom 12 > tags.json
echo "tags=$(cat failed-gdal-refs.json tags.json | jq -s -c 'add | unique')"
echo "tags=$(cat failed-gdal-refs.json tags.json | jq -s -c 'add | unique')" >> "$GITHUB_OUTPUT"
test_gdal_tags:
uses: ./.github/workflows/test_gdal_build.yaml
with:
gdal_ref: ${{ matrix.gdal || 'master' }}
rasterio_ref: ${{ github.ref }}
if: needs.get_tags.outputs.tags != '[]'
needs: [get_tags]
strategy:
fail-fast: false
max-parallel: 6
matrix:
gdal: ${{ fromJSON(needs.get_tags.outputs.tags) }}
collect_failures:
runs-on: ubuntu-latest
needs: [test_gdal_tags]
steps:
- uses: actions/download-artifact@v3
- run: |
touch failure-default.json
cat failure-*.json | jq -s -c '[.[].gdal_ref] | unique' > failed-gdal-refs.json
cat failed-gdal-refs.json
- uses: actions/upload-artifact@v3
with:
name: failed-gdal-refs
path: failed-gdal-refs.json