Skip to content

Commit 0f30395

Browse files
committed
Fix CI/CD pipeline to run on main branch merges
- Update build job to run on both main branch pushes and tags - Update test and lint jobs to run on main branch pushes - Only upload build artifacts when building from tags (for PyPI) - Add version display step for debugging - Install setuptools_scm in build dependencies This ensures: - Main branch merges trigger testing and building - Only tagged releases are published to PyPI - Development builds are tested but not published
1 parent cb214e1 commit 0f30395

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
lint:
12-
if: github.event_name == 'pull_request'
12+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Check out the repository
@@ -31,7 +31,7 @@ jobs:
3131

3232
test:
3333
needs: lint
34-
if: github.event_name == 'pull_request'
34+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
3535
name: Test on ${{ matrix.os }}
3636
runs-on: ${{ matrix.os }}
3737
strategy:
@@ -65,7 +65,7 @@ jobs:
6565
pytest tests/ --doctest-modules --junitxml=junit/test-results.xml --cov=src/echr_extractor --cov-report=xml --cov-report=html
6666
6767
build:
68-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
68+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
6969
name: Build Python package
7070
runs-on: ubuntu-latest
7171
steps:
@@ -78,13 +78,18 @@ jobs:
7878
- name: Install build dependencies
7979
run: |
8080
python -m pip install --upgrade pip
81-
pip install setuptools wheel build
81+
pip install setuptools wheel build setuptools_scm
82+
83+
- name: Show version that will be built
84+
run: |
85+
python -c "import setuptools_scm; print('Version:', setuptools_scm.get_version())"
8286
8387
- name: Build package
8488
run: |
8589
python -m build
8690
8791
- name: Upload build artifacts
92+
if: startsWith(github.ref, 'refs/tags/')
8893
uses: actions/upload-artifact@v4
8994
with:
9095
name: python-package-distributions

0 commit comments

Comments
 (0)