Skip to content

Merge pull request #44 from sebhmg/GEOPY-1226 #180

Merge pull request #44 from sebhmg/GEOPY-1226

Merge pull request #44 from sebhmg/GEOPY-1226 #180

Workflow file for this run

name: static analysis
on:
pull_request:
branches:
- develop
- main
- release/**
- feature/**
- hotfix/**
push:
branches:
- develop
- main
- release/**
- feature/**
- hotfix/**
env:
source_dir: omf
jobs:
pylint:
name: pylint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
POETRY_VIRTUALENVS_CREATE: true
POETRY_VIRTUALENVS_IN_PROJECT: true
steps:
- uses: actions/checkout@v3
- name: Set up Python version
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Get full Python version
id: full-python-version
shell: bash
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python - --version 1.3.2
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Set up cache
uses: actions/cache@v3
id: cache
env:
# Increase this value to reset cache if poetry.lock has not changed
CACHE_NUMBER: 1
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}-{{ env.CACHE_NUMBER }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies
run: poetry install -vvv
- name: capture modified files
if: github.event_name == 'pull_request'
run: >-
git fetch --deepen=500 origin ${{github.base_ref}}
&& echo "FILES_PARAM=$(
git diff --diff-filter=AM --name-only refs/remotes/origin/${{github.base_ref}}... -- | grep -E "^(${source_dir}|tests)/.*\.py$" | xargs
)" >> $GITHUB_ENV
- name: Run pylint on modified files
if: github.event_name == 'pull_request' && env.FILES_PARAM
run: poetry run pylint $FILES_PARAM
- name: Run pylint on all files
if: github.event_name == 'push'
run: poetry run pylint $source_dir/fileio/geoh5* tests