Skip to content

Instantly share code, notes, and snippets.

@jorlugaqui
Created August 8, 2020 19:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorlugaqui/05332987b2f59c1d81c530e292150560 to your computer and use it in GitHub Desktop.
Save jorlugaqui/05332987b2f59c1d81c530e292150560 to your computer and use it in GitHub Desktop.
Github CI Workflow for integration tests
name: CI - Integration Test
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
mongodb-version: [4.2]
python-version: [3.7]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Install Node JS ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Start MongoDB ${{ matrix.mongodb-version }}
uses: supercharge/mongodb-github-action@1.3.0
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
if [ -f api/requirements.txt ]; then pip install -r api/requirements.txt; fi
- name: Install Newman dependency
run: npm install --prefix tests/postman/
- name: Run the API and Postman's tests
run: |
cd api && flask run &
sleep 2
cd tests/postman/ && ./node_modules/newman/bin/newman.js run ahm_api_calls.postman_collection.json -e ahm-local.postman_environment.json
kill -9 `lsof -i:5000 -t`
env:
FLASK_ENV: development
API_HOST: 0.0.0.0
FLASK_APP: main.py
DB_NAME: ahm
DB_HOST: localhost
CI: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment