Skip to content

Commit

Permalink
Merge pull request salesforce#185 from kmcquade/refactor/move-from-tr…
Browse files Browse the repository at this point in the history
…avis-to-github-actions

Move from TravisCI to GitHub actions
  • Loading branch information
kmcquade authored May 21, 2020
2 parents dca0fcd + 4dd3758 commit d3f67d1
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 33 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# .github/workflows/publish.yml

name: Publish

on:
release:
types: [published]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies with pipenv
run: |
sleep 2m
pip install pipenv
pipenv install --dev --skip-lock
- run: pipenv run invoke build.install-package
- run: pipenv run invoke test.format
- run: pipenv run invoke test.lint
- run: pipenv run invoke integration.clean
- run: pipenv run invoke integration.version
- run: pipenv run invoke integration.initialize
- run: pipenv run invoke unit.pytest
- run: pipenv run invoke test.security
- run: pipenv run invoke integration.query
- run: pipenv run invoke integration.write-policy
- run: pipenv run invoke build.uninstall-package

publish-package:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv install --dev
- name: create python package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --tags
git pull origin master
pipenv run python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}

update-brew:
needs: publish-package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
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 policy_sentry -U
git fetch origin
git checkout --track origin/master
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest tag: $latest_tag"
git pull origin $latest_tag
pipenv run poet -f policy_sentry > HomebrewFormula/policy_sentry.rb
git add .
git commit -m "update brew formula" policy_sentry/bin/cli.py HomebrewFormula/policy_sentry.rb || echo "No brew changes to commit"
git push -u origin master
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .github/workflows/test.yml

name: Test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies with pipenv
run: |
pip install pipenv
pipenv install --dev --skip-lock
- run: pipenv run invoke build.install-package
- run: pipenv run invoke test.format
- run: pipenv run invoke test.lint
- run: pipenv run invoke integration.clean
- run: pipenv run invoke integration.version
- run: pipenv run invoke integration.initialize
- run: pipenv run invoke unit.pytest
- run: pipenv run invoke test.security
- run: pipenv run invoke integration.query
- run: pipenv run invoke integration.write-policy
- run: pipenv run invoke build.uninstall-package
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

0 comments on commit d3f67d1

Please sign in to comment.