Skip to content

Commit e1cbc47

Browse files
committed
CI: use github actions
1 parent 952ea3a commit e1cbc47

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "develop"
8+
tags:
9+
- "*"
10+
pull_request:
11+
branches:
12+
- "develop"
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
env:
17+
# needed by coveralls
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
jobs:
21+
build_sdist:
22+
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest, windows-latest, macos-latest]
28+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
with:
33+
fetch-depth: '0'
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions\setup-python@v2
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install -r requirements_setup.txt
44+
pip install -r requirements.txt
45+
pip install -r requirements_test.txt
46+
pip install coveralls>=3.0.0
47+
48+
- name: Build sdist
49+
run: |
50+
python setup.py sdist --formats=gztar bdist_wheel -d dist
51+
52+
- name: Run tests
53+
run: |
54+
python -m pytest --cov welltestpy --cov-report term-missing -v tests/
55+
python -m coveralls --service=github
56+
57+
- uses: actions/upload-artifact@v2
58+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
59+
with:
60+
path: dist
61+
62+
upload_to_pypi:
63+
needs: [build_sdist]
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- uses: actions/download-artifact@v2
68+
with:
69+
name: artifact
70+
path: dist
71+
72+
- name: Publish to Test PyPI
73+
# only if working on develop
74+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
75+
uses: pypa/gh-action-pypi-publish@master
76+
with:
77+
user: __token__
78+
password: ${{ secrets.test_pypi_password }}
79+
repository_url: https://test.pypi.org/legacy/
80+
skip_existing: true
81+
82+
- name: Publish to PyPI
83+
# only if tagged
84+
if: startsWith(github.ref, 'refs/tags')
85+
uses: pypa/gh-action-pypi-publish@master
86+
with:
87+
user: __token__
88+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)