@@ -13,7 +13,36 @@ concurrency:
13
13
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
14
14
cancel-in-progress : true
15
15
jobs :
16
+ deps :
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - name : Check out repository
20
+ uses : actions/checkout@v3
21
+ - name : Install platform dependencies
22
+ run : |
23
+ sudo apt -y update
24
+ sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config libxml2-dev libxslt-dev
25
+ - uses : actions/setup-python@v4
26
+ with :
27
+ python-version-file : ' .python-version'
28
+ - name : pip cache
29
+ uses : actions/cache@v3
30
+ with :
31
+ path : ~/.cache/pip
32
+ key : pip-${{ runner.os }}
33
+ - name : Cache built Python environment
34
+ uses : actions/cache@v3
35
+ with :
36
+ path : ${{ env.pythonLocation }}
37
+ key : ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements/*.txt') }}
38
+ - name : Install Python dependencies
39
+ run : |
40
+ pip install -U setuptools wheel pip
41
+ pip install -r requirements.txt --no-deps
42
+ pip install -r requirements/dev.txt
43
+ pip check
16
44
test :
45
+ needs : deps
17
46
strategy :
18
47
matrix :
19
48
include :
@@ -34,15 +63,15 @@ jobs:
34
63
runs-on : ubuntu-latest
35
64
services :
36
65
postgres :
37
- image : postgres:14.4
66
+ image : ${{ (matrix.name == 'Tests') && ' postgres:14.4' || '' }}
38
67
ports :
39
68
- 5432:5432
40
69
env :
41
70
POSTGRES_HOST_AUTH_METHOD : trust # never do this in production!
42
71
# Set health checks to wait until postgres has started
43
72
options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
44
73
stripe :
45
- image : stripe/stripe-mock:v0.140.0
74
+ image : ${{ (matrix.name == 'Tests') && ' stripe/stripe-mock:v0.140.0' || '' }}
46
75
ports :
47
76
- 12111:12111
48
77
name : ${{ matrix.name }}
@@ -54,27 +83,21 @@ jobs:
54
83
- name : Install platform dependencies
55
84
run : |
56
85
sudo apt -y update
57
- sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
86
+ sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config libxml2-dev libxslt-dev
58
87
- uses : actions/setup-python@v4
59
88
with :
60
89
python-version-file : ' .python-version'
61
- cache : ' pip'
62
- cache-dependency-path : |
63
- requirements.txt
64
- requirements/*.txt
65
- - name : Cache common Python cache paths
90
+ - name : Cache mypy results
91
+ if : ${{ (matrix.name == 'Lint') }}
66
92
uses : actions/cache@v3
67
93
with :
68
94
path : |
69
- .cache
70
- .mypy_cache
71
- ${{ env.pythonLocation }}
95
+ .mypy_cache
96
+ key : ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements/*.txt') }}
97
+ - name : Restore built Python environment from deps
98
+ uses : actions/cache/restore@v3
99
+ with :
100
+ path : ${{ env.pythonLocation }}
72
101
key : ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements/*.txt') }}
73
- - name : Install Python dependencies
74
- run : |
75
- pip install -U pip setuptools wheel
76
- pip install -r requirements.txt --no-deps
77
- pip install -r requirements/dev.txt
78
- pip check
79
102
- name : Run ${{ matrix.name }}
80
103
run : ${{ matrix.command }}
0 commit comments