Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from code-specialist/multiple-python-versions
Browse files Browse the repository at this point in the history
Test Multiple Python Versions
  • Loading branch information
JonasScholl authored May 3, 2022
2 parents 8aaa4c1 + 15309ba commit e33be07
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 24 deletions.
62 changes: 38 additions & 24 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,47 @@ on:
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
name: Test-Suite for Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- name: "Set up Python 3.8"

- name: Start Test Infrastructure
run: |
cd tests
bash ./start_infra.sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8

# - name: Install Pip
# run: |
# python -m pip install --upgrade pip
#
# - name: "Install Test Dependencies"
# run: |
# python -m pip install wheel
# python -m pip install pytest
# python -m pip install pytest-cov
#
# - name: "Install dependencies"
# run: |
# python -m pip install -r requirements.txt
#
# - name: Test with pytest
# run: |
# pytest tests

- name: "Upload coverage to Codecov"
python-version: ${{ matrix.python-version }}

- name: Install Pip
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
python -m pip install pytest pytest-cov
python -m pip install -r requirements.txt
- name: Wait for Infrastructure to be ready
run: |
chmod +x tests/wait_for_service.sh & bash tests/wait_for_service.sh http://localhost:8085 200 60
- name: Test with pytest
run: |
pytest tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
fail_ci_if_error: true

- name: Teardown Test Infrastructure
if: always()
run: |
cd tests
bash ./stop_infra.sh
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# FastAPI Keycloak Integration

[![Test-Suite](https://github.com/code-specialist/fastapi-keycloak/actions/workflows/testing.yaml/badge.svg)](https://github.com/code-specialist/fastapi-keycloak/actions/workflows/testing.yaml)
[![CodeFactor](https://www.codefactor.io/repository/github/code-specialist/fastapi-keycloak/badge)](https://www.codefactor.io/repository/github/code-specialist/fastapi-keycloak)
[![codecov](https://codecov.io/gh/code-specialist/fastapi-keycloak/branch/master/graph/badge.svg?token=PX6NJBDUJ9)](https://codecov.io/gh/code-specialist/fastapi-keycloak)
![Py3.8](https://img.shields.io/badge/-Python%203.8-brightgreen)
![Py3.9](https://img.shields.io/badge/-Python%203.9-brightgreen)
![Py3.10](https://img.shields.io/badge/-Python%203.10-brightgreen)

---


Expand Down
Empty file modified tests/build_keycloak_m1.sh
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions tests/wait_for_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -eux

declare URL=$1
declare STATUS=$2
declare TIMEOUT=$3

URL=$URL STATUS=$STATUS timeout --foreground -s TERM $TIMEOUT bash -c \
'while [[ ${STATUS_RECEIVED} != ${STATUS} ]];\
do STATUS_RECEIVED=$(curl -s -o /dev/null -L -w ''%{http_code}'' ${URL}) && \
echo "received status: $STATUS_RECEIVED" && \
sleep 1;\
done;
echo success with status: $STATUS_RECEIVED'

0 comments on commit e33be07

Please sign in to comment.