Skip to content

Commit d3f67d1

Browse files
authored
Merge pull request #185 from kmcquade/refactor/move-from-travis-to-github-actions
Move from TravisCI to GitHub actions
2 parents dca0fcd + 4dd3758 commit d3f67d1

File tree

3 files changed

+120
-33
lines changed

3 files changed

+120
-33
lines changed

.github/workflows/publish.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# .github/workflows/publish.yml
2+
3+
name: Publish
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Setup Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.7
19+
20+
- name: Install dependencies with pipenv
21+
run: |
22+
sleep 2m
23+
pip install pipenv
24+
pipenv install --dev --skip-lock
25+
26+
- run: pipenv run invoke build.install-package
27+
- run: pipenv run invoke test.format
28+
- run: pipenv run invoke test.lint
29+
- run: pipenv run invoke integration.clean
30+
- run: pipenv run invoke integration.version
31+
- run: pipenv run invoke integration.initialize
32+
- run: pipenv run invoke unit.pytest
33+
- run: pipenv run invoke test.security
34+
- run: pipenv run invoke integration.query
35+
- run: pipenv run invoke integration.write-policy
36+
- run: pipenv run invoke build.uninstall-package
37+
38+
publish-package:
39+
needs: test
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@master
43+
- name: Set up Python 3.7
44+
uses: actions/setup-python@v1
45+
with:
46+
python-version: 3.7
47+
- uses: dschep/install-pipenv-action@v1
48+
- name: Install dependencies
49+
run: |
50+
pipenv install --dev
51+
- name: create python package
52+
run: |
53+
git config --local user.email "action@github.com"
54+
git config --local user.name "GitHub Action"
55+
git fetch --tags
56+
git pull origin master
57+
pipenv run python setup.py sdist bdist_wheel
58+
- name: Publish package
59+
uses: pypa/gh-action-pypi-publish@master
60+
with:
61+
user: __token__
62+
password: ${{ secrets.PYPI_PASSWORD }}
63+
64+
update-brew:
65+
needs: publish-package
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@master
69+
- name: Set up Python 3.7
70+
uses: actions/setup-python@v1
71+
with:
72+
python-version: 3.7
73+
- uses: dschep/install-pipenv-action@v1
74+
- name: publish brew
75+
run: |
76+
git config --local user.email "action@github.com"
77+
git config --local user.name "GitHub Action"
78+
pipenv run pip install homebrew-pypi-poet
79+
pipenv run pip install policy_sentry -U
80+
git fetch origin
81+
git checkout --track origin/master
82+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
83+
echo "latest tag: $latest_tag"
84+
git pull origin $latest_tag
85+
pipenv run poet -f policy_sentry > HomebrewFormula/policy_sentry.rb
86+
git add .
87+
git commit -m "update brew formula" policy_sentry/bin/cli.py HomebrewFormula/policy_sentry.rb || echo "No brew changes to commit"
88+
git push -u origin master

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .github/workflows/test.yml
2+
3+
name: Test
4+
5+
on: [push, pull_request]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Setup Python
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.7
17+
18+
- name: Install dependencies with pipenv
19+
run: |
20+
pip install pipenv
21+
pipenv install --dev --skip-lock
22+
- run: pipenv run invoke build.install-package
23+
- run: pipenv run invoke test.format
24+
- run: pipenv run invoke test.lint
25+
- run: pipenv run invoke integration.clean
26+
- run: pipenv run invoke integration.version
27+
- run: pipenv run invoke integration.initialize
28+
- run: pipenv run invoke unit.pytest
29+
- run: pipenv run invoke test.security
30+
- run: pipenv run invoke integration.query
31+
- run: pipenv run invoke integration.write-policy
32+
- run: pipenv run invoke build.uninstall-package

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)