-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (74 loc) · 2.15 KB
/
ci-main.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
name: libcosimpy CI
# This workflow is triggered on pushes to the repository.
on: [push, workflow_dispatch ]
jobs:
test:
name: Tests
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ 'windows-latest', 'ubuntu-latest' ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
timeout-minutes: 35
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 'Run test'
run: |
pip install .
pip install pytest==7.2.2
pytest .
build:
name: build
needs:
- test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ 'windows-latest', 'ubuntu-latest' ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
timeout-minutes: 35
env:
CONAN_REVISIONS_ENABLED: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install build and twine
run: pip install build twine
- name: Run build
run: python -m build
- name: Run twine check
run: twine check --strict dist/*
- uses: actions/upload-artifact@v3
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
name: Upload artifact (source)
with:
name: source
path: ./dist/*.tar.gz
- uses: actions/upload-artifact@v3
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
name: Upload artifact (wheels)
with:
name: wheels
path: ./dist/*.whl
publish:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
needs:
- build
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
path: ./dist/
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}