Skip to content

Commit f9f4828

Browse files
authored
Create run_pytest.yml
1 parent b5a4ade commit f9f4828

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/run_pytest.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: pytests in Docker-compose Actions Workflow
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
12+
test:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Build the Docker images
20+
run: docker compose build
21+
22+
- name: Create .env file
23+
run: |
24+
echo "STEMWEB_REDIS=redis://redis:6379" >> .env
25+
echo "STEMWEB_DBENGINE=mysql" >> .env
26+
echo "STEMWEB_DBNAME=stemwebdb_v1" >> .env
27+
echo "STEMWEB_DBUSER=stemweb" >> .env
28+
echo "STEMWEB_DBPASSW=ChangeIt" >> .env
29+
echo "STEMWEB_DBHOST=mysql" >> .env
30+
echo "STEMWEB_DBPORT=3306" >> .env
31+
echo "STEMWEB_SECRET_KEY=someth1ngNotTr1via!" >> .env
32+
echo "CALC_HARD_TIMEOUT=120" >> .env
33+
echo "CALC_SOFT_TIMEOUT=60" >> .env
34+
35+
- name: Start the Docker containers
36+
run: docker compose --profile testing up -d
37+
38+
- name: Wait for app to start
39+
run: |
40+
for i in {1..40}; do
41+
curl -s idp:8000 && break
42+
echo "Waiting..."
43+
sleep 1
44+
done
45+
46+
- name: Test with pytest executed within testing client container
47+
run: docker exec stemweb-client-1 pytest -v test_stemweb.py

0 commit comments

Comments
 (0)