Skip to content

Merge branch 'django-4.2' of 'https://github.com/jjmerchante/grimoire… #983

Merge branch 'django-4.2' of 'https://github.com/jjmerchante/grimoire…

Merge branch 'django-4.2' of 'https://github.com/jjmerchante/grimoire… #983

Workflow file for this run

name: tests
on:
push:
branches:
- '**'
tags:
- '!**'
pull_request:
branches:
- '**'
jobs:
backend:
services:
mysql:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
python-version: [3.8, 3.9]
runs-on: ubuntu-latest
name: Python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # 4.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install -vvv
poetry run pip install -r requirements_dev.txt
- name: Set MySQL mode
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
mysql --host $DB_HOST --port $DB_PORT -uroot -proot -e "SET GLOBAL sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
- name: Lint with flake8
run: |
poetry run flake8
- name: Tests
run: |
poetry run python manage.py test --settings=config.settings.config_testing
poetry run python manage.py test --settings=config.settings.config_testing_tenant
frontend:
strategy:
matrix:
node-version: [18.x, 20.x]
runs-on: ubuntu-latest
name: Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # 4.0.0
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # 4.0.1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
working-directory: ./ui
run: yarn install
- name: Run ESLint
working-directory: ./ui
run: yarn lint
- name: Run unit tests
working-directory: ./ui
run: yarn test:unit
integration:
services:
mysql:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
node-version: [18.x, 20.x]
python-version: [3.8, 3.9]
runs-on: ubuntu-latest
name: Node ${{ matrix.node-version }} Python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # 4.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install -vvv
poetry run pip install -r requirements_dev.txt
- name: Set MySQL mode
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
mysql --host $DB_HOST --port $DB_PORT -uroot -proot -e "SET GLOBAL sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # 4.0.1
with:
node-version: ${{ matrix.node-version }}
- name: Build UI packages
working-directory: ./ui
run: |
yarn install
yarn build --mode development
- name: Setup database, static files and run service
env:
SORTINGHAT_SECRET_KEY: my-secret-key
SORTINGHAT_DB_PASSWORD: root
SORTINGHAT_SUPERUSER_USERNAME: root
SORTINGHAT_SUPERUSER_PASSWORD: root
run: |
poetry run sortinghat-admin --config sortinghat.config.settings setup
- name: Start server in the background
run: poetry run sortinghatd --config sortinghat.config.settings --dev &
env:
SORTINGHAT_SECRET_KEY: my-secret-key
SORTINGHAT_DB_PASSWORD: root
UWSGI_HTTP: "http://localhost:8000"
- name: Run integration tests
uses: cypress-io/github-action@1b70233146622b69e789ccdd4f9452adc638d25a # 6.6.1
with:
install: false
command: yarn test:e2e --config baseUrl=http://localhost:8000
wait-on: 'http://localhost:8000/api/'
spec: tests/e2e/specs/*.js
working-directory: ./ui
env:
CYPRESS_USERNAME: root
CYPRESS_PASSWORD: root
CYPRESS_API_URL: http://localhost:8000/api/