-
Notifications
You must be signed in to change notification settings - Fork 43
45 lines (35 loc) · 1.1 KB
/
python-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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 tests/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