Skip to content

formatting

formatting #141

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: swolfpy
on:
push:
branches-ignore: []
pull_request:
branches: [ master ]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- 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: Install dependencies
run: |
conda update conda
conda env update --file environment_dev.yml --name base
- name: Check if feature branch exists in swolfpy-inputdata
run: |
echo "-----------------------------------------"
echo "github.head_ref = ${{ github.head_ref }} ---"
echo "github.ref = ${{ github.ref }} ---"
echo "github.ref_name = ${{ github.ref_name }} ---"
echo "------------------------------------------"
if git ls-remote --exit-code --heads https://github.com/SwolfPy-Project/swolfpy-inputdata.git ${{ github.ref_name }}; then
echo "Branch ${{ github.ref_name }} exists."
echo "BRANCH_INPUTDATA=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "Branch does not exist. Falling back to 'master' branch."
echo "BRANCH_INPUTDATA=master" >> $GITHUB_ENV
fi
- name: Check if feature branch exists in swolfpy-processmodels
run: |
if git ls-remote --exit-code --heads https://github.com/SwolfPy-Project/swolfpy-processmodels.git ${{ github.ref_name }}; then
echo "Branch ${{ github.ref_name }} exists."
echo "BRANCH_PROCESSMODELS=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "Branch does not exist. Falling back to 'master' branch."
echo "BRANCH_PROCESSMODELS=master" >> $GITHUB_ENV
fi
- name: Install swolfpy-inputdata from branch
run: |
echo "pip install git+https://github.com/SwolfPy-Project/swolfpy-inputdata.git@${{ env.BRANCH_INPUTDATA }}"
pip install git+https://github.com/SwolfPy-Project/swolfpy-inputdata.git@${{ env.BRANCH_INPUTDATA }}
- name: Install swolfpy-processmodels from branch
run: |
echo "pip install git+https://github.com/SwolfPy-Project/swolfpy-processmodels.git@${{ env.BRANCH_PROCESSMODELS }}"
pip install git+https://github.com/SwolfPy-Project/swolfpy-processmodels.git@${{ env.BRANCH_PROCESSMODELS }}
- name: Check channels
run: |
conda config --show channels
- name: Check installed packages
run: |
pip list
- name: Pre-Commit
run: |
git fetch origin master
pre-commit run --from-ref origin/master --to-ref HEAD --show-diff-on-failure