Update python-package-conda.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Package using Conda | |
on: | |
push: | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
steps: | |
# Step 1: Checkout the code | |
- uses: actions/checkout@v3 | |
# Step 2: Set up Python 3.10 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
# Step 3: Install Miniconda and add it to the system PATH | |
- name: Set up Conda | |
uses: goanpeca/setup-miniconda@v1 | |
with: | |
python-version: 3.10 | |
auto-update-conda: true | |
environment-file: environment.yml # Automatically installs dependencies from the environment file | |
activate-environment: base | |
# Step 4: Lint the code with flake8 | |
- name: Lint with flake8 | |
run: | | |
conda install -c conda-forge flake8 -y | |
# 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 | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
# Step 5: Run tests with pytest | |
- name: Test with pytest | |
run: | | |
conda install -c conda-forge pytest -y | |
pytest |