diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 0000000000..abd44f1a7c --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,45 @@ +name: Python application + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + pyversion: ['3.5','3.8'] + services: + postgres: + image: postgres:10.8 + env: + POSTGRES_USER: decide + POSTGRES_PASSWORD: decide + POSTGRES_DB: decide + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{matrix.pyversion}} + uses: actions/setup-python@v1 + with: + python-version: ${{matrix.pyversion}} + - name: psycopg2 prerequisites + run: sudo apt-get install libpq-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install codacy-coverage + - name: Run migrations + run: cd decide;python manage.py migrate + - name: Run tests + run: cd decide;coverage run --branch --source=. ./manage.py test census --keepdb; coverage xml; + - name: Codacy Coverage Reporter + uses: codacy/codacy-coverage-reporter-action@v1.1.0 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: decide/coverage.xml \ No newline at end of file