-
Notifications
You must be signed in to change notification settings - Fork 4
151 lines (130 loc) · 5.27 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: "Unit tests"
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.irods.experimental }} # Experimental builds may fail
defaults:
run:
shell: bash -l -e -o pipefail {0}
env:
SINGULARITY_VERSION: "3.11.1"
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
irods: [
{version: "4.2.7",
client_image: "ghcr.io/wtsi-npg/ub-16.04-irods-clients-4.2.7:latest",
server_image: "ghcr.io/wtsi-npg/ub-16.04-irods-4.2.7:latest",
experimental: false},
{version: "4.2.11",
client_image: "ghcr.io/wtsi-npg/ub-18.04-irods-clients-4.2.11:latest",
server_image: "ghcr.io/wtsi-npg/ub-18.04-irods-4.2.11:latest",
experimental: false},
{version: "4.2.12",
client_image: "ghcr.io/wtsi-npg/ub-18.04-irods-clients-4.2.12:latest",
server_image: "ghcr.io/wtsi-npg/ub-18.04-irods-4.2.12:latest",
experimental: false},
{version: "4.3.1",
client_image: "ghcr.io/wtsi-npg/ub-22.04-irods-clients-4.3.1:latest",
server_image: "ghcr.io/wtsi-npg/ub-22.04-irods-4.3.1:latest",
experimental: false},
{version: "4.3.2",
client_image: "ghcr.io/wtsi-npg/ub-22.04-irods-clients-4.3.2:latest",
server_image: "ghcr.io/wtsi-npg/ub-22.04-irods-4.3.2:latest",
experimental: false},
{version: "4.3.3",
client_image: "ghcr.io/wtsi-npg/ub-22.04-irods-clients-4.3.3:latest",
server_image: "ghcr.io/wtsi-npg/ub-22.04-irods-4.3.3:latest",
experimental: false}
]
services:
irods-server:
image: ${{ matrix.irods.server_image }}
ports:
- "1247:1247"
- "20000-20199:20000-20199"
volumes:
- /dev/shm:/dev/shm
options: >-
--health-cmd "nc -z -v localhost 1247"
--health-start-period 60s
--health-interval 10s
--health-timeout 20s
--health-retries 6
steps:
- name: "Set environmental variables based on other environmental variables"
run: |
echo "SINGULARITY_CACHEDIR=$HOME/.singularity-cache" >> $GITHUB_ENV
# '~' in SINGULARITY_CACHEDIR value (from say a env: section in this YAML) is not expanded by
# singularity so that paths used are misleading/unclear
- uses: actions/checkout@v4
- name: "Install Singularity"
run: |
pkg="singularity-ce_${SINGULARITY_VERSION}-$(lsb_release -sc)_amd64.deb"
curl -sSL -O "https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/$pkg"
curl -sSL -O "https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/sha256sums"
grep "$os_release" sha256sums | sha256sum
sudo apt-get install -q -y "./$pkg"
# Avoid the runner's loop devices being exhausted
sudo singularity config global --set "max loop devices" 128
# Enable DBus for this user, so that rootless cgroups works and we can create
# Singularity service instances. See https://github.com/containers/podman/issues/5443
systemctl --user enable --now dbus.socket
echo DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" >> $GITHUB_ENV
- name: "Cache Singularity images"
uses: actions/cache@v4
with:
path: ${{ env.SINGULARITY_CACHEDIR }}
key: ${{ runner.os }}-singularity
- name: "Install iRODS client wrappers"
env:
DOCKER_IMAGE: ${{ matrix.irods.client_image }}
run: |
# Use -s option for the wrappers to enable re-usable service instances
# Install is to HOME rather than workspace to avoid clashes with repo e.g. in bin/
singularity exec docker://$DOCKER_IMAGE singularity-wrapper -s -p $HOME/.local install
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: "Configure iRODS clients"
env:
DOCKER_IMAGE: ${{ matrix.irods.client_image }}
PREFIX: ${{ github.workspace }}
run: |
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
ils
ilsresc
baton-do --version
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: "Setup Python dependencies"
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: "Check code formatting [Black]"
run: |
black --check --diff ./src ./tests
- name: "Run tests"
env:
IRODS_VERSION: ${{ matrix.irods.version }}
SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity-cache
run: |
pip install .
pytest --it
- name: "Log on failure"
if: ${{ failure() }}
run: journalctl --no-pager