-
Notifications
You must be signed in to change notification settings - Fork 39
120 lines (110 loc) · 3.17 KB
/
pythonpackage.yml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Stable tests
on:
push:
branches: [ '*' ]
tags: [ '*' ]
pull_request:
branches: [ master, 'maint/*' ]
schedule:
- cron: '0 0 * * *'
defaults:
run:
shell: bash
concurrency:
group: python-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check_if_skip:
runs-on: ubuntu-latest
outputs:
commit_message: ${{ steps.get_commit_message.outputs.commit_message }}
steps:
- name: Get repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Print head git commit message
id: get_commit_message
run: |
if [[ -z "$COMMIT_MSG" ]]; then
COMMIT_MSG=$(git show -s --format=%s)
fi
echo $COMMIT_MSG
echo "::set-output name=commit_message::$COMMIT_MSG"
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
build:
needs: check_if_skip
if: "!contains(needs.check_if_skip.outputs.commit_message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Build smriprep
run: pipx run build
- name: Check distributions
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
test:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
install: [repo]
include:
- python-version: "3.11"
install: sdist
- python-version: "3.11"
install: wheel
- python-version: "3.11"
install: editable
env:
INSTALL_TYPE: ${{ matrix.install }}
steps:
- uses: actions/checkout@v3
if: matrix.install == 'repo' || matrix.install == 'editable'
- name: Fetch packages
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
if: matrix.install == 'sdist' || matrix.install == 'wheel'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Select archive
run: |
if [ "$INSTALL_TYPE" = "sdist" ]; then
ARCHIVE=$( ls dist/*.tar.gz )
elif [ "$INSTALL_TYPE" = "wheel" ]; then
ARCHIVE=$( ls dist/*.whl )
elif [ "$INSTALL_TYPE" = "repo" ]; then
ARCHIVE="."
elif [ "$INSTALL_TYPE" = "editable" ]; then
ARCHIVE="-e ."
fi
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Install package
run: python -m pip install $ARCHIVE
- name: Install test dependencies
run: python -m pip install "smriprep[tests]"
- name: Run tests
run: pytest -sv --doctest-modules --cov smriprep --pyargs smriprep
- uses: codecov/codecov-action@v3
name: Submit to CodeCov
flake8:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pipx run flake8 smriprep