diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..35695fd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: build + +on: + push: + pull_request: + schedule: + - cron: "3 3 * * 0" # Run at a random time weekly + +jobs: + build: + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ["3.10"] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Setup conda and dependencies + run: | + util/setup_ci.sh ${{ matrix.python-version }} + - name: Test + run: | + eval "$(conda shell.bash hook)" + conda activate python${{ matrix.python-version }} + cd test + # Run a quick subset of all tests + python test.py Tests.test_mmcif diff --git a/util/setup_ci.sh b/util/setup_ci.sh new file mode 100755 index 0000000..371a536 --- /dev/null +++ b/util/setup_ci.sh @@ -0,0 +1,20 @@ +#!/bin/bash -e + +# Set up an environment to run tests under Travis CI (see toplevel .travis.yml) +# or GitHub Actions (see toplevel .github/workflows/build.yml) + +if [ $# -ne 1 ]; then + echo "Usage: $0 python_version" + exit 1 +fi + +python_version=$1 + +# get conda-forge, not main, packages +conda config --remove channels defaults +conda config --add channels conda-forge +IMP_CONDA="imp" + +conda create --yes -q -n python${python_version} -c salilab python=${python_version} matplotlib ${IMP_CONDA} +eval "$(conda shell.bash hook)" +conda activate python${python_version}