Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change actions for mamba / pip install methods. #2207

Merged
merged 4 commits into from
Jan 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 24 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
include:
- os: ubuntu-latest
python-version: "3.8"
install-method: conda
install-method: mamba

- os: ubuntu-latest
python-version: "3.9"
install-method: conda
install-method: mamba

- os: ubuntu-latest
python-version: "3.10"
install-method: conda
install-method: mamba
codecov: true

- os: ubuntu-latest
Expand All @@ -39,15 +39,16 @@ jobs:

- os: macos-latest
python-version: "3.10"
install-method: conda
install-method: mamba

- os: macos-latest
python-version: "3.8"
install-method: pip

defaults:
run:
shell: bash -l {0}
# We need login shells (-l) for micromamba to work.
shell: bash -leo pipefail {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -60,36 +61,34 @@ jobs:
path: ~/.cache/ctapipe
key: ctapipe-test-data

- name: Prepare conda installation
if: matrix.install-method == 'conda'
- name: Prepare mamba installation
if: matrix.install-method == 'mamba'
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
# fix mamba error that the directory does not exist
mkdir -p ~/conda_pkgs_dir/cache
# setup correct python version
sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml

- name: Conda setup
if: matrix.install-method == 'conda'
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
auto-update-conda: true
activate-environment: "cta-dev"
environment-file: environment.yml
- name: mamba setup
if: matrix.install-method == 'mamba'
uses: mamba-org/provision-with-micromamba@v14

- name: Python setup
if: matrix.install-method == 'pip'
uses: conda-incubator/setup-miniconda@v2
uses: actions/setup-python@v4
with:
mamba-version: "*"
channels: conda-forge,default
python-version: ${{ matrix.python-version }}

- name: Update pip
if: matrix.install-method == 'pip'
run: pip install -U pip
check-latest: true

- if: ${{ matrix.install-method == 'pip' && runner.os == 'macOS' }}
name: Fix Python PATH on macOS
# See https://github.com/actions/setup-python/issues/132 and
# https://github.com/actions/setup-python/issues/132#issuecomment-779406058
# Login shells on macOS prepend system paths, so we need to
# prepend the python path from actions/setup-python.
# Micromamba sets up ~/.bash_profile, where we need to set the path now.
run: |
tee -a ~/.bash_profile <<<'export PATH="$pythonLocation/bin:$PATH"'

- name: Install dependencies
run: |
Expand All @@ -99,14 +98,10 @@ jobs:
pip freeze

- name: Static codechecks
# need to use a login shell for the conda setup to work
shell: bash -leo pipefail {0}
run: |
flake8 ctapipe

- name: Tests
# need to use a login shell for the conda setup to work
shell: bash -leo pipefail {0}
run: |
cd $(mktemp -d)
pytest -n auto --dist loadscope \
Expand Down Expand Up @@ -147,7 +142,7 @@ jobs:
- name: Build docs
run: make doc

- name: Deploy to gihub pages
- name: Deploy to github pages
# only run on push to master
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@3.7.1
Expand Down