Skip to content

Commit

Permalink
ci: build and install the package during the tests
Browse files Browse the repository at this point in the history
Add a job in tests.yaml that builds the package and installs the wheel.
This should ensures the release package can also be built correctly.
  • Loading branch information
Yannick-Dayer committed Jul 15, 2024
1 parent 79ca807 commit 652520f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# SPDX-License-Identifier: BSD-3-Clause

name: Publish package to Pypi
name: Publish package to Pypi and to the current release

on:
release:
Expand Down Expand Up @@ -54,10 +54,10 @@ jobs:
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
github-publish:
name: Upload the release package to GitHub Release
needs:
- pypi-publish
- release-packaging
runs-on: ubuntu-22.04
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
Expand Down
31 changes: 28 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

# SPDX-License-Identifier: BSD-3-Clause

name: Execute code tests
name: Test the code, doc building, and packaging

on:
push:
branches: [ "main" ]
tags: ["*"]
pull_request:

permissions:
Expand Down Expand Up @@ -42,7 +41,6 @@ jobs:
name: coverage-${{ matrix.pixi_environment }}-${{ matrix.os }}
path: .coverage.${{ matrix.pixi_environment }}-${{ matrix.os }}


merge-coverage:
name: Merge the coverage reports from multiple coverages
needs: tests
Expand Down Expand Up @@ -92,3 +90,30 @@ jobs:
run: pixi run -e doc doc
- name: Run doctests
run: pixi run -e doc doctest

test-packaging:
name: Package the project into a distributable file
runs-on: ubuntu-22.04
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build dependencies
run: |
pip install --upgrade pip
pip install build
- name: Package the project to the dist dir
run: python -m build
- name: Try installing from the new dists
run: pip install dist/*.whl
- name: Produce a GitHub actions artifact (the distributable package)
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error

0 comments on commit 652520f

Please sign in to comment.