-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (133 loc) · 3.54 KB
/
build-test.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
139
140
141
name: build-test
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
schedule:
# 7am EST / 8am EDT Mondays
- cron: '0 12 * * 1'
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3
- name: Check python version and install build
run: python --version
- name: Build migas
run: pipx run build
- name: Check distributions
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
test:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
install: [repo]
include:
- python-version: '3.12'
install: sdist
- python-version: '3.12'
install: wheel
- python-version: '3.12'
install: editable
env:
INSTALL_TYPE: ${{ matrix.install }}
steps:
- uses: actions/checkout@v4
if: matrix.install == 'repo' || matrix.install == 'editable'
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- 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 and test dependencies
run: python -m pip install $ARCHIVE[test]
- uses: actions/checkout@v3
with:
repository: 'nipreps/migas-server'
path: 'migas-server'
- name: Start up local server
run: |
cd migas-server
pip install hatch
make compose-up
env:
MIGAS_BYPASS_RATE_LIMIT: '1'
- name: Verify server is available
run: docker port ${MIGAS_SERVER_NAME} && sleep 10
env:
MIGAS_SERVER_NAME: app
- name: Run tests
env:
MIGAS_FRESH_DB: '1'
run: python -m pytest -sv --doctest-modules --pyargs migas
- name: Stop local server
run: docker compose -f migas-server/docker-compose.yml down
release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3
- name: Verify python version
run: python -V
- name: Fetch packaged build
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Upload to PyPI if tagged
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create GitHub release from annotated tag
uses: spenserblack/actions-tag-to-release@v3
with:
prerelease: auto
prerelease-pattern: '*rc*'