Skip to content

Commit 400b5fa

Browse files
msch-nutrientclaude
andcommitted
Make release workflow DRY by reusing CI workflow
- Add workflow_call trigger to CI workflow for reusability - Update integration tests to run on workflow_call events - Release workflow now calls CI workflow instead of duplicating steps - Simplified release job to only handle semantic release and PyPI publishing - Maintains all quality checks while reducing code duplication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c5bab88 commit 400b5fa

File tree

2 files changed

+7
-43
lines changed

2 files changed

+7
-43
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ main, develop ]
66
pull_request:
77
branches: [ main, develop ]
8+
workflow_call:
89

910
jobs:
1011
test:
@@ -57,7 +58,7 @@ jobs:
5758

5859
integration-test:
5960
runs-on: ubuntu-latest
60-
if: github.event_name == 'pull_request'
61+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_call'
6162

6263
steps:
6364
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ on:
1414
- major
1515

1616
jobs:
17+
ci:
18+
uses: ./.github/workflows/ci.yml
19+
secrets: inherit
20+
1721
release:
1822
runs-on: ubuntu-latest
23+
needs: ci
1924
concurrency: release
2025
permissions:
2126
id-token: write
@@ -27,53 +32,11 @@ jobs:
2732
fetch-depth: 0
2833
token: ${{ secrets.GITHUB_TOKEN }}
2934

30-
- name: Set up Python
31-
uses: actions/setup-python@v5
32-
with:
33-
python-version: '3.12'
34-
35-
- name: Cache pip dependencies
36-
uses: actions/cache@v4
37-
with:
38-
path: ~/.cache/pip
39-
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
40-
restore-keys: |
41-
${{ runner.os }}-pip-
42-
4335
- name: Install Pixi
4436
uses: prefix-dev/setup-pixi@v0.8.1
4537
with:
4638
pixi-version: v0.29.0
4739

48-
- name: Run linting with ruff
49-
run: |
50-
pixi run python -m ruff check .
51-
pixi run python -m ruff format --check .
52-
53-
- name: Run type checking with mypy
54-
run: pixi run python -m mypy src tests
55-
56-
- name: Run unit tests with pytest
57-
run: pixi run python -m pytest tests/unit/ -v --cov=nutrient_dws --cov-report=xml --cov-report=term
58-
59-
- name: Run integration tests
60-
if: github.repository == 'jdrhyne/nutrient-dws-client-python'
61-
run: |
62-
pixi run python -c "
63-
import os
64-
with open('tests/integration/integration_config.py', 'w') as f:
65-
f.write(f'API_KEY = \"{os.environ[\"NUTRIENT_DWS_API_KEY\"]}\"\n')
66-
"
67-
pixi run python -m pytest tests/integration/ -v
68-
env:
69-
NUTRIENT_DWS_API_KEY: ${{ secrets.NUTRIENT_DWS_API_KEY }}
70-
71-
- name: Build package
72-
run: pixi run python -m build
73-
74-
- name: Check package with twine
75-
run: pixi run twine check dist/*
76-
7740
- name: Semantic Release
7841
run: pixi run python -m semantic_release version --${{ inputs.level }}
7942
env:

0 commit comments

Comments
 (0)