Update pr-build.yml
[mygpo.git] / .github / workflows / pr-build.yml
bloba5b63207d8066e855c0c373ba34c776c43420eed
1 name: Pull Request Build
3 on: [pull_request, workflow_dispatch]
5 jobs:
6   build: 
8     runs-on: ubuntu-20.04
9     strategy:
10       matrix:
11         python-version: [3.8]
12     env:
13       POSTGRES_DB: mygpo_test
14       POSTGRES_PASSWORD: runner
15       POSTGRES_USER: runner
16       POSTGRES_PORT: 5432
18     steps:
19     - uses: actions/checkout@v2
20       
21     - name: Setup Python ${{ matrix.python-version }}
22       uses: actions/setup-python@v2
23       with: 
24         python-version: ${{ matrix.python-version }}
25       
26     - name: Install dependencies
27       run: |
28         sudo apt-get update -q
29         make install-deps
30         python -m pip install --upgrade pip
31         pip install coveralls
32         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33         if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
34     - name: Setup PostgreSQL
35       run: |
36         sudo sed -i -e '/local.*peer/s/runner/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
37         sudo service postgresql restart
38         sleep 1
39         sudo -u postgres psql -c "CREATE USER runner WITH PASSWORD 'runner';"
40         sudo -u postgres psql -c "CREATE DATABASE mygpo_test OWNER runner;"
41       
42     - name: Check Format and Coverage
43       run: |
44         make check-code-format
45         python -m pytest --cov=mygpo/ --cov-branch
46         python -m coveralls