1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name : Coverage
4
+
5
+ # Controls when the workflow will run
6
+ on :
7
+ push :
8
+ branches : [ "main", "develop" ]
9
+ pull_request :
10
+ branches : [ "main", "develop" ]
11
+ # Allows you to run this workflow manually from the Actions tab
12
+ workflow_dispatch :
13
+
14
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
15
+ jobs :
16
+ Coverage :
17
+ runs-on : ubuntu-latest
18
+ strategy :
19
+ matrix :
20
+ python-version : [ '3.10' ]
21
+ services :
22
+ postgres :
23
+ image : postgres:11
24
+ env :
25
+ POSTGRES_USER : postgres
26
+ POSTGRES_PASSWORD : postgres
27
+ POSTGRES_DB : ci_db_test
28
+ ports :
29
+ - 5432:5432
30
+ options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
31
+
32
+ steps :
33
+ - uses : actions/checkout@master
34
+
35
+ - name : Set github token
36
+ run : echo "GITHUB_TOKEN=${{ secrets.GIT_TOKEN }}" >> $GITHUB_ENV
37
+ - name : Set coveralls token
38
+ run : echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
39
+ - name : Enable Postgres Trigram Extension
40
+ run : |
41
+ PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
42
+ - name : pip install, make coverage
43
+ env :
44
+ TEST_DATABASE_URL : postgresql://postgres:postgres@localhost/ci_db_test
45
+ TEST_DATABASE_ASYNC_URL : postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
46
+ run : |
47
+ python -m pip install --upgrade pip
48
+ pip install -r requirements.txt
49
+ pip install coverage
50
+ pip install coveralls
51
+ python -m coverage run -m unittest
52
+ coveralls
0 commit comments