Initialize the database automatically when starting mquery #1143
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: "Code testing" | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
expression_blacklist: | |
name: expression blacklist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: git fetch origin master | |
- name: No "console.log" please | |
run: git diff origin/master -- "*.js" | grep "^[+][^+]" | grep -v "noqa" | grep "console.log" || exit 0 && exit 1 | |
test_python_types: | |
name: python mypy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.10' | |
- name: install mypy==1.2.0 | |
run: pip3 install mypy==1.2.0 | |
- name: install requirements | |
run: pip3 install -r requirements.txt | |
- name: run mypy on main files | |
run: mypy src/app.py src/daemon.py | |
- name: run mypy on tests | |
run: MYPYPATH=src/ mypy src/tests/ | |
- name: run mypy on utils | |
run: MYPYPATH=src/ mypy src/utils/ | |
test_python_style: | |
name: python flake8 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.10' | |
- name: install flake8==6.0.0 | |
run: pip3 install flake8==6.0.0 | |
- name: run flake8 | |
run: flake8 src | |
test_python_lint: | |
name: python black | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.10' | |
- name: install black | |
run: pip3 install black==22.3.0 | |
- name: run black | |
run: black --check "src" | |
test_js_style: | |
name: js prettier | |
runs-on: ubuntu-latest | |
env: | |
working-directory: src/mqueryfront | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup nodejs | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: install prettier | |
run: npm install -g [email protected] | |
- name: run prettier | |
run: prettier --tab-width=4 --check "src/**/*.js" | |
test_js_build: | |
name: npm build | |
runs-on: ubuntu-latest | |
env: | |
working-directory: src/mqueryfront | |
steps: | |
- name: Setup nodejs | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: install dependencies | |
run: npm install | |
- name: build | |
run: npm build | |
test_unit: | |
name: unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: build test image | |
run: docker build -t mquery_tests:latest -f src/tests/Dockerfile . | |
- name: run unit tests | |
run: docker run mquery_tests | |
test_e2e: | |
name: e2e tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: build test image | |
run: docker build -t mquery_tests:latest -f src/e2etests/Dockerfile . | |
- name: run web with docker compose | |
run: docker compose up --build -d web --wait | |
- name: init the database | |
run: docker compose exec -it -w /usr/src/app/src/ web alembic upgrade head | |
- name: run the rest of the code | |
run: docker compose up -d | |
- name: run e2e tests | |
run: docker run --net mquery_default -v $(readlink -f ./samples):/mnt/samples mquery_tests | |
- name: get run logs | |
if: always() | |
run: docker compose logs | |
- name: stop docker compose | |
if: always() | |
run: docker compose down |