-
Notifications
You must be signed in to change notification settings - Fork 2
138 lines (119 loc) · 3.71 KB
/
build-test-deploy.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
on:
push:
pull_request:
branches: [main]
release:
types:
- published
schedule:
- cron: '30 12 1 * *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
# Force tox and pytest to use color
env:
FORCE_COLOR: true
permissions:
contents: read
jobs:
build-package:
name: Build & verify package
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
with:
# Use attestation only if the action is triggered inside the repo
attest-build-provenance-github: ${{ github.event.action == 'published' || github.event_name == 'push' }}
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
dependencies: ['full', 'pre']
include:
- os: ubuntu-latest
python-version: '3.8'
dependencies: 'min'
exclude:
# Skip pre-release tests for Pythons out of SPEC0
- python-version: 3.8
dependencies: pre
- python-version: 3.9
dependencies: pre
env:
DEPENDS: ${{ matrix.dependencies }}
steps:
- uses: actions/checkout@v4
- name: Set git name/email
run: |
git config --global user.email "[email protected]"
git config --global user.name "bids-maintenance"
- name: Set up Python ${{ matrix.python-version }} via conda
uses: conda-incubator/setup-miniconda@v3
if: matrix.os == 'ubuntu-latest'
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: matrix.os != 'ubuntu-latest'
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install git-annex ubuntu
if: matrix.os == 'ubuntu-latest'
run: conda install -c conda-forge git-annex
- name: Install git-annex macos
if: matrix.os == 'macos-latest'
run: brew install git-annex
- name: Install git-annex windows
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install git-annex --yes --ignore-checksums
continue-on-error: true # This can fail for stupid reasons ¯\_(ツ)_/¯
- name: Show software versions
run: |
python -c "import sys; print(sys.version)"
git annex version
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v4
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
release-pypi:
name: Publish released package to pypi.org
environment: release-pypi
if: github.event.action == 'published'
runs-on: ubuntu-latest
needs: [build-package, test]
permissions:
id-token: write
attestations: write
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1