-
-
Notifications
You must be signed in to change notification settings - Fork 51
75 lines (61 loc) · 2.07 KB
/
test-and-publish.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
name: Test and Publish
on:
push:
workflow_dispatch:
schedule: # Run once a week to detect any regressions
- cron: '0 0 * * 1'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
allow-prereleases: true
- name: Install dependencies
run: |
pip install .[test,openmdao]
- name: Run tests
run: |
python -m pytest
# ------------------------------------------------------------
# Build the distribution and publish (on release tag).
# ------------------------------------------------------------
publish:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Get minimum Python version
run: |
PYTHON_VERSION=$(cat pyproject.toml | grep "requires-python" | grep -Eo "[0-9]+\.[0-9]+")
echo "PYTHON_VERSION=${PYTHON_VERSION}" >> $GITHUB_ENV
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
- name: Install build dependencies
run: |
pip install --upgrade pip
pip install --upgrade build wheel setuptools
- name: Validate links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
file-path: README.md
folder-path: examples/
- name: Build distributions
run: python -m build
- name: Publish package
if: github.repository == 'Project-Platypus/Rhodium' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}