forked from CBICA/FigureGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (54 loc) · 2.19 KB
/
python-package.yml
File metadata and controls
60 lines (54 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build & Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest build wheel coverage pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Test with pytest
run: |
pytest --cov=. --cov-report=xml
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# flags: unittests
# - name: Codacy Coverage Reporter
# # You may pin to the exact commit or the version.
# # uses: codacy/codacy-coverage-reporter-action@3f58b0e12285221110375dffef1150534700246b
# uses: codacy/codacy-coverage-reporter-action@1.0.0
# with:
# # API project token to retrieve your remote Codacy configuration for the project being analyzed
# project-token: ${{ secrets.CODECOV_TOKEN }}
# # API account token to retrieve your remote Codacy configuration for the project being analyzed
# api-token: # optional
# # Optional comma separated list of coverage reports to send to Codacy
# coverage-reports: ./coverage.xml
- name: Build distributions
run: python setup.py sdist
- name: Publish package to PyPI
if: github.repository == 'CBICA/FigureGenerator' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}