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
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WARNING: Do not edit this file manually.
# Any changes will be overwritten by Copier.
_commit: v0.10.1-41-g508666e
_commit: v0.11.3
_src_path: gh:easyscience/templates
app_docs_url: https://easyscience.github.io/dynamics-app
app_doi: 10.5281/zenodo.18877180
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Download artifact'
description: 'Generic wrapper for actions/download-artifact'
description: 'Wrapper for actions/download-artifact'
inputs:
name:
description: 'Name of the artifact to download'
Expand Down Expand Up @@ -39,7 +39,7 @@ runs:
using: 'composite'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/github-script/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
runs:
using: 'composite'
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v9
with:
script: ${{ inputs.script }}
github-token: ${{ inputs.github-token }}
4 changes: 2 additions & 2 deletions .github/actions/setup-easyscience-bot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ runs:
steps:
- name: Create GitHub App installation token
id: app-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ inputs.app-id }}
client-id: ${{ inputs.app-id }}
private-key: ${{ inputs.private-key }}
repositories: ${{ inputs.repositories }}

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup-pixi/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Setup Pixi Environment'
description: 'Sets up pixi with common configuration'
description: 'Wrapper for prefix-dev/setup-pixi'
inputs:
environments:
description: 'Pixi environments to setup'
Expand Down Expand Up @@ -33,7 +33,7 @@ inputs:
runs:
using: 'composite'
steps:
- uses: prefix-dev/setup-pixi@v0.9.4
- uses: prefix-dev/setup-pixi@v0.9.5
with:
environments: ${{ inputs.environments }}
activate-environment: ${{ inputs.activate-environment }}
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Upload artifact'
description: 'Generic wrapper for actions/upload-artifact'
description: 'Wrapper for actions/upload-artifact'
inputs:
name:
description: 'Artifact name'
Expand Down Expand Up @@ -38,7 +38,7 @@ runs:
using: 'composite'
steps:
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/upload-codecov/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Upload coverage to Codecov'
description: 'Generic wrapper for codecov/codecov-action@v5'
description: 'Wrapper for codecov/codecov-action'

inputs:
name:
Expand Down Expand Up @@ -32,7 +32,7 @@ inputs:
runs:
using: composite
steps:
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v6
with:
name: ${{ inputs.name }}
flags: ${{ inputs.flags }}
Expand Down
77 changes: 77 additions & 0 deletions .github/scripts/publish-dashboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash

set -euo pipefail

remote_repository="${DASHBOARD_REMOTE_REPOSITORY:?}"
publish_branch="${DASHBOARD_PUBLISH_BRANCH:-master}"
source_dir="${DASHBOARD_SOURCE_DIR:?}"
token="${DASHBOARD_TOKEN:?}"
git_user_name="${DASHBOARD_GIT_USER_NAME:-easyscience[bot]}"
git_user_email="${DASHBOARD_GIT_USER_EMAIL:?}"
commit_message="${DASHBOARD_COMMIT_MESSAGE:?}"
max_attempts="${DASHBOARD_PUSH_ATTEMPTS:-3}"
delay_seconds="${DASHBOARD_PUSH_DELAY_SECONDS:-15}"

workspace_dir="$(mktemp -d)"
repo_dir="${workspace_dir}/dashboard"
remote_url="https://x-access-token:${token}@github.com/${remote_repository}.git"

cleanup() {
rm -rf "${workspace_dir}"
}

prepare_worktree() {
if [[ ! -d "${repo_dir}/.git" ]]; then
git clone --branch "${publish_branch}" --depth 1 "${remote_url}" "${repo_dir}"
else
git -C "${repo_dir}" fetch origin "${publish_branch}"
git -C "${repo_dir}" checkout "${publish_branch}"
git -C "${repo_dir}" reset --hard "origin/${publish_branch}"
git -C "${repo_dir}" clean -fd
fi

git -C "${repo_dir}" config user.name "${git_user_name}"
git -C "${repo_dir}" config user.email "${git_user_email}"
}

sync_publish_dir() {
cp -R "${source_dir}/." "${repo_dir}/"
git -C "${repo_dir}" add .

if git -C "${repo_dir}" diff --cached --quiet; then
return 1
fi

git -C "${repo_dir}" commit -m "${commit_message}"
}

trap cleanup EXIT

prepare_worktree

if ! sync_publish_dir; then
echo "No dashboard changes to publish."
exit 0
fi

for ((attempt = 1; attempt <= max_attempts; attempt += 1)); do
if git -C "${repo_dir}" push origin "HEAD:${publish_branch}"; then
echo "Dashboard published on attempt ${attempt}."
exit 0
fi

if ((attempt == max_attempts)); then
echo "Dashboard publish failed after ${max_attempts} attempts." >&2
exit 1
fi

echo "Dashboard push attempt ${attempt} failed. Retrying in ${delay_seconds}s." >&2
sleep "${delay_seconds}"

prepare_worktree

if ! sync_publish_dir; then
echo "Dashboard changes already exist in the target repository."
exit 0
fi
done
4 changes: 2 additions & 2 deletions .github/workflows/backmerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

steps:
- name: Checkout repository (for local actions)
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup easyscience[bot]
id: bot
Expand All @@ -38,7 +38,7 @@ jobs:
repositories: ${{ github.event.repository.name }}

- name: Checkout repository (with bot token)
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.bot.outputs.token }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ on:
days:
description: 'Number of days.'
required: true
default: 30
default: '30'
minimum_runs:
description: 'The minimum runs to keep for each workflow.'
required: true
default: 6
default: '6'
delete_workflow_pattern:
description:
'The name or filename of the workflow. if not set then it will target all
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
push:
branches:
- develop
# Do not run on version tags (those are handled by other workflows)
tags-ignore: ['v*']
# Trigger the workflow on pull request
pull_request:
# Allows you to run this workflow manually from the Actions tab
Expand Down Expand Up @@ -34,7 +32,7 @@ jobs:

steps:
- name: Check-out repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up pixi
uses: ./.github/actions/setup-pixi
Expand All @@ -48,7 +46,7 @@ jobs:

steps:
- name: Check-out repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up pixi
uses: ./.github/actions/setup-pixi
Expand All @@ -71,7 +69,7 @@ jobs:

steps:
- name: Check-out repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up pixi
uses: ./.github/actions/setup-pixi
Expand Down
44 changes: 25 additions & 19 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
permissions:
contents: read

concurrency:
group: dashboard-publish-${{ github.repository }}
cancel-in-progress: false

# Set the environment variables to be used in all jobs defined in this workflow
env:
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
Expand All @@ -21,7 +25,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 0

Expand All @@ -44,19 +48,18 @@ jobs:

git worktree add ../$BRANCH origin/$BRANCH
mkdir -p reports/$BRANCH
CODE_PATH="../$BRANCH/src"

echo "Docstring coverage for branch $BRANCH"
pixi run interrogate -c pyproject.toml --fail-under=0 $CODE_PATH > reports/$BRANCH/coverage-docstring.txt
pixi run interrogate -c pyproject.toml --fail-under=0 ../$BRANCH/src > reports/$BRANCH/coverage-docstring.txt

echo "Cyclomatic complexity for branch $BRANCH"
pixi run radon cc -s -j $CODE_PATH > reports/$BRANCH/cyclomatic-complexity.json
pixi run radon cc -s -j ../$BRANCH/src > reports/$BRANCH/cyclomatic-complexity.json

echo "Maintainability index for branch $BRANCH"
pixi run radon mi -j $CODE_PATH > reports/$BRANCH/maintainability-index.json
pixi run radon mi -j ../$BRANCH/src > reports/$BRANCH/maintainability-index.json

echo "Raw metrics for branch $BRANCH"
pixi run radon raw -s -j $CODE_PATH > reports/$BRANCH/raw-metrics.json
pixi run radon raw -s -j ../$BRANCH/src > reports/$BRANCH/raw-metrics.json
done

- name: Generate dashboard HTML
Expand All @@ -82,22 +85,25 @@ jobs:
${{ github.event.repository.name }}
dashboard

# Publish to external dashboard repository with retry logic.
# Push to external dashboard repository with retry logic.
# Retry is needed to handle transient GitHub API/authentication issues
# that occasionally cause 403 errors when multiple workflows push concurrently.
# Uses personal_token (not github_token) as GITHUB_TOKEN cannot access external repos.
- name: Publish to main branch of ${{ github.repository }}
uses: Wandalen/wretry.action@v3.8.0
with:
attempt_limit: 3
attempt_delay: 15000 # 15 seconds between retries
action: peaceiris/actions-gh-pages@v4
with: |
publish_dir: ./_dashboard_publish
keep_files: true
external_repository: ${{ env.REPO_OWNER }}/dashboard
publish_branch: master
personal_token: ${{ steps.bot.outputs.token }}
- name:
Push to ${{ env.REPO_OWNER }}/dashboard/${{ env.REPO_NAME }}/${{ env.CI_BRANCH
}}
shell: bash
env:
DASHBOARD_COMMIT_MESSAGE: ${{ env.CI_BRANCH }}
DASHBOARD_GIT_USER_EMAIL:
${{ vars.EASYSCIENCE_APP_ID }}+easyscience[bot]@users.noreply.github.com
DASHBOARD_PUSH_ATTEMPTS: '3'
DASHBOARD_PUSH_DELAY_SECONDS: '15'
DASHBOARD_PUBLISH_BRANCH: master
DASHBOARD_REMOTE_REPOSITORY: ${{ env.REPO_OWNER }}/dashboard
DASHBOARD_SOURCE_DIR: ./_dashboard_publish
DASHBOARD_TOKEN: ${{ steps.bot.outputs.token }}
run: bash ./.github/scripts/publish-dashboard.sh

- name: Add dashboard link to summary
run: |
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow only one concurrent deployment to gh-pages at a time.
# All docs workflows share the same concurrency group to prevent race conditions
# when multiple branches/tags trigger simultaneous deployments.
# - Non-tagged pushes and pull requests all use `docs-dev` group, so
# they cancel each other.
# - Tagged pushes use their own group like docs-v1.2.3, so they do not
# cancel non-tagged runs, and non-tagged runs do not cancel them.
concurrency:
group: docs-gh-pages-deploy
cancel-in-progress: false
group: >-
${{ startsWith(github.ref, 'refs/tags/v')
&& format('docs-{0}', github.ref_name)
|| 'docs-dev' }}
cancel-in-progress: true

# Set the environment variables to be used in all jobs defined in this workflow
env:
Expand Down Expand Up @@ -83,7 +87,7 @@ jobs:
# Check out the repository source code.
# Note: The gh-pages branch is fetched separately later for mike deployment.
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

# Activate dark mode to create documentation with Plotly charts in dark mode
# Need a better solution to automatically switch the chart colour theme based on the mkdocs material switcher
Expand Down
Loading
Loading