chore: adapt the project to GitHub #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
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 |