Skip to content

gh workflow

gh workflow #17

name: Python Package using Conda
on: [push]
jobs:
build-linux:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 5
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: '3.12'
- name: Add conda to system path
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "$CONDA\bin" >> $GITHUB_PATH
else
echo "$CONDA/bin" >> $GITHUB_PATH
fi
- name: Add extra channels
run: |
conda config --add channels conda-forge
conda config --add channels defaults
# - name: Install dependencies
# run: |
# conda env update --file environment.yml --name base
- name: Lint with flake8
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 --exclude deprecated . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 --exclude deprecated . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install current Python library
shell: bash
run: |
conda init
conda activate base # Activate the conda environment
pip install -e . # Install the current Python library in editable mode
- name: Test with pytest
shell: bash
run: |
conda activate base # Activate the conda environment
pytest tests -rsx
# build-windows:
# runs-on: windows-latest
# strategy:
# max-parallel: 5
#
# steps:
# # - uses: actions/checkout@v3
# # - name: Set up Python 3.10
# # uses: conda-incubator/setup-miniconda@v2
# # with:
# # miniconda-version: "latest"
# - uses: actions/checkout@v3
# - name: Set up Python 3.12
# uses: actions/setup-python@v3
# with:
# python-version: '3.12'
# # - name: Add conda to system path
# # run: |
# # # $CONDA is an environment variable pointing to the root of the miniconda directory
# # echo $CONDA/bin >> $GITHUB_PATH
# # - name: Add extra channels
# # run: |
# # conda config --add channels conda-forge
# # conda config --add channels defaults
#
# # - name: Install dependencies
# # run: |
# # conda env update --file environment.yml --name base
# - name: set up env3
# run: |
# python -m venv ENV3
#
# - name: Lint with flake8
# run: |
# .\ENV3\Scripts\activate.ps1
# pip install flake8
# # stop the build if there are Python syntax errors or undefined names
# flake8 --exclude deprecated . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 --exclude deprecated . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#
# - name: Install current Python library
# run: |
# .\ENV3\Scripts\activate.ps1
# pip install -e . # Install the current Python library in editable mode
# pip install cloudmesh-vpn
# - name: Test with pytest
# run: |
# .\ENV3\Scripts\activate.ps1
# pip install pytest
# pytest tests -rsx