Skip to content

Generalize amr::Limits policy to specify resolution bounds independently for different topologies #24344

Generalize amr::Limits policy to specify resolution bounds independently for different topologies

Generalize amr::Limits policy to specify resolution bounds independently for different topologies #24344

Workflow file for this run

# Distributed under the MIT License.
# See LICENSE.txt for details.
# Continuous integration tests that pull requests are required to pass. This
# workflow can also be dispatched manually to tag and release versions.
name: Tests
# Set any defaults for the runs below.
# - use bash as the default shell since this is almost certainly what
# is always expected. We use regular expressions in a few places
# that rely on bash.
defaults:
run:
shell: bash
# Note that by default the jobs only run on the base repository, testing pull
# requests and merge commits. Enable GitHub Actions in your fork's repository
# settings to also run the tests on every push to one of your branches.
on:
# We run all jobs when pull requests are opened, commits are pushed, or pull
# requests are re-opened after being closed.
# The jobs triggered by this event run on the base repository of the pull
# request, so they have access to its caches.
pull_request:
# We run those jobs that require no information about a pull request (e.g.
# unit tests) also on `push` events. This setup tests merge commits into
# `develop` and also builds up caches on `develop` that can be re-used by PRs.
# It also runs the jobs on forks if they have GitHub Actions enabled.
push:
branches-ignore:
- gh-pages
# Allow running the workflow manually to run tests and optionally release a
# version on success (see the dev guide on "Automatic versioning")
workflow_dispatch:
inputs:
release_version:
description: >
Enter a version name YYYY.MM.DD[.TWEAK] to create a release on success
required: false
default: ''
timezone:
description: >
Timezone used for validating the version name. The release must be
approved by the end of the day in the specified timezone. See
/usr/share/zoneinfo for a list of possible values.
required: false
default: 'America/Los_Angeles'
clear_ccache:
description: >
Enter 'yes' without quotes to clear ccache before running
required: false
default: ''
container:
description: >
Container to use for builds
required: false
default: 'sxscollaboration/spectre:dev'
# Allow running this workflow as a job in another workflow. This is used to
# test a new Docker container before publishing it.
workflow_call:
inputs:
container:
description: >
Container to use for builds
required: false
type: string
default: 'sxscollaboration/spectre:dev'
# Cancel all other queued or in-progress runs of this workflow when it is
# scheduled, so repeated pushes to a branch or a PR don't block CI. Repeated
# pushes to 'develop' and 'release' are not canceled, so every merge commit is
# tested.
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/develop'
&& github.ref != 'refs/heads/release' }}
jobs:
# Make sure no commits are prefixed with `fixup` or similar keywords. See
# `tools/CheckCommits.sh` for details.
check_commits:
name: Commits
# Only run on pull requests since we don't check _all_ commits, but only
# those that came after the PR's base ref.
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check commits
# `CheckCommits.sh` tests against the local `develop` branch, so that's
# where we fetch the pull-request's base-branch to. Typically, it is
# the upstream `sxs-collaboration/spectre/develop` branch.
run: >
cd $GITHUB_WORKSPACE
git remote add upstream
https://github.com/${{ github.repository }}.git
git remote -v
git fetch upstream ${{ github.base_ref }}:develop
./tools/CheckCommits.sh
# - Run simple textual checks over files in the repository, e.g. checking for
# a license, line length limits etc. See `tools/CheckFiles.sh` for details.
# - Run format checker for python to make sure the code is formatted correctly
# - Check the metadata are consistent
check_files_and_formatting:
name: Files and formatting
runs-on: ubuntu-latest
container:
image: ${{ inputs.container || 'sxscollaboration/spectre:dev' }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
# Work around https://github.com/actions/checkout/issues/760
- name: Trust checkout
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
# The action above checks out the `github.ref` by default, which points to
# the merge commit with the target branch for pull-request events. For
# this job we check out the pull-request HEAD instead. It makes
# git-related issues easier to debug because the state matches the local
# repository. It also prevents releases that happened since the
# pull-request branch was last rebased from disrupting tests that involve
# the latest release tag.
- name: Checkout pull-request HEAD
if: github.event_name == 'pull_request'
run: |
git checkout ${{ github.event.pull_request.head.sha }}
# Some tests involve release tags, which may not have been pushed to
# forks. Fetching them here.
- name: Fetch upstream tags on forks
if: github.repository != 'sxs-collaboration/spectre'
run: |
git fetch --tags https://github.com/sxs-collaboration/spectre
- name: Install Python dependencies
run: |
python3 -m pip install -r support/Python/dev_requirements.txt
- name: Check Python formatting
run: |
cd $GITHUB_WORKSPACE
echo "Using 'black' to check Python formatting..."
black --check --extend-exclude '/external/' .
echo "Using 'isort' to check Python formatting..."
isort --check-only --extend-skip external .
- name: Test script
run: |
cd $GITHUB_WORKSPACE
./tools/CheckFiles.sh --test
- name: Check files
run: |
cd $GITHUB_WORKSPACE
./tools/CheckFiles.sh
# Install the pinned release dependencies in a separate environment so
# they don't downgrade the container's packages for the other steps
- name: Install release dependencies
run: |
python3 -m venv /work/release-venv
/work/release-venv/bin/python -m pip install \
-r .github/scripts/requirements-release.txt
echo "RELEASE_PYTHON=/work/release-venv/bin/python" >> $GITHUB_ENV
- name: Test tools
run: |
$RELEASE_PYTHON -m unittest discover \
-p 'Test_CompileReleaseNotes.py' tests.tools -v
- name: Check metadata
run: |
$RELEASE_PYTHON tools/CheckMetadata.py
- name: Check the metadata is consistent with the releases
# No need to check this on forks. They would need to set a Zenodo token
# for this test. Also disable on PRs because they don't have access to
# the repo's secrets.
if: >
github.repository == 'sxs-collaboration/spectre'
&& github.event_name != 'pull_request'
run: |
$RELEASE_PYTHON .github/scripts/Release.py prepare -vv --check-only \
--zenodo-token ${{ secrets.ZENODO_READONLY_TOKEN }} \
--github-token ${{ secrets.GITHUB_TOKEN }}
$RELEASE_PYTHON .github/scripts/Release.py publish -vv --check-only \
--zenodo-token ${{ secrets.ZENODO_READONLY_TOKEN }} \
--github-token ${{ secrets.GITHUB_TOKEN }} \
--auto-publish
- name: Check release notes
run: |
$RELEASE_PYTHON tools/CompileReleaseNotes.py -vv \
-o release_notes.md \
--github-token ${{ secrets.GITHUB_TOKEN }}
- name: Upload release notes
uses: actions/upload-artifact@v7
with:
name: release-notes
path: release_notes.md
# GitHub doesn't display artifacts until the workflow has completed, so we
# print the release notes here to be able to review them before approving
# a release
- name: Print release notes
run: |
cat release_notes.md