Skip to content

Instantly share code, notes, and snippets.

@ttamg
Last active January 31, 2021 10:21
Show Gist options
  • Save ttamg/a5b6648dd10a079f210fbb13dac5937f to your computer and use it in GitHub Desktop.
Save ttamg/a5b6648dd10a079f210fbb13dac5937f to your computer and use it in GitHub Desktop.
Github Action - Build and Pytest Python 3.8
# Github Action to build Python package and run tests with Pytest
# Runs on creation of pull request into main branch
name: Tests
on:
pull_request:
branches:
- main
jobs:
build-test:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: checkout source code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install pytest requests
- name: Test with pytest - should have created pyc files
run: pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment