Skip to content

Commit a92b8f5

Browse files
committed
adopt CI a bit
1 parent 9c5225c commit a92b8f5

File tree

2 files changed

+59
-30
lines changed

2 files changed

+59
-30
lines changed

.github/workflows/single.sh

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
#!/bin/bash
22
set -ex
33

4-
# Change the default docker data directory as /mnt has more space
5-
sudo mkdir -p /mnt/docker
6-
7-
if [ ! -f /etc/docker/daemon.json ]; then
8-
echo '{}' | sudo tee /etc/docker/daemon.json
9-
fi
10-
11-
sudo jq '."data-root"="/mnt/docker"' /etc/docker/daemon.json > /tmp/docker_daemon.json
12-
sudo mv /tmp/docker_daemon.json /etc/docker/daemon.json
13-
14-
sudo systemctl daemon-reload && sudo systemctl restart docker
15-
164
docker --version
175
docker info
186

@@ -22,20 +10,44 @@ export GALAXY_USER_EMAIL=admin@example.org
2210
export GALAXY_USER_PASSWD=password
2311
export BIOBLEND_GALAXY_API_KEY=fakekey
2412
export BIOBLEND_GALAXY_URL=http://localhost:8080
13+
export EPHEMERIS_IMAGE=${EPHEMERIS_IMAGE:-quay.io/biocontainers/ephemeris:0.10.11--pyhdfd78af_0}
14+
export GALAXY_WAIT_TIMEOUT=${GALAXY_WAIT_TIMEOUT:-600}
15+
16+
SKIP_SFTP=false
17+
SKIP_DIVE=false
18+
19+
if [[ "${CI:-}" == "true" ]]; then
20+
sudo apt-get update -qq
21+
#sudo apt-get install docker-ce --no-install-recommends -y -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew"
22+
sudo apt-get install sshpass --no-install-recommends -y
23+
else
24+
if ! command -v sshpass >/dev/null 2>&1; then
25+
echo "sshpass not found; skipping SFTP test."
26+
SKIP_SFTP=true
27+
fi
28+
fi
2529

26-
sudo apt-get update -qq
27-
#sudo apt-get install docker-ce --no-install-recommends -y -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew"
28-
sudo apt-get install sshpass --no-install-recommends -y
29-
30-
DIVE_VERSION=$(curl -sL "https://api.github.com/repos/wagoodman/dive/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
31-
curl -OL https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb
32-
sudo apt install ./dive_${DIVE_VERSION}_linux_amd64.deb
33-
rm ./dive_${DIVE_VERSION}_linux_amd64.deb
30+
if [[ "${CI:-}" == "true" ]]; then
31+
DIVE_VERSION=$(curl -sL "https://api.github.com/repos/wagoodman/dive/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
32+
curl -OL https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb
33+
sudo apt install ./dive_${DIVE_VERSION}_linux_amd64.deb
34+
rm ./dive_${DIVE_VERSION}_linux_amd64.deb
35+
else
36+
if ! command -v dive >/dev/null 2>&1; then
37+
echo "dive not found; skipping image analysis."
38+
SKIP_DIVE=true
39+
fi
40+
fi
3441

35-
pip3 install ephemeris
42+
galaxy_wait() {
43+
docker run --rm --link galaxy:galaxy \
44+
"${EPHEMERIS_IMAGE}" galaxy-wait -g http://galaxy --timeout "${1:-$GALAXY_WAIT_TIMEOUT}"
45+
}
3646

3747
# start building this repo
38-
sudo chown 1450 /tmp && sudo chmod a=rwx /tmp
48+
if [[ "${CI:-}" == "true" ]]; then
49+
sudo chown 1450 /tmp && sudo chmod a=rwx /tmp
50+
fi
3951

4052
## define a container size check function, first parameter is the container name, second the max allowed size in MB
4153
container_size_check () {
@@ -65,7 +77,8 @@ docker buildx build \
6577
galaxy/
6678
#container_size_check quay.io/bgruening/galaxy 1500
6779

68-
mkdir local_folder
80+
docker rm -f galaxy httpstest || true
81+
mkdir -p local_folder
6982
docker run -d -p 8080:80 -p 8021:21 -p 8022:22 \
7083
--name galaxy \
7184
--privileged=true \
@@ -105,11 +118,11 @@ echo "SLURM and SGE tests have finished."
105118

106119
docker ps
107120
echo 'Waiting for Galaxy to come up.'
108-
galaxy_wait_timeout=600
121+
galaxy_wait_timeout=$GALAXY_WAIT_TIMEOUT
109122
galaxy_wait_interval=30
110123
galaxy_wait_end=$((SECONDS + galaxy_wait_timeout))
111124
while [ $SECONDS -lt $galaxy_wait_end ]; do
112-
if galaxy-wait -g $BIOBLEND_GALAXY_URL --timeout 30; then
125+
if galaxy_wait 30; then
113126
break
114127
fi
115128
echo "Galaxy still starting, tailing logs..."
@@ -132,7 +145,7 @@ docker logs httpstest
132145
sleep 180s && curl -v -k --fail https://127.0.0.1:443/api/version
133146
echo | openssl s_client -connect 127.0.0.1:443 2>/dev/null | openssl x509 -issuer -noout| grep localhost
134147

135-
docker stop httpstest && docker rm httpstest
148+
docker rm -f httpstest || true
136149

137150
# Test FTP Server upload
138151
date > time.txt
@@ -142,7 +155,9 @@ date > time.txt
142155
#curl -v --fail ftp://localhost:8021 --user $GALAXY_USER:$GALAXY_USER_PASSWD
143156

144157
# Test SFTP Server
145-
sshpass -p $GALAXY_USER_PASSWD sftp -v -P 8022 -o User=$GALAXY_USER -o "StrictHostKeyChecking no" localhost <<< $'put time.txt'
158+
if [[ "$SKIP_SFTP" != "true" ]]; then
159+
sshpass -p $GALAXY_USER_PASSWD sftp -v -P 8022 -o User=$GALAXY_USER -o "StrictHostKeyChecking no" localhost <<< $'put time.txt'
160+
fi
146161
147162
# Test CVMFS
148163
docker_exec bash -c "service autofs start"
@@ -186,14 +201,18 @@ docker run -d -p 8080:80 \
186201
quay.io/bgruening/galaxy
187202
188203
echo 'Waiting for Galaxy to come up.'
189-
galaxy-wait -g $BIOBLEND_GALAXY_URL --timeout 600
204+
galaxy_wait "$GALAXY_WAIT_TIMEOUT"
190205
191206
# Test if the tool installed previously is available
192207
curl -v --fail 'http://localhost:8080/api/tools/toolshed.g2.bx.psu.edu/repos/devteam/cut_columns/Cut1/1.0.2'
193208
194209
# analyze image using dive tool
195-
CI=true dive quay.io/bgruening/galaxy
210+
if [[ "$SKIP_DIVE" == "true" ]]; then
211+
echo "Skipping dive image analysis (dive not installed)."
212+
else
213+
CI=true dive quay.io/bgruening/galaxy
214+
fi
196215
197216
docker stop galaxy
198217
docker rm -f galaxy
199-
docker rmi -f $DOCKER_RUN_CONTAINER
218+
docker rmi -f $DOCKER_RUN_CONTAINER || true

.github/workflows/single_container.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ jobs:
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v6
12+
- name: Configure Docker data-root
13+
run: |
14+
sudo mkdir -p /mnt/docker
15+
if [ ! -f /etc/docker/daemon.json ]; then
16+
echo '{}' | sudo tee /etc/docker/daemon.json
17+
fi
18+
sudo jq '."data-root"="/mnt/docker"' /etc/docker/daemon.json > /tmp/docker_daemon.json
19+
sudo mv /tmp/docker_daemon.json /etc/docker/daemon.json
20+
sudo systemctl daemon-reload
21+
sudo systemctl restart docker
1222
- name: Set up Docker Buildx
1323
uses: docker/setup-buildx-action@v3
1424
- uses: actions/setup-python@v6

0 commit comments

Comments
 (0)