Continuous Integration
Explanation: Continuous Integration
TARDIS uses continuous integration. When a change is proposed by pull request or
merged into master, a service clones the repository, checks out the current
commit, and runs TARDIS tests. This helps detect bugs immediately.
TARDIS currently uses GitHub Actions for pipelines. A workflow is a YAML configuration file with sections such as variables, jobs, and steps. Workflows run commands when triggered by events, such as pushes or pull requests.
Making changes to an existing pipeline is done through a pull request. Creating
a new workflow requires adding a YAML file under .github/workflows.
How-To Guide: Configure a GitHub Actions Workflow
To create a workflow, add a YAML file under .github/workflows.
Use common TARDIS setup actions and settings:
Use the
setup_lfsaction andlfs-cacheworkflow when regression or atomic data is needed.Use the
lfs-cacheworkflow to cache regression data and atomic data and to check whether the cache is available.Use the
setup_envaction to configure variables and settings for the pipeline.Set the shell in the YAML configuration:
defaults: run: shell: bash -l {0}
The docs workflow in .github/workflows/build-docs.yml uses the shared LFS
cache workflow, restores sparse atomic data, sets up the environment, and builds
the docs:
jobs:
test-cache:
uses: ./.github/workflows/lfs-cache.yml
with:
atom-data-sparse: true
regression-data-repo: tardis-sn/tardis-regression-data
build-docs:
steps:
- name: Setup LFS
uses: ./.github/actions/setup_lfs
with:
atom-data-sparse: true
- name: Setup environment
uses: tardis-sn/tardis-actions/setup-env@main
- name: Build documentation
run: cd docs/ && make html NCORES=auto
Reference: Continuous Integration Reference
Cache Keys
Regression data cache key format:
tardis-regression-<data-type>-<hash>-v1
Examples:
tardis-regression-atom-data-sparse-<hash>-v1: atomic data cache.tardis-regression-full-data-<hash>-v1: full TARDIS regression data cache.
Used in the setup_lfs action.
Environment cache key format:
tardis-conda-env-<os-label>-<hash>-v1
Examples:
tardis-conda-env-linux-<hash>-v1: Linux conda environment.tardis-conda-env-macos-<hash>-v1: macOS conda environment.
Used in the setup_env action.
The -v1 suffix allows future cache invalidation. The lfs-cache workflow
fails if the cache is unavailable and does not pull LFS data by default. If the
allow_lfs_pull label is added to a pull request, the workflow pulls LFS data.
Use this label sparingly and only with caution.
Common Pipeline Steps
Use
setup_lfsand thelfs-cacheworkflow when regression or atomic data is required.Use
setup_envto configure environment variables and settings.Use
bash -l {0}as the run shell in workflow YAML.
Documentation Build Pipeline
The documentation build pipeline builds and deploys the TARDIS documentation website.
Documentation Preview Pipeline
The documentation preview pipeline does not run on the main repository, only on forks. It supports pull request documentation previews.
Testing Pipeline
The testing pipeline runs four concurrent jobs:
Ubuntu tests without the continuum marker.
Ubuntu tests with the continuum marker.
macOS tests without the continuum marker.
macOS tests with the continuum marker.
This is two platforms multiplied by two test types. The pipeline includes environment installation, regression data configuration, and coverage report upload after tests finish.
GPU tests can be triggered by applying the full-tests label to a pull request.
Release Pipeline
TARDIS publishes a new release every Sunday at 00:00 UTC.
Pre-Release
The pre-release action clones tardis-sn/tardis_zenodo, runs a notebook to
generate .zenodo.json, and pushes the file to the root of the TARDIS
repository. The file creates a new TARDIS version on Zenodo with all committers
as authors. A pull request is created and automatically merged if required
checks pass.
Zenodo job:
Check out
tardis-sn/tardis_zenodo.Wait for the Zenodo webhook to be available with a 3 minute sleep.
Set up the Python environment stored in
tardis-sn/tardis_zenodo.Store the Zenodo API secret key in an environment variable.
Run the notebook to generate
.zenodo.json.Re-run if there are errors and ignore errors.
Upload
.zenodo.jsonas an artifact.
Pip tests job:
Runs the TARDIS test suite after installing TARDIS from master with pip using
Git, instead of an editable install. This catches cases where a new module lacks
an __init__.py file or data files are missing from
[tool.setuptools.package-data] in pyproject.toml.
Pre-release pull request job:
Relies on Zenodo and pip test steps completing.
Checks out the TARDIS repository.
Downloads artifacts from previous steps.
Checks for
.zenodo.jsonand uses it if generated.Gets the current date.
Creates a bot pull request on the
tardis-botfork using branchpre-release-<date>with the new.zenodo.json.Waits 1 minute for the pull request to be created.
Automatically approves the pull request using tokens from infrastructure and core coordinator members.
Enables auto-merge.
Release
The release job creates a GitHub release after the pre-release pull request is merged.
Check out TARDIS with fetch depth 0.
Set up Python.
Install
setuptools_scmandgit-cliff.Get the current TARDIS version using
setuptools_scmvia a helper script.Get the next TARDIS version using
setuptools_scm.Create a GitHub release using the new version as the tag.
Wait 2 minutes for Zenodo to update the new TARDIS release.
Fetch the new DOI from Zenodo using the Zenodo API and create a badge.
Generate the changelog with
git-cliff.Update the release description with the changelog and Zenodo badge.
Include environment lock files in release assets.
Post-Release
The post-release action updates the changelog, citation, and credits in the main repository.
Changelog job:
Check out TARDIS with fetch depth 0.
Get the current release tag.
Generate a changelog with
git-cliff.Upload
CHANGELOG.mdas an artifact.
Citation job:
Check out TARDIS.
Wait 3 minutes for the Zenodo webhook.
Set up Python.
Install
doi2cff.Convert the latest TARDIS release DOI to
CITATION.cff.Try 10 times with a 60 second sleep between attempts.
Upload
CITATION.cffas an artifact.
Credits job:
Check out TARDIS.
Wait 3 minutes for the Zenodo webhook.
Set up Python.
Install
requests.Run a helper script to update
README.rstanddocs/resources/credits.rst.Upload
README.rstandcredits.rstas artifacts.Dispatch updates to the TARDIS website.
Post-release pull request job:
Check out TARDIS.
Download artifacts from previous steps.
Copy
CHANGELOG.md,CITATION.cff,README.rst, andcredits.rstinto the repository.Get the current date.
Create a pull request.
Wait 30 seconds for the pull request to be created.
Automatically approve the pull request using tokens from infrastructure and core coordinator members.
Enable auto-merge.
TARDIS Carsus Compatibility Check
The TARDIS Carsus Compatibility Check, or Bridge, compares reference data generated with different Carsus versions. It has two jobs:
carsus-build: generates an atomic file with the latest Carsus.tardis-build: generates new reference data with the atomic file.
The two reference data files are compared with this notebook:
https://github.com/tardis-sn/tardis-refdata/blob/master/notebooks/ref_data_compare_from_paths.ipynb
The workflow has a workflow_dispatch event for manual runs and is also
triggered weekly by the save atomic files workflow.
Save Atomic Files Workflow
The Save Atomic Files workflow runs weekly and can be triggered manually. It runs the Bridge and sends an artifact to Moria containing the generated atomic data file and comparison notebook. A separate job indicates whether the Bridge failed.
Regression Data Comparison Workflow
The Regression Data Comparison workflow compares regression data between the
current branch and the base branch on pull requests. It runs only on pull
requests, not on master.
The workflow generates regression data for the latest commit on the pull request
and compares it with master using the comparison notebook. The notebook is
uploaded as an artifact and pushed to the reg-data-comp repository for
previews in the bot comment.
The workflow exports images from the comparison notebook and embeds them in the bot comment. Unless there are key changes to HDF files in the regression data, the bot shows two images: spectrum change and relative changes in keys. If there are key changes, the bot shows a third image visualizing key changes.
LFS-Cache Workflow
The LFS-cache workflow caches regression data and atomic data. It can be
triggered manually or when there is a push to the main branch of the regression
data repository. It performs LFS pulls when necessary and caches objects. The
setup-lfs action restores cached objects. Both fail if the cache is
unavailable.