-
Notifications
You must be signed in to change notification settings - Fork 78
117 lines (113 loc) · 3.9 KB
/
build.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
name: build
on:
push:
branches:
- master
paths-ignore:
- 'coverage.svg'
- 'airiam/version.py'
- 'HomebrewFormula/airiam.rb'
concurrency:
group: 'build'
cancel-in-progress: true
jobs:
coverage:
runs-on: [self-hosted, public, linux, x64]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv install --dev
- name: Test with pytest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pipenv run python -m coverage run -m pytest
pipenv run python -m coverage report
pipenv run python -m coverage html
- name: Update coverage badge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
pipenv run python -m coverage_badge -o coverage.svg -f
git add coverage.svg
git commit -m "Update coverage" coverage.svg || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
bump-version-and-publish:
needs: coverage
runs-on: [self-hosted, public, linux, x64]
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT_TOKEN_2 }}
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv install --dev
- name: update docs and bump version
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN_2 }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --prune --unshallow
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest tag: $latest_tag"
new_tag=$(echo $latest_tag | awk -F. -v a="$1" -v b="$2" -v c="$3" '{printf("%d.%d.%d", $1+a, $2+b , $3+1)}')
echo "new tag: $new_tag"
git pull
## update python version
echo "version = '$new_tag'" > 'airiam/version.py'
git commit -m "bump version" airiam/version.py || echo "No changes to commit"
git push origin
git tag $new_tag
git push origin $new_tag
- name: create python package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --tags
git pull
pipenv run python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
update-brew:
needs: bump-version-and-publish
runs-on: [self-hosted, public, linux, x64]
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT_TOKEN_2 }}
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: publish brew
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
pipenv run pip install homebrew-pypi-poet
pipenv run pip install airiam -U
git pull
pipenv run poet -f airiam > HomebrewFormula/airiam.rb
git commit -m "update brew formula" airiam/version.py HomebrewFormula/airiam.rb || echo "No brew changes to commit"
git push origin