Skip to content

Commit

Permalink
Change actions for mamba / pip install methods.
Browse files Browse the repository at this point in the history
for mamba: use mamba-org/provision-with-micromamba
for pip: use actions/setup-python
  • Loading branch information
nbiederbeck committed Jan 11, 2023
1 parent 900631e commit 401542a
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 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,15 @@ 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}
shell: bash -leo pipefail {0}

steps:
- uses: actions/checkout@v3
Expand All @@ -60,53 +60,43 @@ 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 }}
check-latest: true

- name: Update pip
if: matrix.install-method == 'pip'
run: pip install -U pip
- if: ${{ matrix.install-method == 'pip' && runner.os == 'macOS' }}
name: Fix Python PATH on macOS
run: |
tee -a ~/.bash_profile <<<'export PATH="$pythonLocation/bin:$PATH"'
- name: Install dependencies
run: |
echo $PATH
python --version
pip install codecov pytest-cov flake8 pytest-xdist 'coverage!=6.3.0'
pip install .[all]
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 +137,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

0 comments on commit 401542a

Please sign in to comment.