Skip to content

Commit 08af1b5

Browse files
Merge pull request #102 from easyscience/develop
Release: merge develop into master
2 parents f740bbf + 4a00d72 commit 08af1b5

File tree

115 files changed

+7967
-38873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+7967
-38873
lines changed

.badgery.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
default_branch: master
2+
develop_branch: develop
3+
4+
cards:
5+
- group: Tests
6+
type: gh_action
7+
title: Code/package tests (GitHub)
8+
file: test.yaml
9+
enabled: true
10+
11+
- group: Tests
12+
type: gh_action
13+
title: Tutorial tests (GitHub)
14+
file: tutorial-tests.yaml
15+
enabled: true
16+
17+
- group: Tests
18+
type: gh_action
19+
title: Package tests (PyPI)
20+
file: pypi-test.yaml
21+
enabled: true
22+
23+
- group: Code Quality
24+
type: codefactor
25+
title: Code quality (CodeFactor)
26+
enabled: true
27+
28+
- group: Code Quality
29+
type: radon_mi
30+
title: Maintainability index (radon)
31+
report: reports/{branch}/maintainability-index.json
32+
enabled: true
33+
34+
- group: Code Quality
35+
type: radon_cc
36+
title: Cyclomatic complexity (radon)
37+
report: reports/{branch}/cyclomatic-complexity.json
38+
enabled: true
39+
40+
- group: Size
41+
type: radon_loc
42+
title: Source/Logical lines of code (radon)
43+
report: reports/{branch}/raw-metrics.json
44+
enabled: true
45+
46+
- group: Size
47+
type: radon_ff
48+
title: Functions/Files count (radon)
49+
report: reports/{branch}/cyclomatic-complexity.json
50+
enabled: true
51+
52+
- group: Coverage
53+
type: codecov
54+
title: Unit test coverage (Codecov)
55+
enabled: true
56+
57+
- group: Coverage
58+
type: interrogate
59+
title: Docstring coverage (interrogate)
60+
report: reports/{branch}/coverage-docstring.txt
61+
enabled: true
62+
63+
- group: Build & Release
64+
type: gh_action
65+
title: Publishing (PyPI)
66+
workflow: pypi-publish.yml
67+
enabled: true
68+
69+
- group: Build & Release
70+
type: gh_action
71+
title: Docs build/deployment
72+
workflow: docs.yml
73+
enabled: true
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow creates a backmerge PR from DEFAULT_BRANCH into `develop`
2+
# whenever a new version tag is pushed (v*).
3+
#
4+
# Usage:
5+
# - Triggered automatically on tag push (v*).
6+
# - Creates a PR titled "Backmerge: DEFAULT_BRANCH into develop".
7+
# - Adds the label "[maintainer] auto-pull-request" so it is excluded from changelogs.
8+
9+
name: Backmerge PR creation
10+
11+
on:
12+
push:
13+
tags:
14+
- 'v*'
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
# Set the environment variables to be used in all jobs defined in this workflow
21+
env:
22+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
23+
24+
jobs:
25+
create-backmerge-pr:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout ${{ env.DEFAULT_BRANCH }} branch
29+
uses: actions/checkout@v5
30+
with:
31+
ref: ${{ env.DEFAULT_BRANCH }}
32+
33+
- name: Create PR from ${{ env.DEFAULT_BRANCH }} to develop
34+
run: |
35+
gh pr create \
36+
--base develop \
37+
--head ${{ env.DEFAULT_BRANCH }} \
38+
--title "Backmerge: ${{ env.DEFAULT_BRANCH }} into develop" \
39+
--label "[maintainer] auto-pull-request" \
40+
--body "⚠️ This PR is created automatically for backmerges changes from \`${{ env.DEFAULT_BRANCH }}\` into \`develop\`, following a new release tag push.
41+
42+
It is labeled \`[maintainer] auto-pull-request\` and is excluded from release notes and version bump logic."
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCESS_TOKEN }}

.github/workflows/delete-old-runs.yml renamed to .github/workflows/cleanup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# parameters.
33
# https://github.com/Mattraks/delete-workflow-runs
44

5-
name: Delete old workflow runs
5+
name: Old workflow runs cleanup
66

77
on:
88
# Run monthly, at 00:00 on the 1st day of month.

.github/workflows/coverage.yaml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Coverage checks
2+
3+
on:
4+
# Trigger the workflow on push
5+
push:
6+
# Trigger the workflow on pull request
7+
pull_request:
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Need permissions to trigger the dashboard build workflow
12+
permissions:
13+
actions: write
14+
contents: read
15+
16+
# Allow only one concurrent workflow, skipping runs queued between the run
17+
# in-progress and latest queued. And cancel in-progress runs.
18+
concurrency:
19+
group:
20+
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
21+
cancel-in-progress: true
22+
23+
# Set the environment variables to be used in all jobs defined in this workflow
24+
env:
25+
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
26+
27+
jobs:
28+
# Job 1: Run docstring coverage
29+
docstring-coverage:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: Check-out repository
34+
uses: actions/checkout@v5
35+
36+
- name: Set up pixi
37+
uses: prefix-dev/[email protected]
38+
with:
39+
environments: default
40+
activate-environment: default
41+
run-install: true
42+
frozen: true
43+
cache: false
44+
post-cleanup: false
45+
46+
- name: Install and setup development dependencies
47+
shell: bash
48+
run: pixi run dev
49+
50+
- name: Run docstring coverage
51+
run: pixi run docstring-coverage
52+
53+
# Job 2: Run unit tests with coverage and upload to Codecov
54+
unit-tests-coverage:
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: Check-out repository
59+
uses: actions/checkout@v5
60+
61+
- name: Set up pixi
62+
uses: prefix-dev/[email protected]
63+
with:
64+
environments: default
65+
activate-environment: default
66+
run-install: true
67+
frozen: true
68+
cache: false
69+
post-cleanup: false
70+
71+
- name: Install and setup development dependencies
72+
shell: bash
73+
run: pixi run dev
74+
75+
- name: Run unit tests with coverage
76+
run: pixi run unit-tests-coverage --cov-report=xml:coverage-unit.xml
77+
78+
- name: Upload unit tests coverage to Codecov
79+
if: ${{ !cancelled() }}
80+
uses: codecov/codecov-action@v5
81+
with:
82+
name: unit-tests-job
83+
flags: unittests
84+
files: ./coverage-unit.xml
85+
fail_ci_if_error: true
86+
verbose: true
87+
token: ${{ secrets.CODECOV_TOKEN }}
88+
89+
# Job 2: Run functional tests with coverage and upload to Codecov
90+
func-tests-coverage:
91+
runs-on: ubuntu-latest
92+
93+
steps:
94+
- name: Check-out repository
95+
uses: actions/checkout@v5
96+
97+
- name: Set up pixi
98+
uses: prefix-dev/[email protected]
99+
with:
100+
environments: default
101+
activate-environment: default
102+
run-install: true
103+
frozen: true
104+
cache: false
105+
post-cleanup: false
106+
107+
- name: Install and setup development dependencies
108+
shell: bash
109+
run: pixi run dev
110+
111+
- name: Run functional tests with coverage
112+
run: pixi run func-tests-coverage --cov-report=xml:coverage-func.xml
113+
114+
- name: Upload functional tests coverage to Codecov
115+
if: ${{ !cancelled() }}
116+
uses: codecov/codecov-action@v5
117+
with:
118+
name: func-tests-job
119+
flags: functional
120+
files: ./coverage-func.xml
121+
fail_ci_if_error: true
122+
verbose: true
123+
token: ${{ secrets.CODECOV_TOKEN }}
124+
125+
# Job 4: Trigger dashboard build
126+
dashboard-build-trigger:
127+
needs: [docstring-coverage, unit-tests-coverage, func-tests-coverage] # depend on the previous jobs
128+
129+
runs-on: ubuntu-latest
130+
131+
steps:
132+
- name: Check-out repository
133+
uses: actions/checkout@v5
134+
135+
- name: Trigger dashboard build
136+
uses: actions/github-script@v7
137+
with:
138+
github-token: ${{ secrets.GITHUB_TOKEN }}
139+
script: |
140+
await github.rest.actions.createWorkflowDispatch({
141+
owner: context.repo.owner,
142+
repo: context.repo.repo,
143+
workflow_id: "dashboard.yaml",
144+
ref: "${{ env.CI_BRANCH }}"
145+
});

.github/workflows/create-release-pr.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/dashboard.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Dashboard build and publish
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
# Allow only one concurrent workflow, skipping runs queued between the run
8+
# in-progress and latest queued. And cancel in-progress runs.
9+
concurrency:
10+
group:
11+
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
# Set the environment variables to be used in all jobs defined in this workflow
15+
env:
16+
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
17+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
18+
DEVELOP_BRANCH: develop
19+
REPO_OWNER: ${{ github.repository_owner }}
20+
REPO_NAME: ${{ github.event.repository.name }}
21+
22+
jobs:
23+
dashboard:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v5
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up pixi
33+
uses: prefix-dev/[email protected]
34+
with:
35+
environments: default
36+
activate-environment: default
37+
run-install: true
38+
frozen: true
39+
cache: false
40+
post-cleanup: false
41+
42+
- name: Install and setup development dependencies
43+
shell: bash
44+
run: pixi run dev
45+
46+
- name: Run docstring coverage and code complexity/maintainability checks
47+
run: |
48+
for BRANCH in ${{ env.DEFAULT_BRANCH }} ${{ env.DEVELOP_BRANCH }} ${{ env.CI_BRANCH }}; do
49+
echo "=== Processing branch $BRANCH ==="
50+
if [ -d "../worktree-$BRANCH" ]; then
51+
echo "Branch $BRANCH already processed, skipping"
52+
continue
53+
fi
54+
git worktree add ../worktree-$BRANCH origin/$BRANCH
55+
mkdir -p reports/$BRANCH
56+
echo "Docstring coverage for branch $BRANCH"
57+
pixi run interrogate -c pyproject.toml --fail-under=0 ../worktree-$BRANCH/src > reports/$BRANCH/coverage-docstring.txt
58+
echo "Cyclomatic complexity for branch $BRANCH"
59+
pixi run radon cc -s -j ../worktree-$BRANCH/src --exclude ../worktree-$BRANCH/src/easydiffraction/crystallography/space_group_lookup_table.py > reports/$BRANCH/cyclomatic-complexity.json
60+
echo "Maintainability index for branch $BRANCH"
61+
pixi run radon mi -j ../worktree-$BRANCH/src --exclude ../worktree-$BRANCH/src/easydiffraction/crystallography/space_group_lookup_table.py > reports/$BRANCH/maintainability-index.json
62+
echo "Raw metrics for branch $BRANCH"
63+
pixi run radon raw -s -j ../worktree-$BRANCH/src --exclude ../worktree-$BRANCH/src/easydiffraction/crystallography/space_group_lookup_table.py > reports/$BRANCH/raw-metrics.json
64+
done
65+
66+
- name: Generate dashboard HTML
67+
run: |
68+
pixi add --pypi --git https://github.com/enhantica/badgery badgery
69+
pixi run pip show badgery
70+
pixi run python -m badgery --config .badgery.yaml --repo ${{ github.repository }} --branch ${{ env.CI_BRANCH }} --output index.html
71+
72+
- name: Prepare publish directory
73+
run: |
74+
mkdir -p _dashboard_publish/${{ env.REPO_NAME }}/${{ env.CI_BRANCH }}
75+
cp index.html _dashboard_publish/${{ env.REPO_NAME }}/${{ env.CI_BRANCH }}
76+
77+
- name: Publish to main branch of ${{ github.repository }}
78+
uses: peaceiris/actions-gh-pages@v3
79+
with:
80+
external_repository: ${{ env.REPO_OWNER }}/dashboard
81+
publish_branch: ${{ env.DEFAULT_BRANCH }}
82+
personal_token: ${{ secrets.GH_API_PERSONAL_ACCESS_TOKEN }}
83+
publish_dir: ./_dashboard_publish
84+
keep_files: true
85+
86+
- name: Add dashboard link to summary
87+
run: |
88+
URL="https://${{ env.REPO_OWNER }}.github.io/dashboard/${{ env.REPO_NAME }}/${{ env.CI_BRANCH }}"
89+
echo "Dashboard link: [$URL]($URL)" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)