Format with black #620
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python application | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Create .env file | |
# Remove comments and empty lines; $GITHUB_ENV is strict | |
run: | | |
sed -E '/^(#|$)/d' .env.sample > $GITHUB_ENV | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f poetry.lock ]; then | |
pip install poetry && poetry install | |
elif [ -f requirements.txt ]; then | |
pip install -r requirements.txt | |
[ -f test-requirements.txt ] && pip install -r test-requirements.txt | |
fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Django migrations | |
run: | | |
poetry run python manage.py migrate | |
- name: Django tests | |
env: | |
CHAMELEON_KEYCLOAK_TROVI_ADMIN_CLIENT_SECRET: ${{ secrets.CHAMELEON_KEYCLOAK_TROVI_ADMIN_CLIENT_SECRET }} | |
CHAMELEON_KEYCLOAK_TEST_USER_USERNAME: ${{ secrets.CHAMELEON_KEYCLOAK_TEST_USER_USERNAME }} | |
CHAMELEON_KEYCLOAK_TEST_USER_PASSWORD: ${{ secrets.CHAMELEON_KEYCLOAK_TEST_USER_PASSWORD }} | |
CHAMELEON_KEYCLOAK_TEST_CLIENT_SECRET: ${{ secrets.CHAMELEON_KEYCLOAK_TEST_CLIENT_SECRET }} | |
CHAMELEON_KEYSTONE_ENDPOINT: ${{ secrets.CHAMELEON_KEYSTONE_ENDPOINT }} | |
CHAMELEON_SWIFT_ACCOUNT: ${{ secrets.CHAMELEON_SWIFT_ACCOUNT }} | |
CHAMELEON_SWIFT_PASSWORD: ${{ secrets.CHAMELEON_SWIFT_PASSWORD }} | |
CHAMELEON_SWIFT_PROJECT_NAME: ${{ secrets.CHAMELEON_SWIFT_PROJECT_NAME }} | |
CHAMELEON_SWIFT_TEMP_URL_KEY: ${{ secrets.CHAMELEON_SWIFT_TEMP_URL_KEY }} | |
TROVI_ADMIN_USERS: ${{ secrets.TROVI_ADMIN_USERS }} | |
run: | | |
poetry run python manage.py test |