unblocking GH actions #239
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: | |
- master | |
- develop | |
- '**' | |
pull_request: | |
branches: | |
- master | |
- develop | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] #, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Postgres Usage | |
run: | | |
echo "localhost:5432:*:postgres:postgres" >> $HOME/.pgpass | |
chmod 0600 $HOME/.pgpass | |
sudo apt-get install -y postgresql-client | |
psql -c 'create database travis_ci_test_repo_tools;' -U postgres --host localhost | |
psql -c 'create database travis_ci_test_repo_tools_export;' -U postgres --host localhost | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
sudo apt-get install -y libsqlite3-dev | |
pip install pytest-cov | |
pip install psycopg2 | |
python setup.py develop | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
env: | |
GITLAB_API_KEY: ${{ secrets.GITLAB_API_KEY }} | |
REPOTOOLS_GITHUB_API_KEY: ${{ secrets.REPOTOOLS_GITHUB_API_KEY }} | |
run: | | |
pytest --cov=./ | |
- uses: codecov/codecov-action@v3 | |
with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true |