Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: rework CI workflows #7

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Post coverage comment

on:
workflow_run:
workflows: ["build"]
workflows: ["tests"]
types:
- completed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
with:
name: release-dists
path: dist/
if-no-files-found: error

pypi-publish:
runs-on: ubuntu-22.04
Expand All @@ -61,3 +62,22 @@ jobs:

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-publish:
name: Upload the release package to GitHub Release
needs:
- release-build
runs-on: ubuntu-22.04
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
steps:
- name: Retrieve the package from GitHub actions artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist/
- name: Upload the release package to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
run: gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
File renamed without changes.
31 changes: 29 additions & 2 deletions .github/workflows/build.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

name: build
name: tests

on:
push:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
pixi-version: v0.25.0
environments: test
- name: Run Tests
run: pixi run test-ci
run: pixi run -e test test-ci
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
Expand Down Expand Up @@ -89,3 +89,30 @@ jobs:
run: pixi run doc
- name: Run doctests
run: pixi run 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.9"
- 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
-->

[![docs](https://img.shields.io/badge/docs-stable-orange.svg)](https://gridtk.readthedocs.io/en/stable/)
[![build](https://github.com/idiap/gridtk/actions/workflows/build.yml/badge.svg)](https://github.com/idiap/gridtk/actions/workflows/build.yml)
[![tests](https://github.com/idiap/gridtk/actions/workflows/tests.yml/badge.svg)](https://github.com/idiap/gridtk/actions/workflows/tests.yml)
[![coverage](https://raw.githubusercontent.com/idiap/gridtk/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/idiap/gridtk/blob/python-coverage-comment-action-data/htmlcov/index.html)
[![repository](https://img.shields.io/badge/github-project-0000c0.svg)](https://github.com/idiap/gridtk)

Expand Down
4 changes: 2 additions & 2 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ doctest = "sphinx-build -aEb doctest doc html/doctest"

[tool.pixi.feature.test.tasks]
test = "pytest -sv tests/"
test-ci = "pytest -sv --cov-branch --cov-report xml --ignore '.profile' tests/"
test-ci = "pytest -sv --cov-branch tests/"

[tool.pixi.environments]
default = { features = ["doc", "test"], solve-group = "default" }
Expand Down Expand Up @@ -161,8 +161,6 @@ convention = "numpy"

[tool.pytest.ini_options]
addopts = ["--cov=gridtk", "--cov-report=term-missing", "--import-mode=append"]
junit_logging = "all"
junit_log_passing_tests = false

[tool.coverage.run]
relative_files = true
Expand Down
Loading