-
Notifications
You must be signed in to change notification settings - Fork 22
139 lines (125 loc) · 4.43 KB
/
main.yml
File metadata and controls
139 lines (125 loc) · 4.43 KB
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
name: Main
on:
push:
pull_request:
release:
types: [created, edited]
jobs:
build-and-test:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:12
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
# Necessary to activate conda env. See https://github.com/conda-incubator/setup-miniconda#important
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
# ODC itself only tests on 3.8 now in Github CI.
# (Some dependencies seem to have issues on 3.6 now.
# It could probably be fixed with careful pinning if people care about 3.6)
python-version: [3.8]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
- run: |
conda info
conda list
conda config --show-sources
conda config --show
python --version
which python
- name: Install dependencies using conda
run: |
mamba install --file conda-deps.txt
# We can't use DB_ per standard Datacube Conventions, because they only work
# when a configuration file is not explicitly loaded, and the tests in this repository
# explicitly load a configuration to avoid destroying a production database.
# We also can't use PG* environment variables, because they're ignored by ODC code.
- name: Setup test configuration file
run: |
echo [datacube] >> ~/.datacube_integration.conf
echo db_hostname: localhost >> ~/.datacube_integration.conf
echo db_database: dea_integration >> ~/.datacube_integration.conf
echo db_username: postgres >> ~/.datacube_integration.conf
echo db_password: postgres >> ~/.datacube_integration.conf
echo db_port: 5432 >> ~/.datacube_integration.conf
- name: Setup Database
run: |
createdb dea_integration
env:
# The hostname used to communicate with the PostgreSQL service container
PGHOST: localhost
# The default PostgreSQL port
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
- name: install package
run: |
python -m pip install -U pip
pip -v install -e .[test]
- name: Lint and test code
run: ./check-code.sh integration_tests/
- uses: codecov/codecov-action@v1
with:
env_vars: OS,PYTHON
file: ./coverage.xml
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: packages
path: dist
deploy-packages:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Download a single artifact
uses: actions/download-artifact@v2
with:
name: packages
path: dist
- name: Display directory structure of downloaded files
run: ls -lR
- name: Deploy packages
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: "datacube-core-deployment"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "ap-southeast-2" # optional: defaults to us-east-1
SOURCE_DIR: "dist" # optional: defaults to entire repository
DEST_DIR: "digitalearthau"
# - name: Publish package
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}