Skip to content

mamba-test

mamba-test #330

Workflow file for this run

# This workflow will install Python dependencies using Mamba,
# run tests and lint with a single version of Python
name: mamba-test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
schedule:
- cron: "0 2 * * 1" #run every Monday night at 2AM UTC
permissions:
contents: read
jobs:
mamba-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
#python-version: ["3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: provision-with-micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
environment-name: ecmean
cache-downloads: true
cache-environment: false
post-cleanup: environment
condarc: |
channels:
- conda-forge
create-args: >-
python=${{ matrix.python-version }}
- name: Install Flake8
run: |
python -m pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=__init__.py
- name: Install Pytest
run: |
python -m pip install pytest
- name: Test with pytest
run: |
python -m pytest
coverage:
needs: mamba-test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: provision-with-micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
environment-name: ecmean
cache-downloads: true
cache-environment: true
- name: Install Coverage
run: |
python -m pip install pytest coverage coveralls
- name: Run coverage
run: |
coverage run -m pytest
coverage combine
coverage lcov
- name: Run coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov