diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 00000000..1acbdd1c --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,101 @@ +name: "Unit tests" + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-18.04 + 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" + CK_DEFAULT_TIMEOUT: 20 + + strategy: + matrix: + experimental: [false] + include: + - irods: "4.2.7" + server_image: "wsinpg/ub-16.04-irods-4.2.7:latest" + experimental: false + - irods: "4.2.8" + server_image: "wsinpg/ub-18.04-irods-4.2.8:latest" + experimental: true + + services: + irods: + image: ${{ matrix.server_image }} + ports: + - 1247:1247 + - 20000-20199:20000-20199 + + steps: + - uses: actions/checkout@v2 + + - name: "Initialize Miniconda" + run: | + echo 'source $CONDA/etc/profile.d/conda.sh' >> "$HOME/.bash_profile" + + - 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 config --append channels conda-forge + conda info + + - name: "Install iRODS clients" + run: | + conda create -y -n "$CONDA_TEST_ENVIRONMENT" + conda install -y -n "$CONDA_TEST_ENVIRONMENT" python=3.9 + conda install -y -n "$CONDA_TEST_ENVIRONMENT" sphinx=2.4 + + conda install -y -n "$CONDA_TEST_ENVIRONMENT" check + conda install -y -n "$CONDA_TEST_ENVIRONMENT" libjansson-dev + conda install -y -n "$CONDA_TEST_ENVIRONMENT" "irods-dev ==${{ matrix.irods }}" + + conda install -y -n "$CONDA_TEST_ENVIRONMENT" "irods-icommands ==${{ matrix.irods }}" + + - 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": "testResc" + } + EOF + + echo "irods" | script -q -c "iinit" /dev/null + ienv + ils + + - name: "Build and test baton" + run: | + conda activate "$CONDA_TEST_ENVIRONMENT" + + # Is there an environment variable for this? + CONDA_ENV="/home/runner/conda/envs/$CONDA_TEST_ENVIRONMENT" + + CPPFLAGS="-I$CONDA_ENV/include -I$CONDA_ENV/include/irods" + LDFLAGS="-L$CONDA_ENV/lib -L$CONDA_ENV/lib/irods/externals" + + autoreconf -i + ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" + + export LD_LIBRARY_PATH="$CONDA_ENV/lib" + + make distcheck DISTCHECK_CONFIGURE_FLAGS="CPPFLAGS=\"$CPPFLAGS\" LDFLAGS=\"$LDFLAGS\"" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6a3d79d6..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -dist: bionic - -services: - - docker - -language: c - -compiler: gcc - -env: - global: - - CK_DEFAULT_TIMEOUT=20 - -_iRODS_4_2_8: &iRODS_4_2_8 - env: DOCKER_IMAGE=wsinpg/ub-18.04-irods-4.2.8:latest IRODS_VERSION="4.2.8" CONFIGURE_ARGS="--with-test-resource=replResc" - -jobs: - include: - - env: DOCKER_IMAGE=wsinpg/ub-16.04-irods-4.2.7:latest IRODS_VERSION="4.2.7" CONFIGURE_ARGS="--with-test-resource=replResc --enable-put-workaround" - - env: DOCKER_IMAGE=wsinpg/ub-16.04-irods-4.2.7:latest IRODS_VERSION="4.2.7" CONFIGURE_ARGS="--with-test-resource=replResc" - - <<: *iRODS_4_2_8 - - allow_failures: - - <<: *iRODS_4_2_8 - -before_install: - - docker pull "$DOCKER_IMAGE" - - docker run -d -p 1247:1247 "$DOCKER_IMAGE" - - docker ps -a - - ./scripts/travis_before_install.sh - -install: - - ./scripts/travis_install.sh - -script: - - ./scripts/travis_script.sh - -after_failure: - - ./scripts/travis_failure.sh - diff --git a/scripts/travis_before_install.sh b/scripts/travis_before_install.sh deleted file mode 100755 index 11322209..00000000 --- a/scripts/travis_before_install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -set -e -x - -sudo apt-get update -qq diff --git a/scripts/travis_failure.sh b/scripts/travis_failure.sh deleted file mode 100755 index afc83e18..00000000 --- a/scripts/travis_failure.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -. ~/miniconda/etc/profile.d/conda.sh -conda activate travis -ilsresc -ils -Lr -cat ./baton*/_build/*/tests/check_baton.log diff --git a/scripts/travis_install.sh b/scripts/travis_install.sh deleted file mode 100755 index 72d6ef7a..00000000 --- a/scripts/travis_install.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -e -u -x - -wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.6.14-Linux-x86_64.sh -O ~/miniconda.sh - -/bin/bash ~/miniconda.sh -b -p ~/miniconda -~/miniconda/bin/conda clean -tipsy -echo ". ~/miniconda/etc/profile.d/conda.sh" >> ~/.bashrc -echo "conda activate base" >> ~/.bashrc - -. ~/miniconda/etc/profile.d/conda.sh -conda activate base -conda config --set auto_update_conda False - -conda create -y -n travis -conda activate travis -conda install -y python=3.8 -pip install sphinx==2.4.0 - -conda config --add channels https://dnap.cog.sanger.ac.uk/npg/conda/devel/generic/ -conda config --append channels conda-forge - -conda install -y check -conda install -y libjansson-dev -conda install -y irods-dev="$IRODS_VERSION" -conda install -y irods-icommands="$IRODS_VERSION" - -mkdir -p ~/.irods -cat < ~/.irods/irods_environment.json -{ - "irods_host": "localhost", - "irods_port": 1247, - "irods_user_name": "irods", - "irods_zone_name": "testZone", - "irods_home": "/testZone/home/irods", - "irods_plugins_home": "$HOME/miniconda/envs/travis/lib/irods/plugins/", - "irods_default_resource": "replResc" -} -EOF - diff --git a/scripts/travis_script.sh b/scripts/travis_script.sh deleted file mode 100755 index bb8c0467..00000000 --- a/scripts/travis_script.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e -x - -. ~/miniconda/etc/profile.d/conda.sh -conda activate travis - -echo "irods" | script -q -c "iinit" /dev/null -ienv -ils - -CONDA_ENV=/home/travis/miniconda/envs/travis -CPPFLAGS="-I$CONDA_ENV/include -I$CONDA_ENV/include/irods" -LDFLAGS="-L$CONDA_ENV/lib -L$CONDA_ENV/lib/irods/externals" - -autoreconf -fi - -./configure "$CONFIGURE_ARGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" - -export LD_LIBRARY_PATH="$CONDA_ENV/lib" - -make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_ARGS CPPFLAGS=\"$CPPFLAGS\" LDFLAGS=\"$LDFLAGS\""