Initial commit #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python-ci.yml | |
name: Test API on Push | |
on: | |
push: | |
branches: [ master, main ] | |
pull_request: | |
branches: [ master, main ] | |
jobs: | |
build-and-run-pytest: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Checkout to the branch that triggered the event | |
- uses: actions/checkout@v3 | |
# 2. Install python 3.10 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
# 3. Install python packages using a requirements file | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip cython wheel | |
pip install -r requirements.txt | |
# 4. Build test image | |
- name: Build test Docker image | |
run: docker build -f tests/Dockerfile.test -t api-test . | |
# 5. Run test container | |
- name: Run testing Container | |
run: docker run -d -e PORT=8000 --name api-test-container -p 8080:8000 api-test | |
# 6. Run tests | |
- name: Run tests on API | |
run: make | |
# Last step: Stop and remove container | |
- name: Stop API Container | |
run: docker stop api-test-container && docker rm api-test-container |