-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (57 loc) · 2.05 KB
/
cicd.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
---
name: Linux Build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
continuous-integration-deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
architecture: 'x64'
- name: Install Python support libs
run: |
pip install --upgrade pip pipenv-to-requirements twine setuptools wheel
pipenv_to_requirements
pip install -r requirements-dev.txt
- name: Run tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
pytest --cov=curitiba_dados_abertos --cov-report=xml --cov-fail-under=68 -s
bash <(curl -s https://codecov.io/bash)
- name: Prepare Package
if: github.event_name == 'push'
run: |
python setup.py sdist bdist_wheel
- name: Verify if package was already deployed
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
python -c "import pkg_resources; print(pkg_resources.require('curitiba-dados-abertos')[0].version)" > VERSION
cat VERSION
curl https://pypi.org/pypi/curitiba-dados-abertos/json 2> /dev/null | python3 -c "import sys, json; versions = json.load(sys.stdin)['releases'].keys(); print(' ' + ' '.join(versions) + ' ')" | grep -v " $(cat VERSION) "
- name: Tagging version
if: success()
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag $(cat VERSION)
- name: Publish Package on PyPI
if: success() && github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Push Tags
if: success() && github.event_name == 'push'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MY_GH_TOKEN }}