-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (73 loc) · 2.17 KB
/
python-ci.yml
File metadata and controls
90 lines (73 loc) · 2.17 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# This workflow will for a variety of Python versions
# - install the code base
# - lint the code base
# - test the code base
# - upload the test coverage to codecov
#
# It will also
# - build the package
# - check the package
#
name: CI using pip
on: [push, pull_request]
jobs:
Code_Consistency:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
- name: Suggestion to fix issues
if: ${{ failure() }}
run: |
echo "::notice::In project root run 'python.exe -m ruff . --fix' and commit changes to fix issues."
exit 1
Code_Testing:
strategy:
max-parallel: 4
matrix:
python-version: ['3.11', '3.12', '3.13']
os: [ubuntu-latest, macos-latest, windows-2022]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -e '.[dev]'
- name: Test with pytest and coverage
run: |
pip install pytest pytest-cov
pytest --cov=src/easyreflectometry tests --cov-branch --cov-report=xml:coverage-unit.xml
- name: Upload coverage reports to Codecov
# only on ubuntu to avoid multiple uploads
if: runner.os == 'Linux'
uses: codecov/codecov-action@v5
with:
name: unit-tests-job
flags: unittests
files: ./coverage-unit.xml
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: EasyScience/EasyReflectometryLib
Package_Testing:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies and build
run: |
pip install -e '.[dev]'
python -m build
- name: Check Build
run: |
cd ./dist
pytest ../