-
Notifications
You must be signed in to change notification settings - Fork 4
156 lines (135 loc) · 3.83 KB
/
main.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Run Code Checks
on:
push:
branches-ignore: [develop]
paths:
- '**'
- '!docker/**'
- '!.github/workflows/statistician-*'
- '!notebooks/**'
- '!docs/**'
- '!k8s/**'
- '!README.md'
tags:
- '**'
workflow_run:
workflows: ["Create a new tag"]
types:
- completed
permissions:
contents: read
packages: read
jobs:
build-wheels:
if: |
github.event_name == 'push' || (github.ref == 'refs/heads/develop'
&& github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
id: wheels_cache
with:
path: ./wheels
key: wheels-${{ github.sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade \
setuptools \
setuptools-scm
python -m pip install --upgrade \
toml \
wheel \
twine \
packaging
python -m pip freeze
- name: Build Clean Packages
run: |
mkdir -p ./wheels/clean
python setup.py bdist_wheel --dist-dir ./wheels/clean/
python setup.py sdist --dist-dir ./wheels/clean/
find ./wheels/clean -type f
test-wheels:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
services:
postgres:
image: postgis/postgis:10-2.5
env:
POSTGRES_DB: opendatacube
POSTGRES_PASSWORD: opendatacubepassword
POSTGRES_USER: opendatacube
needs:
- build-wheels
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
shell: bash
run: |
apt update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
--fix-missing --no-install-recommends \
nodejs \
zstd
python -m pip install --upgrade --no-cache pip
pip install --upgrade --no-cache -r \
tests/requirements.txt
pip freeze
- name: Get Wheels from Cache
uses: actions/cache@v4
id: wheels_cache
with:
path: ./wheels
key: wheels-${{ github.sha }}
- name: Install wheels for testing
shell: bash
run: |
which python
which datacube
ls -lh wheels/clean
pip install --no-deps --no-cache wheels/clean/*whl
pip check || true
pip show odc-stats
which odc-stats | xargs ls -alt
odc-stats --version
- name: Run Tests
shell: bash
run: |
echo "Init DB"
./tests/init_db.sh
echo "Running unit tests"
pytest --cov=. \
--cov-report=html \
--cov-report=xml:coverage.xml \
--timeout=30 tests
echo "Running integration tests"
./tests/integration_test.sh
env:
DB_HOSTNAME: postgres
DB_USERNAME: opendatacube
DB_PASSWORD: opendatacubepassword
DB_DATABASE: opendatacube
AWS_NO_SIGN_REQUEST: true
AWS_DEFAULT_REGION: ap-southeast-2
AWS_REGION: ap-southeast-2
STAC_API_URL: https://earth-search.aws.element84.com/v0/
GDAL_HTTP_MAX_RETRY: 5
- name: Upload Coverage
if: |
github.repository == 'opendatacube/odc-stats'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: false