Skip to content

Commit

Permalink
change ci from conda to mamba
Browse files Browse the repository at this point in the history
  • Loading branch information
Geet-George committed Oct 31, 2023
1 parent b689425 commit 70e5a71
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies using conda, run tests and lint with a variety of Python versions
# This workflow will install Python dependencies using mamba, run tests and check pre-commit

name: Python package

Expand All @@ -23,25 +23,38 @@ jobs:
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
- uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
environment-name: test-env
create-args: >-
python=${{ matrix.python-version }}
- name: Install dependencies in mamba test-env
run: |
$CONDA/bin/conda env update --file environment.yml --name base
- name: Lint with flake8
micromamba update -n test-env -f environment.yml
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v3
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# $CONDA/bin/conda env update --file environment.yml --name base
# - name: Lint with flake8
# run: |
# $CONDA/bin/conda install flake8
# # stop the build if there are Python syntax errors or undefined names
# $CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# $CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run pytest in micromamba environment
run: |
$CONDA/bin/conda install flake8
# stop the build if there are Python syntax errors or undefined names
$CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
$CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
$CONDA/bin/conda install conda-build
$CONDA/bin/conda develop ./src
$CONDA/bin/conda install pytest
$CONDA/bin/pytest --import-mode=importlib .
mamba install pytest
pytest --import-mode=importlib .
shell: micromamba-shell {0}
# - name: Test with pytest
# run: |
# $CONDA/bin/conda install conda-build
# $CONDA/bin/conda develop ./src
# $CONDA/bin/conda install pytest
# $CONDA/bin/pytest --import-mode=importlib .
- name: pre-commit
uses: pre-commit/action@v3.0.0
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.10
- python>=3.10
- sphinx
- ca-certificates
- openssl
Expand Down

0 comments on commit 70e5a71

Please sign in to comment.