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

chore: adapt the project to GitHub #1

Merged
merged 34 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
db38fed
chore(pre-commit): add conventional-pre-commit.
Yannick-Dayer Jul 8, 2024
6efe856
ci: remove the GitLab CI configuration.
Yannick-Dayer Jul 8, 2024
caaae4e
chore(readme): change the url and badges.
Yannick-Dayer Jul 8, 2024
c930302
docs: update the doc source URLs and install URLs.
Yannick-Dayer Jul 8, 2024
f66737c
chore: update the remaining project URLs
Yannick-Dayer Jul 8, 2024
bbcd3b2
chore(pre-commit): auto-install 'commit-msg' hook.
Yannick-Dayer Jul 8, 2024
85b2880
chore(QA): remove excludes from reuse pre-commit.
Yannick-Dayer Jul 10, 2024
5aee465
chore(QA): add a pixi hook to pre-commit. Update pixi.
Yannick-Dayer Jul 10, 2024
a8e9090
chore(readme): fix the tests and coverage badges
Yannick-Dayer Jul 10, 2024
6bb24e0
chore(license): add the year and owner in the license.
Yannick-Dayer Jul 10, 2024
00845cf
ci: rename pixi environment to "test-alternative".
Yannick-Dayer Jul 10, 2024
b165fc4
ci: add the CI workflows for GitHub Actions.
Yannick-Dayer Jul 10, 2024
fc2e0f0
ci: add dynamic "runs-on" for matrix job.
Yannick-Dayer Jul 10, 2024
96ae936
ci(docs): always add the preview link to new Pull Requests.
Yannick-Dayer Jul 10, 2024
1a30b3e
ci: prevent shallow git checkouts for versioningit.
Yannick-Dayer Jul 10, 2024
e8cdaff
ci: coverage-comment action requires relative files.
Yannick-Dayer Jul 10, 2024
4d6e30c
ci: correctly merge the reports before the comment
Yannick-Dayer Jul 11, 2024
66bb8e1
ci: remove unnecessary permissions in test job.
Yannick-Dayer Jul 11, 2024
09c8b22
ci: give COVERAGE_FILE to pytest instead of renaming the file.
Yannick-Dayer Jul 11, 2024
4fd9d0b
ci: use secrets.github_token instead of github.token
Yannick-Dayer Jul 11, 2024
7838b23
ci: remove unnecessary merge parameter in coverage comment
Yannick-Dayer Jul 11, 2024
ae0ba75
ci: make merge-coverage job dependent on tests job
Yannick-Dayer Jul 11, 2024
4cc95ca
ci: checkout the repository in merge-coverage job.
Yannick-Dayer Jul 11, 2024
c9c17aa
ci: add upload of built package to the current release.
Yannick-Dayer Jul 11, 2024
6ec6210
ci: remove generation of xml and junit coverage reports.
Yannick-Dayer Jul 11, 2024
3a112ca
chore(readme): fix the coverage badge.
Yannick-Dayer Jul 11, 2024
996bd9c
ci: fix the docs preview workflow execution condition.
Yannick-Dayer Jul 11, 2024
ccef650
ci: add dependabot.
Yannick-Dayer Jul 11, 2024
80729c0
ci(pixi): specify the environment for run commands
Yannick-Dayer Jul 15, 2024
79ca807
chore: fix pyproject.toml command and dependencies
Yannick-Dayer Jul 15, 2024
652520f
ci: build and install the package during the tests
Yannick-Dayer Jul 15, 2024
7936091
chore: syntax highlighting for GitHub in pixi.lock
Yannick-Dayer Jul 17, 2024
747ae78
chore: remove duplicate pip vs conda dependencies.
Yannick-Dayer Jul 17, 2024
fd48cad
ci(dependabot): group updates in one pull request.
Yannick-Dayer Jul 17, 2024
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
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright © Idiap Research Institute <[email protected]>
#
# SPDX-License-Identifier: BSD-3-Clause

# dependabot.yaml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
# Maintain dependencies in our GitHub Workflows
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
time: "05:00"
timezone: CET
Yannick-Dayer marked this conversation as resolved.
Show resolved Hide resolved
42 changes: 42 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
# SPDX-FileContributor: Yannick Dayer <[email protected]>

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

# Inspired from https://github.com/py-cov-action/python-coverage-comment-action

name: Add a coverage comment to the Pull Request

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

jobs:
coverage-comment:
name: Send (or modify) a coverage comment to the PR
runs-on: ubuntu-22.04
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
# Gives the action the necessary permissions for looking up the
# workflow that launched this workflow, and download the related
# artifact that contains the comment to be published
actions: read
steps:
# DO NOT run actions/checkout here, for security reasons
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- name: Post comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
# Update those if you changed the default values:
# COMMENT_ARTIFACT_NAME: python-coverage-comment-action
# COMMENT_FILENAME: python-coverage-comment-action.txt
74 changes: 74 additions & 0 deletions .github/workflows/deploy_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
# SPDX-FileContributor: Yannick Dayer <[email protected]>

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

name: Publish package to Pypi

on:
release:
types: [published]

jobs:
release-packaging:
name: Package the project into a deploy-ready state
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
run: python -m build
Yannick-Dayer marked this conversation as resolved.
Show resolved Hide resolved
- name: Produce a GitHub actions artifact (the package)
uses: actions/upload-artifact@v4
with:
name: release-dist
path: dist/
if-no-files-found: error

pypi-publish:
name: Upload the release package to PyPI
needs:
- release-packaging
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/p/clapper
permissions:
id-token: write # This permission is mandatory for trusted publishing
steps:
- name: Retrieve the package from GitHub actions artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Upload the release package to GitHub Release
needs:
- pypi-publish
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 }}'
25 changes: 25 additions & 0 deletions .github/workflows/doc-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
# SPDX-FileContributor: Yannick Dayer <[email protected]>

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

# Inspired from https://github.com/readthedocs/actions/tree/v1/preview

name: Documentation preview on readthedocs for Pull Requests

on:
pull_request_target:
types:
- opened

permissions:
pull-requests: write

jobs:
documentation-links:
runs-on: ubuntu-22.04
steps:
- name: Modify the PR with a link to the new docs
uses: readthedocs/actions/preview@v1
with:
project-slug: "clapper"
26 changes: 26 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
# SPDX-FileContributor: Yannick Dayer <[email protected]>

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

name: Check the project is up to our quality standards

on:
pull_request:
push:

jobs:
pre-commit:
name: Run pre commit on all modified files
runs-on: ubuntu-22.04
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Run pre-commit
uses: pre-commit/[email protected]
env:
SKIP: pixi
94 changes: 94 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
# SPDX-FileContributor: Yannick Dayer <[email protected]>

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

name: Execute code tests

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

permissions:
contents: read

jobs:
tests:
strategy:
matrix:
os: [ubuntu-22.04, macos-14]
pixi_environment: [test, test-alternative] # latest and previous python
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.25.0
environments: ${{ matrix.pixi_environment }}
- name: Run Tests
run: pixi run test-ci
Yannick-Dayer marked this conversation as resolved.
Show resolved Hide resolved
env:
COVERAGE_FILE: ".coverage.${{ matrix.pixi_environment }}-${{ matrix.os }}"
- name: Store coverage report
uses: actions/upload-artifact@v4
with:
# File renamed for thix matrix element
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
runs-on: ubuntu-22.04
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Retrieve coverage artifacts
uses: actions/download-artifact@v4
id: download
with:
pattern: coverage-*
merge-multiple: true
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MERGE_COVERAGE_FILES: true
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt

doc:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.25.0
environments: doc
- name: Build docs
run: pixi run doc
- name: Run doctests
run: pixi run doctest
7 changes: 0 additions & 7 deletions .gitlab-ci.yml

This file was deleted.

20 changes: 15 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

default_install_hook_types: ["pre-commit", "commit-msg"]
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
hooks:
Expand Down Expand Up @@ -33,8 +41,10 @@ repos:
rev: v3.0.2
hooks:
- id: reuse
exclude: |
(?x)(
^.pixi/|
^.pixi.lock|
)
- repo: local
hooks:
- id: pixi
name: Check outdated pixi.lock
language: system
entry: pixi list --locked
pass_filenames: false
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: clapper
Upstream-Contact: Andre Anjos <[email protected]>
Source: https://gitlab.idiap.ch/software/clapper
Source: https://github.com/idiap/clapper

Files:
pixi.lock
Expand Down
2 changes: 1 addition & 1 deletion LICENSES/BSD-3-Clause.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) <year> <owner>.
Copyright © 2024 Idiap Research Institute <[email protected]>.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ SPDX-License-Identifier: BSD-3-Clause
-->

[![latest-docs](https://img.shields.io/badge/docs-latest-orange.svg)](https://clapper.readthedocs.io/en/latest/)
[![build](https://gitlab.idiap.ch/software/clapper/badges/main/pipeline.svg)](https://gitlab.idiap.ch/software/clapper/commits/main)
[![coverage](https://gitlab.idiap.ch/software/clapper/badges/main/coverage.svg)](https://www.idiap.ch/software/biosignal/docs/software/clapper/main/coverage/index.html)
[![repository](https://img.shields.io/badge/gitlab-project-0000c0.svg)](https://gitlab.idiap.ch/software/clapper)

[![tests](https://github.com/idiap/clapper/main/actions/workflows/tests.svg)](https://github.com/idiap/clapper/actions)
[![coverage](https://raw.githubusercontent.com/idiap/clapper/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/idiap/clapper/python-coverage-comment-action-data/htmlcov/index.html)
[![repository](https://img.shields.io/badge/github-latest-darkblue.svg)](https://github.com/idiap/clapper)

# Configuration Support for Python Packages and CLIs

Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
html_theme = "furo"

html_theme_options = {
"source_edit_link": f"https://gitlab.idiap.ch/software/{project}/-/edit/main/doc/{{filename}}",
"source_edit_link": f"https://github.com/idiap/{project}/edit/main/doc/{{filename}}",
}

html_title = f"{project} {release}"
Expand Down
4 changes: 2 additions & 2 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ relevant tab for details on each of those installation paths.

.. code:: sh

pip install git+https://gitlab.idiap.ch/software/clapper@main
pip install git+https://github.com/idiap/clapper@main


.. tab:: Deployment (pixi)
Expand All @@ -46,7 +46,7 @@ relevant tab for details on each of those installation paths.

.. code:: sh

git clone git@gitlab.idiap.ch:software/clapper
git clone git@github.com:idiap/clapper
pixi install --frozen

.. tip::
Expand Down
Loading
Loading