forked from wtsi-npg/npg-irods-python
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (109 loc) · 3.52 KB
/
run-tests.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
name: "Unit tests"
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }} # Experimental builds may fail
defaults:
run:
shell: bash -l -e -o pipefail {0}
env:
WSI_CONDA_CHANNEL: "https://dnap.cog.sanger.ac.uk/npg/conda/devel/generic"
CONDA_TEST_ENVIRONMENT: "testenv"
PYTHON_VERSION: "3.10"
strategy:
matrix:
include:
# iRODS 4.2.11 clients vs 4.2.7 server
- irods: "4.2.11"
server_image: "ghcr.io/wtsi-npg/ub-16.04-irods-4.2.7:latest"
baton: "4.0.0"
experimental: false
# iRODS 4.2.11 clients vs 4.2.11 server
- irods: "4.2.11"
server_image: "ghcr.io/wtsi-npg/ub-18.04-irods-4.2.11:latest"
baton: "4.0.0"
experimental: false
services:
mysql:
image: "mysql:8.0"
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
MYSQL_RANDOM_ROOT_PASSWORD: yes
MYSQL_TCP_PORT: 3306
MYSQL_USER: "test"
MYSQL_PASSWORD: "test"
MYSQL_DATABASE: "mlwarehouse"
irods:
image: ${{ matrix.server_image }}
ports:
- 1247:1247
steps:
- uses: actions/checkout@v3
- name: "Initialize Miniconda"
run: |
echo 'source $CONDA/etc/profile.d/conda.sh' >> "$HOME/.bash_profile"
- name: "Cache Miniconda"
id: cache-miniconda
uses: actions/cache@v3
with:
path: |
~/conda/pkgs
~/conda/envs
key: ${{ runner.os }}-miniconda
- name: "Configure Miniconda"
run: |
conda config --prepend pkgs_dirs "$HOME/conda/pkgs"
conda config --prepend envs_dirs "$HOME/conda/envs"
conda config --set auto_update_conda False
conda config --prepend channels "$WSI_CONDA_CHANNEL"
conda info
- name: "Install iRODS clients"
run: |
conda create -y -n "$CONDA_TEST_ENVIRONMENT"
conda install -y -n "$CONDA_TEST_ENVIRONMENT" "irods-icommands=${{ matrix.irods }}"
conda install -y -n "$CONDA_TEST_ENVIRONMENT" "baton=${{ matrix.baton }}"
- name: "Configure iRODS clients"
run: |
conda activate "$CONDA_TEST_ENVIRONMENT"
mkdir -p "$HOME/.irods"
cat <<'EOF' > "$HOME/.irods/irods_environment.json"
{
"irods_host": "localhost",
"irods_port": 1247,
"irods_user_name": "irods",
"irods_zone_name": "testZone",
"irods_home": "/testZone/home/irods",
"irods_default_resource": "replResc",
"irods_default_hash_scheme": "MD5"
}
EOF
echo "irods" | script -q -c "iinit" /dev/null
ienv
ilsresc
ils
baton-do --version
- name: "Setup Python"
run: |
conda activate "$CONDA_TEST_ENVIRONMENT"
conda install -c defaults python="$PYTHON_VERSION"
- name: "Setup Python dependencies"
run: |
conda activate "$CONDA_TEST_ENVIRONMENT"
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: "Check code formatting [Black]"
run: |
conda activate "$CONDA_TEST_ENVIRONMENT"
black --check --diff --quiet .
- name: "Run tests"
run: |
conda activate "$CONDA_TEST_ENVIRONMENT"
pip install .
pytest --it