Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create permanent publicly available mock server #14

Merged
merged 2 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/heroku-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: Deploy mocks on Heroku
on: # yamllint disable-line rule:truthy
# Deploy the mocks on Heroku on every push to master branch
push:
branches:
- master

env:
HEROKU_APP_NAME: pets-consumer-contract-mock

jobs:
tests:
name: Deploy mocks on Heroku
runs-on: ubuntu-20.04
steps:

- name: Checkout code
uses: actions/[email protected]

- name: Install Gauge
uses: getgauge/setup-gauge@master
with:
gauge-plugins: python, html-report

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Create Heroku mock app
env:
# Needs `HEROKU_API_KEY` to have been set as a GitHub Actions secret:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
heroku create $HEROKU_APP_NAME \
--region eu \
--buildpack https://github.com/agilepathway/heroku-buildpack-prism.git \
|| true
# Papertrail is a useful Heroku logging add-on: https://devcenter.heroku.com/articles/papertrail
heroku addons:create papertrail --app $HEROKU_APP_NAME || true

- name: Deploy Heroku mock
uses: tiagogouvea/github-dpl-action@master
with:
provider: heroku
app: ${{ env.HEROKU_APP_NAME }}
api-key: ${{ secrets.HEROKU_API_KEY }}

- name: Run Gauge specs against Heroku mock server
env:
# Python env var is temporary workaround for https://github.com/getgauge/gauge-python/issues/256
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
OPENAPI_HOST: https://${{ env.HEROKU_APP_NAME }}.herokuapp.com
run: gauge run specs

- name: Upload Gauge test report
uses: actions/upload-artifact@v2
with:
name: gauge-html-report
path: reports/html-report/
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: prism mock openapi.yaml --errors -h 0.0.0.0 -p $PORT