.github/workflows/conda.yml
# -----------------------
#
# Run a full build-and-test from the git repo
# using a combination of conda and pip to install
# all optional dependencies.
#
# This is the 'full' test suite.
#
# -----------------------
name: Conda tests
on:
push:
branches:
- main
- master
- release/**
pull_request:
branches:
- main
- master
- release/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
conda:
name: Conda Python ${{ matrix.python-version }} (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os:
- macOS
- Ubuntu
- Windows
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ${{ matrix.os }}-latest
# this is needed for conda environments to activate automatically
defaults:
run:
shell: bash -el {0}
steps:
- name: Get source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache conda packages
uses: actions/cache@v3
env:
# increment to reset cache
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}
restore-keys: ${{ runner.os }}-conda-${{ matrix.python-version }}-
- name: Cache apt (Linux)
if: matrix.os == 'Ubuntu'
uses: actions/cache@v3
env:
# increment to reset cache
CACHE_NUMBER: 0
with:
path: ~/apt-cache
key: ${{ matrix.os }}-apt-${{ env.CACHE_NUMBER }}
restore-keys: ${{ matrix.os }}-apt-
- name: Configure apt (Linux)
if: matrix.os == 'Ubuntu'
run: |
APT_CACHE_DIR=$(readlink -f ~/apt-cache)
mkdir -pv "${APT_CACHE_DIR}/archive/partial"
echo "Dir::Cache \"${APT_CACHE_DIR}\";" | sudo tee /etc/apt/apt.conf.d/99cache.conf
- name: Configure conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
use-mamba: true
- name: Conda info
run: conda info --all
- name: Install dependencies with conda
run: |
# parse requirements to install as much as possible with conda
mamba create --name pip2conda pip2conda
mamba run -n pip2conda pip2conda \
--all \
--output environment.txt \
--python-version ${{ matrix.python-version }}
echo "-----------------"
cat environment.txt
echo "-----------------"
mamba install --quiet --yes --name test --file environment.txt
- name: Install extra dependencies (Linux)
if: matrix.os == 'Ubuntu'
run: |
# update repos
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q -q update
# install apt requirements
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q install \
cm-super-minimal \
dvipng \
texlive-latex-base \
texlive-latex-extra \
;
- name: Install CVMFS (Linux)
if: matrix.os == 'Ubuntu'
run: |
# configure CVMFS Apt repo
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q install lsb-release
curl -LO https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb
sudo dpkg -i cvmfs-release-latest_all.deb
rm -f cvmfs-release-latest_all.deb
# configure CVMFS-contrib Apt repo
curl -LO https://ecsft.cern.ch/dist/cvmfs/cvmfs-contrib-release/cvmfs-contrib-release-latest_all.deb
sudo dpkg -i cvmfs-contrib-release-latest_all.deb
rm -f cvmfs-contrib-release-latest_all.deb
# install cvmfs
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q -q update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q install \
cvmfs \
cvmfs-config-osg \
;
# configure CVMFS client
sudo cvmfs_config setup
sudo bash -c 'cat > /etc/cvmfs/default.local' << EOF
CVMFS_REPOSITORIES=gwosc.osgstorage.org
CVMFS_QUOTA_LIMIT=20000
CVMFS_HTTP_PROXY=DIRECT
EOF
sudo cvmfs_config probe
- name: Install GWpy
run: python -m pip install .[dev,test] --no-build-isolation -vv
- name: Package list
run: conda list --name test
- name: Run test suite
run: python -m pytest -ra --color yes --cov gwpy --cov-report=xml --junitxml=pytest.xml --numprocesses=auto gwpy/ examples/
- name: Coverage report
run: python -m coverage report --show-missing
- name: Publish coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml
flags: Conda,${{ runner.os }},python${{ matrix.python-version }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: pytest-conda-${{ matrix.os }}-${{ matrix.python-version }}
path: pytest.xml