-
Notifications
You must be signed in to change notification settings - Fork 67
136 lines (127 loc) · 4.18 KB
/
ci_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
name: enterprise CI targets
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
release:
types:
- published
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install non-python dependencies on mac
if: runner.os == 'macOS'
run: |
brew unlink gcc && brew link gcc
brew install automake suite-sparse
curl -sSL https://raw.githubusercontent.com/vallis/libstempo/master/install_tempo2.sh | sh
- name: Install non-python dependencies on linux
if: runner.os == 'Linux'
run: |
sudo apt-get install libsuitesparse-dev
curl -sSL https://raw.githubusercontent.com/vallis/libstempo/master/install_tempo2.sh | sh
- name: Install dependencies and package
env:
SUITESPARSE_INCLUDE_DIR: "/usr/local/opt/suite-sparse/include/suitesparse/"
SUITESPARSE_LIBRARY_DIR: "/usr/local/opt/suite-sparse/lib"
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements_dev.txt
python -m pip install -e .
- name: Display Python, pip, setuptools, and all installed versions
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
python -m pip freeze
- name: Run lint
run: make lint
- name: Test with pytest
run: make test
- name: Codecov
uses: codecov/codecov-action@v4
#with:
# fail_ci_if_error: true
build:
needs: [tests]
name: Build source distribution
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install non-python dependencies on linux
run: |
sudo apt-get install libsuitesparse-dev
curl -sSL https://raw.githubusercontent.com/vallis/libstempo/master/install_tempo2.sh | sh
- name: Build
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install -r requirements_dev.txt
make dist
- name: Test deployability
run: |
pip install twine
twine check dist/*
- name: Test the sdist
run: |
mkdir tmp
cd tmp
python -m venv venv-sdist
venv-sdist/bin/python -m pip install --upgrade pip setuptools wheel
venv-sdist/bin/python -m pip install ../dist/enterprise*.tar.gz
venv-sdist/bin/python -c "import enterprise;print(enterprise.__version__)"
- name: Test the wheel
run: |
mkdir tmp2
cd tmp2
python -m venv venv-wheel
venv-wheel/bin/python -m pip install --upgrade pip setuptools
venv-wheel/bin/python -m pip install ../dist/enterprise*.whl
venv-wheel/bin/python -c "import enterprise;print(enterprise.__version__)"
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
deploy:
needs: [tests, build]
runs-on: ubuntu-latest
environment: deploy
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Download wheel/dist from build
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Build and publish
uses: pypa/gh-action-pypi-publish@release/v1