-
Notifications
You must be signed in to change notification settings - Fork 35
111 lines (94 loc) · 3.87 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
name: Tests
on:
pull_request:
paths:
- '**'
- '!docs/**'
- '!*.rst'
- '!*.md'
- '!datacube_ows/__init__.py'
push:
branches:
- 'master'
paths:
- '**'
- '!docs/**'
- '!*.rst'
- '!*.md'
- '!datacube_ows/__init__.py'
env:
ORG: opendatacube
IMAGE: ows
DB_USERNAME: opendatacubeusername
jobs:
unit-integration-performance-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# We build the stage 1 image, then run test on it
# These tests require extra files we don't want in
# the production image
# We build the stage 1 image, then run test on it
# These tests require extra files we don't want in
# the production image
- name: Build dev OWS image (stage 1 - unit test builder)
run: |
docker build \
--target env_builder \
--tag ${ORG}/${IMAGE}:_builder \
.
- name: Test and lint dev OWS image (stage 1 - unit test)
run: |
mkdir artifacts
docker run -v ${PWD}/artifacts:/mnt/artifacts ${ORG}/${IMAGE}:_builder /bin/sh -c "./check-code.sh"
mv ./artifacts/coverage.xml ./artifacts/coverage-unit.xml
- name: Dockerized Integration Pytest (stage 1 - integration test)
run: |
chmod a+rw artifacts
export $(grep -v '^#' .env_simple | xargs)
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml up -d
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows /bin/sh -c "cd /code;./check-code-all.sh"
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml down
- name: Upload All coverage to Codecov (stage 1 - upload coverage result)
uses: codecov/codecov-action@v1
with:
file: ./artifacts/*.xml
fail_ci_if_error: false
# Run performance profiling
- name: setup performance profiling with py-spy (stage 1 - run profiling containers)
run: |
export $(grep -v '^#' .env_simple | xargs)
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml up -d
- name: Sleep for 10 seconds (stage 1 - wait for services to be ready)
uses: whatnick/wait-action@master
with:
time: '10s'
- name: set output container pid (stage 1 - get ows container pid)
id: set-output-container-id
run: |
export $(grep -v '^#' .env_simple | xargs)
echo "::set-output name=PID::$(docker inspect --format '{{.State.Pid}}' $(docker inspect -f '{{.Name}}' \
$(docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml ps -q ows) \
| cut -c2-))"
- name: Run py-spy profiling (stage 1 - run profiling service)
timeout-minutes: 1
continue-on-error: true
run: |
export $(grep -v '^#' .env_simple | xargs)
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml \
exec -T ows /bin/sh -c "cd /code;./test_urls.sh &"
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml \
run pyspy record -f speedscope -o ./artifacts/profile.json --duration 30 \
--pid ${{steps.set-output-container-id.outputs.PID}} --subprocesses
- name: Stop py-spy profiling after timeout (stage 1 - stop profiling)
run: |
export $(grep -v '^#' .env_simple | xargs)
docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml down
- name: Upload profile to artifact (stage 1 - Upload profiling svg to artifacts)
uses: actions/upload-artifact@v2
with:
name: profile.json
path: ./artifacts/profile.json