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
24 changes: 21 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# Codecov configuration
# https://docs.codecov.com/docs/codecov-yaml

github_checks:
annotations: true

comment:
layout: 'reach, diff, flags, files'
behavior: default
require_changes: false # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
require_changes: false
require_base: false
require_head: true

coverage:
status:
project:
default:
target: auto
threshold: 1%
# Make project coverage informational (won't block PR)
informational: true
patch:
default:
target: auto
# Require patch coverage but with threshold
threshold: 1%
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# WARNING: Do not edit this file manually.
# Any changes will be overwritten by Copier.
_commit: v0.10.0
_commit: v0.13.1
_src_path: gh:easyscience/templates
lib_docs_url: https://easyscience.github.io/core
lib_doi: 10.5281/zenodo.18163581
lib_package_name: easyscience
lib_python_max: '3.13'
lib_python_max: '3.14'
lib_python_min: '3.11'
lib_repo_name: core
project_contact_email: support@easyscience.org
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
42 changes: 9 additions & 33 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Coverage checks

on:
# Trigger the workflow on push
# Trigger the workflow on push to develop
push:
# Do not run on version tags (those are handled by other workflows)
tags-ignore: ['v*']
branches:
- develop
# Trigger the workflow on pull request
pull_request:
# Allows you to run this workflow manually from the Actions tab
Expand All @@ -15,11 +15,11 @@ permissions:
actions: write
contents: read

# Allow only one concurrent workflow, skipping runs queued between the run
# in-progress and latest queued. And cancel in-progress runs.
# Allow only one concurrent workflow per PR or branch ref.
# Cancel in-progress runs only for pull requests, but let branch push runs finish.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# Set the environment variables to be used in all jobs defined in this workflow
env:
Expand All @@ -32,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 @@ -46,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 @@ -63,32 +63,8 @@ jobs:
files: ./coverage-unit.xml
token: ${{ secrets.CODECOV_TOKEN }}

# Job 2: Run integration tests with coverage and upload to Codecov
integration-tests-coverage:
runs-on: ubuntu-latest

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

- name: Set up pixi
uses: ./.github/actions/setup-pixi

- name: Run integration tests with coverage
run:
pixi run integration-tests-coverage --cov-report=xml:coverage-integration.xml

- name: Upload integration tests coverage to Codecov
if: ${{ !cancelled() }}
uses: ./.github/actions/upload-codecov
with:
name: integration-tests-job
flags: integration
files: ./coverage-integration.xml
token: ${{ secrets.CODECOV_TOKEN }}

# Job 4: Build and publish dashboard (reusable workflow)
run-reusable-workflows:
needs: [docstring-coverage, unit-tests-coverage, integration-tests-coverage] # depend on the previous jobs
needs: [docstring-coverage, unit-tests-coverage] # depend on the previous jobs
uses: ./.github/workflows/dashboard.yml
secrets: inherit
41 changes: 26 additions & 15 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,16 +25,20 @@ jobs:

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

- name: Set up pixi
uses: ./.github/actions/setup-pixi

# Install badgery into the active Pixi environment without modifying
# pixi.toml/pixi.lock. Using `pixi add` here re-solves the whole project
# and rebuilds the local editable package, which can cause intermittent
# Linux CI failures (`Text file busy`, os error 26).
- name: Install badgery
shell: bash
run: pixi add --pypi --git https://github.com/enhantica/badgery badgery
run: pixi run python -m pip install git+https://github.com/enhantica/badgery

- name: Run docstring coverage and code complexity/maintainability checks
run: |
Expand Down Expand Up @@ -81,22 +89,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
Loading
Loading