11name : Continuous integration
22
33on :
4- - push
4+ push :
5+ pull_request :
56
67jobs :
78 getVersionNumber :
89 name : Get version number
9- if : startsWith(github.ref, 'refs/tags/') && github.actor != 'biosimulators-daemon ' && !contains(github.event.head_commit.message, '[skip ci]')
10- runs-on : ubuntu-20 .04
10+ if : " startsWith(github.ref, 'refs/tags/') && github.actor != 'allcontributors ' && !contains(github.event.head_commit.message, '[skip ci]')"
11+ runs-on : ubuntu-22 .04
1112 outputs :
1213 version : ${{ steps.get-version-number.outputs.version }}
1314 steps :
@@ -17,15 +18,22 @@ jobs:
1718 TAG : ${{ github.ref }}
1819 run : |
1920 version="${TAG/refs\/tags\//}"
20- echo "::set-output name= version:: $version"
21+ echo "version= $version" >> $GITHUB_OUTPUT
2122
2223 build :
2324 name : Lint, test, and compile documentation
24- if : github.actor != 'biosimulators-daemon' && !contains(github.event.head_commit.message, '[skip ci]')
25- runs-on : ubuntu-20.04
25+ if : " !contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'allcontributors'"
26+ runs-on : ubuntu-22.04
27+ strategy :
28+ matrix :
29+ python-version : [ "3.10" ]
30+ fail-fast : false
31+ defaults :
32+ run :
33+ shell : bash
2634 steps :
2735 - name : Checkout repository
28- uses : actions/checkout@v2
36+ uses : actions/checkout@v4
2937 with :
3038 fetch-depth : 1
3139
3846 - name : Install Python
3947 uses : actions/setup-python@v2
4048 with :
41- python-version : ' 3.9'
42-
43- - name : Setup pip cache
44- uses : actions/cache@v2
45- with :
46- path : /opt/hostedtoolcache/Python
47- key : ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.optional.txt') }}
48- restore-keys : |
49- ${{ runner.os }}-pip-
49+ python-version : ' 3.10'
5050
5151 - name : Install pip and setuptools
5252 run : |
@@ -66,36 +66,23 @@ jobs:
6666
6767 - name : Install XPP
6868 run : |
69- sudo apt-get update -y
70- sudo apt-get install -y --no-install-recommends wget make gcc libx11-dev libc6-dev
71-
72- cd /tmp
73- wget http://www.math.pitt.edu/~bard/bardware/xppaut_latest.tar.gz
74- mkdir xpp
75- tar zxvf xppaut_latest.tar.gz --directory xpp
76- cd xpp
77- make
78- sudo make install
79-
80- cd /tmp
81- rm xppaut_latest.tar.gz
82- rm -r xpp
69+ sudo apt-get install -y --no-install-recommends wget make gcc libx11-dev libc6-dev xppaut
8370
8471 - name : Install Singularity # to validate that the Docker image can be converted into a Singularity image
8572 uses : eWaterCycle/setup-singularity@v6
8673
8774 # install package
88- - name : Install the package
89- run : |
90- python -m pip install git+https://github.com/biosimulators/RBApy.git#egg=rbapy
91- python -m pip install .[all]
75+ - name : Set up the environment
76+ uses : ./.github/actions/setup-poetry-env
77+ with :
78+ python-version : ${{ matrix.python-version }}
9279
9380 # zip COMBINE/OMEX archives
9481 - name : Zip COMBINE/OMEX archives
9582 run : |
9683 sudo apt-get update -y
9784 sudo apt-get install -y --no-install-recommends zipcmp
98- python scripts/zip_examples.py
85+ poetry run python scripts/zip_examples.py
9986
10087 - id : commit-archives
10188 name : Commit zipped COMBINE/OMEX archives
@@ -127,25 +114,16 @@ jobs:
127114 branch : ${{ steps.commit-archives.outputs.branch }}
128115
129116 # lint
130- - name : Install flake8
131- run : python -m pip install flake8
132-
133117 - name : Lint the package
134- run : python -m flake8
135-
136- # test and upload coverage report to Codecov
137- - name : Install pytest
138- run : python -m pip install pytest pytest-cov
139-
140- - name : Install the requirements for the tests
141- run : python -m pip install .[tests]
118+ run : poetry run python -m flake8
142119
143120 - name : Run the tests
144- # env:
145- # BIOSIMULATORS_API_ENDPOINT: https://api.biosimulators.dev/ # uncomment to run tests using the dev deployment
146121 uses : GabrielBB/xvfb-action@v1
122+ env :
123+ MPLBACKEND : PDF
124+ # BIOSIMULATORS_API_ENDPOINT: https://api.biosimulators.dev/ # uncomment to execute tests with the dev deployment
147125 with :
148- run : python -m pytest tests/ --cov=./biosimulators_test_suite --cov-report=xml
126+ run : poetry run python -m pytest tests/ --cov=./biosimulators_test_suite --cov-report=xml
149127
150128 - name : Upload the coverage report to Codecov
151129 uses : codecov/codecov-action@v2
@@ -156,92 +134,70 @@ jobs:
156134
157135 # compile documentation
158136 - name : Install the requirements for compiling the documentation
159- run : python -m pip install -r docs-src/requirements.txt
137+ run : poetry install --with docs
160138
161139 - name : Compile the documentation
162140 run : |
163- sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
141+ poetry run sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
164142 mkdir -p docs-src/_static
165- sphinx-build docs-src docs
143+ poetry run sphinx-build docs-src docs
166144
167145 release :
168146 name : Release a new version
169147 needs : [getVersionNumber, build]
170- runs-on : ubuntu-20 .04
148+ runs-on : ubuntu-22 .04
171149 outputs :
172150 docsChanged : ${{ steps.commit-docs.outputs.docsChanged }}
173151 steps :
174152 - name : Checkout code
175- uses : actions/checkout@v2
153+ uses : actions/checkout@v4
176154 with :
177155 fetch-depth : 1
178- ref : deploy
156+ ref : dev
179157
180158 - name : Configure Git
181159 run : |
182160 git config --local user.email "[email protected] " 183161 git config --local user.name "biosimulatorsdaemon"
184162 git config pull.rebase false
185163
186- - name : Install Python
187- uses : actions/setup-python@v2
188- with :
189- python-version : ' 3.9'
190-
191- - name : Setup pip cache
192- uses : actions/cache@v2
164+ - name : Set up the environment
165+ uses : ./.github/actions/setup-poetry-env
193166 with :
194- path : /opt/hostedtoolcache/Python
195- key : ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.optional.txt') }}
196- restore-keys : |
197- ${{ runner.os }}-pip-
198-
199- - name : Install pip and setuptools
200- run : |
201- python -m pip install --upgrade pip
202- python -m pip install --upgrade setuptools
203-
204- # install package
205- - name : Install the package
206- run : |
207- python -m pip install git+https://github.com/biosimulators/RBApy.git#egg=rbapy
208- python -m pip install .[all]
167+ python-version : ${{ matrix.python-version }}
209168
210169 # compile and push documentation
211170 - name : Install the requirements for compiling the documentation
212- run : python -m pip install -r docs-src/requirements.txt
171+ run : poetry install --with docs
213172
214173 - name : Compile the documentation
215174 run : |
216- sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
175+ poetry run sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
217176 mkdir -p docs-src/_static
218- sphinx-build docs-src docs
177+ poetry run sphinx-build docs-src docs
219178
220179 - id : commit-docs
221180 name : Commit the compiled documentation
222181 run : |
223- git stash || true
182+ git stash
224183 git pull
225184 set +e
226- git stash pop || true
185+ git stash pop
227186 git add docs
228- git add docs-src
229- git commit -m "chore: Updating compiled documentation [skip ci]"
230- git checkout .
231- git clean -f -d
187+ git commit -m "chore: Updated compiled documentation [skip ci]"
232188 if [[ $? = 0 ]]; then
233- docsChanged =1
189+ changed =1
234190 else
235- docsChanged =0
191+ changed =0
236192 fi
237- echo "::set-output name=docsChanged::$docsChanged"
193+ echo "changed=$changed" >> $GITHUB_OUTPUT
238194
239195 - name : Push the compiled documentation
240- if : steps.commit-docs.outputs.docsChanged == '1'
196+ if : steps.commit-identifiers-namespaces.outputs.changed == '1' || steps.commit- docs.outputs.changed == '1'
241197 uses : ad-m/github-push-action@master
242198 with :
243199 github_token : ${{ secrets.GITHUB_TOKEN }}
244- branch : deploy
200+ branch : dev
245201
246202 # Create GitHub release
247203 - name : Create GitHub release
@@ -253,33 +209,12 @@ jobs:
253209 release_name : Release ${{ needs.getVersionNumber.outputs.version }}
254210
255211 # Create PyPI release
256- - name : Install pandoc
257- run : |
258- sudo apt-get update -y
259- sudo apt-get install -y --no-install-recommends wget
260-
261- wget https://github.com/jgm/pandoc/releases -O /tmp/pandocVersions.html
262- urlPart=`grep "\.deb" /tmp/pandocVersions.html | head -n 1 | cut -d'/' -f2-7 | cut -d'"' -f1`
263- wget "https://github.com/$urlPart" -O /tmp/pandoc.deb
264- sudo dpkg -i /tmp/pandoc.deb
265- rm /tmp/pandocVersions.html
266- rm /tmp/pandoc.deb
267-
268- - name : Convert README to .rst format
269- run : pandoc --from=gfm --output=README.rst --to=rst README.md
270-
271- - name : Install twine
272- run : |
273- python -m pip install wheel twine
274-
275212 - name : Create packages to upload to PyPI
276213 run : |
277- python setup.py sdist
278- python setup.py bdist_wheel
214+ poetry build
279215
280216 - name : Upload packages to PyPI
281217 env :
282- TWINE_USERNAME : __token__
283- TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
218+ POETRY_PYPI_TOKEN_PYPI : ${{ secrets.PYPI_TOKEN }}
284219 run : |
285- twine upload dist/*
220+ poetry publish --no-interaction --username __token__ --password $POETRY_PYPI_TOKEN_PYPI
0 commit comments