Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 19 additions & 150 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,160 +1,29 @@
name: integration-matrix

# Calls the reusable workflow from OpenAstronomy/integration-dashboard,
# which reads `columns:` from packages.yaml to build the matrix, runs
# every column, and publishes the dashboard to gh-pages (or, on pull
# requests, uploads it as a preview artifact for preview-link.yml).
# The name above must stay in sync with `workflows:` in preview-link.yml.

on:
schedule:
- cron: '0 6 * * 0' # Sundays at 06:00 UTC
workflow_dispatch:
pull_request:

permissions:
contents: write # to push gh-pages on main / schedule / dispatch
pull-requests: none # explicit: this workflow never touches PRs

concurrency:
# One in-flight run per PR, one per main/dispatch invocation.
# PR runs cancel previous in-progress ones; main runs queue.
group: integration-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions: {}

jobs:
# Read the `columns` list from packages.yaml and emit it as the job
# matrix, so the (python, variant) combinations have a single source
# of truth and never need hand-syncing into this workflow.
setup:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
matrix: ${{ steps.columns.outputs.matrix }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'

- name: Build matrix from packages.yaml
id: columns
run: |
pip install pyyaml
python -c '
import json, yaml
cols = yaml.safe_load(open("packages.yaml"))["columns"]
matrix = [{"python": str(c["python"]), "variant": c["variant"]} for c in cols]
print("matrix=" + json.dumps(matrix))
' >> "$GITHUB_OUTPUT"

variant:
needs: setup
strategy:
fail-fast: false
matrix:
# Generated by the `setup` job from `columns:` in packages.yaml;
# each entry is one {python, variant} object.
include: ${{ fromJson(needs.setup.outputs.matrix) }}
runs-on: ubuntu-latest
timeout-minutes: 240
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

# This Python only runs the `sunpy-integration` orchestrator CLI;
# the test venv for `matrix.python` is built separately by uv (see
# the `run` step below), so a fixed version is fine here.
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
# We manage the cache ourselves via actions/cache below; turning
# off setup-uv's own caching avoids it saving a duplicate of the
# same directory under its own key.
enable-cache: false

- name: Cache ~/.cache/uv
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/uv
# Primary key uses the run id, so every run writes a fresh
# snapshot (after `uv cache prune --ci` slims it to wheels
# actually used in this run). The restore-keys are prefix
# matches against saved keys, so the first one always finds
# the most recent run's cache for the same (os, variant,
# python) and the next run starts warm.
key: uv-${{ runner.os }}-${{ matrix.variant }}-${{ matrix.python }}-${{ github.run_id }}
restore-keys: |
uv-${{ runner.os }}-${{ matrix.variant }}-${{ matrix.python }}-
uv-${{ runner.os }}-${{ matrix.variant }}-
uv-${{ runner.os }}-

- run: sudo apt update; sudo apt install libfftw3-dev ffmpeg

- name: Install sunpy-integration
run: pip install .

- name: Run ${{ matrix.variant }} variant on Python ${{ matrix.python }}
env:
# PR previews limit each package to the first 10 tests so the
# matrix finishes in minutes; conftest.py at the repo root reads
# this env var and truncates the collected items.
PYTEST_LIMIT_N: ${{ github.event_name == 'pull_request' && '10' || '' }}
run: sunpy-integration run --variant ${{ matrix.variant }} --python ${{ matrix.python }}

- name: Prune uv cache before save
if: always()
# Strips pre-built sdists and other entries uv won't reuse, so
# the snapshot the cache step uploads stays lean.
run: uv cache prune --ci

- name: Upload results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: results-${{ matrix.variant }}-${{ matrix.python }}
path: results/${{ matrix.variant }}__${{ matrix.python }}.json

dashboard:
needs: variant
if: always()
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'

- name: Install sunpy-integration
run: pip install .

- name: Download all variant results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: results-*
merge-multiple: true
path: results/

- name: Build dashboard
run: sunpy-integration dashboard

# PR path: upload index.html as a non-zipped artifact for the
# in-browser preview (linked from a PR check by preview-link.yml).
- name: Upload preview artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dashboard-preview
path: site/index.html
archive: false
overwrite: true

# Main / schedule / dispatch path: publish to gh-pages.
- name: Publish to gh-pages
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
force_orphan: true
commit_message: Update integration dashboard
integration:
permissions:
contents: write # to publish the dashboard to gh-pages
uses: OpenAstronomy/integration-dashboard/.github/workflows/integration.yml@main
with:
config: packages.yaml
# libfftw3-dev for packages that build against FFTW, and ffmpeg
# for tests that write movies (e.g. irispy-lmsal's wobble movie).
libraries: |
apt:
- libfftw3-dev
- ffmpeg
Loading
Loading