CNIL : guide sécurité des données #2235
Workflow file for this run
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
name: API Tests | |
on: | |
pull_request: | |
branches: [main, develop] | |
types: [opened, synchronize] | |
paths: | |
- "backend/**" | |
- ".github/workflows/backend-api-tests.yml" | |
workflow_dispatch: | |
env: | |
GITHUB_WORKFLOW: github_actions | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
backend-directory: ./backend | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: false | |
installer-parallel: true | |
- name: Install backend requirements | |
working-directory: ${{ env.backend-directory }} | |
run: poetry install | |
- name: Create environment variables file | |
working-directory: ${{env.backend-directory}} | |
run: | | |
touch .env | |
echo DJANGO_DEBUG='True' >> .env | |
echo DB_HOST=localhost >> .env | |
echo EMAIL_HOST=localhost >> .env | |
echo EMAIL_PORT=1025 >> .env | |
echo EMAIL_HOST_USER='' >> .env | |
echo EMAIL_HOST_PASSWORD='' >> .env | |
#echo EMAIL_USE_TLS=False >> .env | |
echo DEFAULT_FROM_EMAIL='[email protected]' >> .env | |
echo CISO_ASSISTANT_SUPERUSER_EMAIL='' >> .env | |
echo CISO_ASSISTANT_URL=http://127.0.0.1:5173 >> .env | |
- name: Run migrations | |
working-directory: ${{env.backend-directory}} | |
run: | | |
export $(grep -v '^#' .env | xargs) | |
poetry run python manage.py migrate | |
- name: Run API tests | |
working-directory: ${{env.backend-directory}} | |
run: | | |
export $(grep -v '^#' .env | xargs) | |
poetry run pytest app_tests/api --html=pytest-report.html --self-contained-html | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: api-tests-report | |
path: ${{ env.backend-directory }}/pytest-report.html | |
retention-days: 5 |