Merge pull request #106 from sanger/develop #311
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: CI | |
on: | |
push: | |
branches: | |
- develop-* | |
- develop | |
- main | |
pull_request: | |
branches: | |
- develop-* | |
- develop | |
- main | |
env: | |
SETTINGS_MODULE: janitor.config.test | |
jobs: | |
black: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install pipenv | |
run: | | |
pip install pipenv | |
- name: Install dependencies | |
run: | | |
pipenv sync --dev --system | |
- name: Check format with black | |
run: | | |
# stop the build if there are black formatting errors | |
python -m black --check . | |
flake8: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install pipenv | |
run: | | |
pip install pipenv | |
- name: Install dependencies | |
run: | | |
pipenv sync --dev --system | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 | |
mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install pipenv | |
run: | | |
pip install pipenv | |
- name: Install dependencies | |
run: | | |
pipenv sync --dev --system | |
- name: Run mypy | |
run: | | |
python -m mypy . | |
test: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install pipenv | |
run: | | |
pip install pipenv | |
- name: Install dependencies | |
run: | | |
pipenv sync --dev --system | |
- name: Set up MySQL databases | |
run: | | |
mysql -e 'CREATE DATABASE janitor_tests_lw;' -uroot -h '127.0.0.1' | |
mysql -e 'CREATE DATABASE janitor_tests_mlwh;' -uroot -h '127.0.0.1' | |
mysql -e 'CREATE DATABASE janitor_tests_mlwh_events;' -uroot -h '127.0.0.1' | |
- name: Test with pytest | |
run: | | |
python -m pytest -vx | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |