Merge pull request #275 from wtsi-npg/dependabot/go_modules/golang.or… #659
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
SINGULARITY_VERSION: "3.11.1" | |
strategy: | |
matrix: | |
include: | |
- irods: "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 | |
- irods: "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 | |
- irods: "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 | |
- irods: "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 | |
- irods: "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: true | |
services: | |
irods-server: | |
image: ${{ matrix.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: | |
- uses: actions/checkout@v4 | |
- name: "Set up Go" | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
- 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: ${{ github.workspace }}/.singularity-cache | |
key: ${{ runner.os }}-singularity | |
- name: "Install iRODS client wrappers" | |
env: | |
DOCKER_IMAGE: ${{ matrix.client_image }} | |
PREFIX: ${{ github.workspace }} | |
SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity-cache | |
run: | | |
# Use -s option for the wrappers to enable re-usable service instances | |
singularity exec docker://$DOCKER_IMAGE singularity-wrapper -s -p $PREFIX install | |
echo "$PREFIX/bin" >> $GITHUB_PATH | |
- name: "Configure iRODS clients" | |
env: | |
DOCKER_IMAGE: ${{ matrix.client_image }} | |
PREFIX: ${{ github.workspace }} | |
SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity-cache | |
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 | |
- name: "Install test runner" | |
run: | | |
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo | |
go get github.com/onsi/gomega/... | |
- name: "Run tests" | |
run: | | |
make test |