1
+ name : arturo-stac-api
2
+ on :
3
+ push :
4
+ branches : [ master ]
5
+ pull_request :
6
+ branches : [ master ]
7
+
8
+ jobs :
9
+ test :
10
+ runs-on : ubuntu-latest
11
+ timeout-minutes : 10
12
+
13
+ services :
14
+ db_service :
15
+ image : kartoza/postgis:latest
16
+ env :
17
+ POSTGRES_USER : username
18
+ POSTGRES_PASS : password
19
+ POSTGRES_DBNAME : postgis
20
+ POSTGRES_HOST : localhost
21
+ POSTGRES_PORT : 5432
22
+ ALLOW_IP_RANGE : 0.0.0.0/0
23
+ # Set health checks to wait until postgres has started
24
+ options : >-
25
+ --health-cmd pg_isready
26
+ --health-interval 10s
27
+ --health-timeout 5s
28
+ --health-retries 5
29
+ ports :
30
+ # Maps tcp port 5432 on service container to the host
31
+ - 5432:5432
32
+
33
+ steps :
34
+ - name : Check out repository code
35
+ uses : actions/checkout@v2
36
+
37
+ # Setup Python (faster than using Python container)
38
+ - name : Setup Python
39
+ uses : actions/setup-python@v2
40
+ with :
41
+ python-version : " 3.8"
42
+
43
+ - name : Install pipenv
44
+ run : |
45
+ python -m pip install --upgrade pipenv wheel
46
+
47
+ - id : cache-pipenv
48
+ uses : actions/cache@v1
49
+ with :
50
+ path : ~/.local/share/virtualenvs
51
+ key : ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
52
+
53
+ - name : Install dependencies
54
+ if : steps.cache-pipenv.outputs.cache-hit != 'true'
55
+ run : |
56
+ pipenv install --deploy --dev
57
+
58
+ - name : Run migration
59
+ run : |
60
+ pipenv run alembic upgrade head
61
+ env :
62
+ POSTGRES_USER : username
63
+ POSTGRES_PASS : password
64
+ POSTGRES_DBNAME : postgis
65
+ POSTGRES_HOST : localhost
66
+ POSTGRES_PORT : 5432
67
+
68
+ - name : Run test suite
69
+ run : |
70
+ pipenv run pytest -svvv
71
+ env :
72
+ ENVIRONMENT : testing
73
+ POSTGRES_USER : username
74
+ POSTGRES_PASS : password
75
+ POSTGRES_DBNAME : postgis
76
+ POSTGRES_HOST_READER : localhost
77
+ POSTGRES_HOST_WRITER : localhost
78
+ POSTGRES_PORT : 5432
0 commit comments