Skip to content

Commit 5dca0e5

Browse files
committed
Merge branch 'master' into clients
2 parents 548fba3 + 76760e7 commit 5dca0e5

183 files changed

Lines changed: 4816 additions & 67603 deletions

File tree

Some content is hidden

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

.github/workflows/bump-version.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ permissions:
1010
contents: write
1111
pull-requests: write
1212

13+
env:
14+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
15+
1316
jobs:
1417
bump-version:
1518
# Run only when a release label is added to an open PR
@@ -23,23 +26,40 @@ jobs:
2326

2427
steps:
2528
- name: Check out PR branch
26-
uses: actions/checkout@v4
29+
uses: actions/checkout@v6.0.2
2730
with:
2831
ref: ${{ github.head_ref }}
2932
fetch-depth: 0
3033
token: ${{ secrets.GITHUB_TOKEN }}
3134

3235
- name: Set up Python
33-
uses: actions/setup-python@v5
36+
uses: actions/setup-python@v6.2.0
3437
with:
3538
python-version: "3.13"
3639

3740
- name: Install tools
3841
run: |
39-
pip install bump-my-version pandoc
42+
pip install bump-my-version
4043
sudo apt-get update
4144
sudo apt-get install -y pandoc
42-
cargo install git-cliff
45+
46+
- name: Install git-cliff binary
47+
run: |
48+
GIT_CLIFF_VERSION="2.12.0"
49+
ARCH="$(uname -m)"
50+
if [ "$ARCH" = "x86_64" ]; then
51+
TARGET="x86_64-unknown-linux-gnu"
52+
elif [ "$ARCH" = "aarch64" ]; then
53+
TARGET="aarch64-unknown-linux-gnu"
54+
else
55+
echo "Unsupported architecture: $ARCH"
56+
exit 1
57+
fi
58+
59+
curl -sSL -o git-cliff.tar.gz "https://github.com/orhun/git-cliff/releases/download/v${GIT_CLIFF_VERSION}/git-cliff-${GIT_CLIFF_VERSION}-${TARGET}.tar.gz"
60+
tar -xzf git-cliff.tar.gz
61+
sudo install -m 755 "git-cliff-${GIT_CLIFF_VERSION}/git-cliff" /usr/local/bin/git-cliff
62+
git cliff --version
4363
4464
- name: Set up Git user
4565
run: |
@@ -65,7 +85,7 @@ jobs:
6585
- name: Extract version
6686
id: version
6787
run: |
68-
VERSION=$(bump-my-version show current)
88+
VERSION=$(grep '^version = ' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
6989
echo "Extracted version: $VERSION"
7090
echo "version=$VERSION" >> $GITHUB_OUTPUT
7191
@@ -97,7 +117,7 @@ jobs:
97117
git push origin HEAD:${{ github.head_ref }}
98118
99119
- name: Add comment to PR
100-
uses: actions/github-script@v7
120+
uses: actions/github-script@v9.0.0
101121
with:
102122
script: |
103123
github.rest.issues.createComment({

.github/workflows/publish.yml

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,111 @@
11
name: Publish to PyPI
22

33
on:
4-
pull_request:
5-
types: [closed]
4+
push:
65
branches:
76
- master
87

98
permissions:
109
contents: write
1110
id-token: write
11+
pull-requests: read
12+
13+
env:
14+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
1215

1316
jobs:
1417
publish:
15-
# Run only after PR is merged with release labels
16-
if: |
17-
github.event.pull_request.merged == true && (
18-
contains(github.event.pull_request.labels.*.name, 'release:major') ||
19-
contains(github.event.pull_request.labels.*.name, 'release:minor') ||
20-
contains(github.event.pull_request.labels.*.name, 'release:patch')
21-
)
2218
runs-on: ubuntu-latest
2319

2420
steps:
2521
- name: Check out repository
26-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6.0.2
2723
with:
2824
fetch-depth: 0
2925

26+
- name: Check merged PR release label
27+
id: release_label_check
28+
uses: actions/github-script@v9.0.0
29+
with:
30+
script: |
31+
const releaseLabels = ['release:major', 'release:minor', 'release:patch'];
32+
const { owner, repo } = context.repo;
33+
const commitSha = context.sha;
34+
35+
const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({
36+
owner,
37+
repo,
38+
commit_sha: commitSha,
39+
});
40+
41+
const mergedPr = prs.data.find((pr) => pr.merged_at && pr.base?.ref === 'master');
42+
43+
if (!mergedPr) {
44+
core.notice(`No merged PR associated with commit ${commitSha}. Skipping publish.`);
45+
core.setOutput('should_publish', 'false');
46+
return;
47+
}
48+
49+
const labelNames = (mergedPr.labels || [])
50+
.map((label) => label?.name)
51+
.filter(Boolean);
52+
const matchedLabel = releaseLabels.find((label) => labelNames.includes(label));
53+
54+
if (!matchedLabel) {
55+
core.notice(
56+
`Merged PR #${mergedPr.number} does not include a release label (${releaseLabels.join(', ')}). Skipping publish.`
57+
);
58+
core.setOutput('should_publish', 'false');
59+
return;
60+
}
61+
62+
core.info(`Merged PR #${mergedPr.number} has label ${matchedLabel}. Publishing enabled.`);
63+
core.setOutput('should_publish', 'true');
64+
core.setOutput('release_label', matchedLabel);
65+
core.setOutput('pr_number', String(mergedPr.number));
66+
3067
- name: Set up Python
31-
uses: actions/setup-python@v5
68+
if: steps.release_label_check.outputs.should_publish == 'true'
69+
uses: actions/setup-python@v6.2.0
3270
with:
3371
python-version: "3.13"
3472

3573
- name: Install tools
74+
if: steps.release_label_check.outputs.should_publish == 'true'
3675
run: pip install bump-my-version build
3776

3877
- name: Extract version
3978
id: version
79+
if: steps.release_label_check.outputs.should_publish == 'true'
4080
run: |
4181
VERSION=$(bump-my-version show current_version)
4282
echo "version=$VERSION" >> $GITHUB_OUTPUT
4383
44-
- name: Create GitHub Release
45-
uses: softprops/action-gh-release@v2
46-
with:
47-
tag_name: v${{ steps.version.outputs.version }}
48-
name: v${{ steps.version.outputs.version }}
49-
body_path: CHANGELOG.md
50-
generate_release_notes: false
51-
5284
- name: Build package
85+
if: steps.release_label_check.outputs.should_publish == 'true'
5386
run: python -m build
5487

5588
- name: Publish to TestPyPI
5689
id: test-pypi
90+
if: steps.release_label_check.outputs.should_publish == 'true'
5791
uses: pypa/gh-action-pypi-publish@v1.13.0
5892
with:
5993
repository-url: https://test.pypi.org/legacy/
6094
skip-existing: true
6195
attestations: false
6296

6397
- name: Publish to PyPI
64-
if: steps.test-pypi.outcome == 'success'
98+
id: pypi
99+
if: steps.release_label_check.outputs.should_publish == 'true' && steps.test-pypi.outcome == 'success'
65100
uses: pypa/gh-action-pypi-publish@v1.13.0
66101
with:
67-
skip-existing: true
102+
skip-existing: true
103+
104+
- name: Create GitHub Release
105+
if: steps.release_label_check.outputs.should_publish == 'true' && steps.pypi.outcome == 'success'
106+
uses: softprops/action-gh-release@v2
107+
with:
108+
tag_name: v${{ steps.version.outputs.version }}
109+
name: v${{ steps.version.outputs.version }}
110+
body_path: CHANGELOG.md
111+
generate_release_notes: false

.github/workflows/tests.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ jobs:
2323
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
2424
defaults:
2525
run:
26-
shell: bash -el {0}
26+
shell: bash -e {0}
2727

2828
steps:
2929
- uses: actions/checkout@v4
30-
- uses: conda-incubator/setup-miniconda@v3
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v5
3133
with:
32-
auto-update-conda: true
3334
python-version: ${{ matrix.python-version }}
3435

36+
- name: Set up uv
37+
uses: astral-sh/setup-uv@v5
38+
3539
- name: Cache MTH5 Test Fixtures
3640
uses: actions/cache@v3
3741
with:
@@ -46,18 +50,21 @@ jobs:
4650
- name: Install Env
4751
run: |
4852
python --version
49-
conda install pytest
50-
conda install pytest-cov
51-
conda install pytest-subtests
52-
conda install pytest-xdist[psutil]
53-
conda install pytest-benchmark
54-
conda install setuptools
55-
pip install mt_metadata[obspy]
56-
pip install git+https://github.com/kujaku11/mth5_test_data.git
53+
uv pip install --system \
54+
pytest \
55+
pytest-cov \
56+
pytest-subtests \
57+
"pytest-xdist[psutil]" \
58+
pytest-benchmark \
59+
setuptools \
60+
"mt_metadata[obspy]" \
61+
"git+https://github.com/kujaku11/mt-io.git@develop" \
62+
"git+https://github.com/kujaku11/mth5_test_data.git"
63+
5764
- name: Install Our Package
5865
run: |
59-
pip install -e .
60-
conda list
66+
uv pip install --system -e .
67+
pip list
6168
6269
#- name: Install Jupyter and dependencies
6370
# run: |

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@
88
"tests"
99
],
1010
"python.testing.autoTestDiscoverOnSaveEnabled": true,
11-
"python.testing.cwd": "${workspaceFolder}"
11+
"python.testing.cwd": "${workspaceFolder}",
12+
"python-envs.pythonProjects": [
13+
{
14+
"path": ".",
15+
"envManager": "ms-python.python:conda",
16+
"packageManager": "ms-python.python:conda"
17+
}
18+
]
1219
}

HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
=========
33

4+
All notable changes to this project will be documented in this file.
5+
Changelog
6+
=========
7+
8+
All notable changes to this project will be documented in this file.
9+
Changelog
10+
=========
11+
412
All notable changes to this project will be documented in this file.
513
History
614
=========

0 commit comments

Comments
 (0)