Skip to content

1363 implement singlesignon via comunity aai #2384

1363 implement singlesignon via comunity aai

1363 implement singlesignon via comunity aai #2384

name: Automated Test
# We run this automated testing job on every commit on master and develop and for every pull request.
on:
push:
branches:
- master
- develop
pull_request:
jobs:
run-tests:
runs-on: ubuntu-20.04
env:
# LD_PRELOAD: /lib/x86_64-linux-gnu/libSegFault.so
# SEGFAULT_SIGNALS: all
OEP_DJANGO_USER: "postgres"
OEP_DB_PW: "postgres"
LOCAL_DB_USER: "postgres"
LOCAL_DB_PASSWORD: "postgres"
TOXENV: py3
permissions:
contents: read
# We create a service container with a provisioned postgres. oeplatform will use this database for its tests.
services:
postgres:
# We use our own prepared postgres image for this.
image: ghcr.io/openenergyplatform/oeplatform-postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# We open up port 5432 to be able to use `localhost:5432` to connect to the database.
# We also could omit this and use `postgres:5432` to connect to the database after modifying security settings.
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
fuseki:
image: stain/jena-fuseki
ports:
- 3030:3030
options: >-
--name fuseki
-e FUSEKI_DATASET_1=ds
-e FUSEKI_MEM_1=true
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install linux dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y postgresql-client
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Wait for Fuseki to start
run: |
for i in {1..30}; do
if nc -z localhost 3030; then
echo "Fuseki is up!"
break
fi
echo "Waiting for Fuseki..."
sleep 2
done
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install python dependencies
run: |
python -m pip install --upgrade pip 'setuptools<72.0.0' wheel
pip install -r requirements.txt
pip install tox-uv
- name: Add schemas for testing
env:
PGPASSWORD: postgres
run: |
psql -h localhost -p 5432 -U postgres -c "CREATE SCHEMA IF NOT EXISTS sandbox" oedb
psql -h localhost -p 5432 -U postgres -c "CREATE SCHEMA IF NOT EXISTS _sandbox" oedb
- name: oeo & oeo-ext integration
run: |
mkdir -p ontologies/oeo/1/
mkdir -p ontologies/oeo/1/imports
mkdir -p ontologies/oeo/1/modules
wget https://openenergyplatform.org/ontology/oeo/releases/oeo-full.owl -P ontologies/oeo/1/
mkdir -p media/oeo_ext/
cp oeo_ext/oeo_extended_store/oeox_template/oeo_ext_template_empty.owl media/oeo_ext/oeo_ext.owl
- name: Collectstatic files & compress
run: |
cp oeplatform/securitysettings.py.default oeplatform/securitysettings.py
python manage.py collectstatic
python manage.py compress
- name: Migrations & User creation
run: |
python manage.py makemigrations --check
python manage.py migrate
python manage.py alembic upgrade head
python manage.py shell -c "from login.models import myuser; u=myuser.objects.create_user(name='test',email='[email protected]',affiliation='');u.is_mail_verified=True;u.save()"
- name: Create API token
run: |
echo LOCAL_OEP_TOKEN=`python manage.py shell -c "from login.models import Token; print(Token.objects.filter(user__name='test').first().key)"` >> $GITHUB_ENV
- name: Start OEP
run: python manage.py runserver 8000 &
#- name: Run tests without tox
# run: python manage.py test --no-input
- name: Run tests with tox
run: tox -v