Skip to content

WIP

WIP #338

Workflow file for this run

name: Lint
on:
workflow_dispatch:
push:
paths:
- 'flepimop/gempyor_pkg/**/*.py'
- 'info/**/*'
pull_request:
types:
- edited
- opened
- ready_for_review
- reopened
- synchronize
paths:
- '**/*.py'
- 'info/**/*'
branches:
- main
- dev
jobs:
black-for-python:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
env:
BLACK_LINE_LENGTH: 92
BLACK_EXTEND_EXCLUDE: 'flepimop/gempyor_pkg/src/gempyor/steps_rk4.py'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
sparse-checkout: |
*
!documentation/
sparse-checkout-cone-mode: false
- name: Determine Source
run: |
if [ ${{ github.event_name }} == "push" ]; then
echo "BLACK_SRC=flepimop/gempyor_pkg/" >> $GITHUB_ENV
else
echo "BLACK_SRC=." >> $GITHUB_ENV
fi
- name: Black Formatter Check
uses: psf/black@stable
with:
src: ${{ env.BLACK_SRC }}
options: "--line-length ${{ env.BLACK_LINE_LENGTH }} --extend-exclude '${{ env.BLACK_EXTEND_EXCLUDE }}' --check --verbose"
check-info-json-schema:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
sparse-checkout: |
info
sparse-checkout-cone-mode: false
- name: Install yq and check-jsonschema
run: |
sudo apt update
sudo apt install snapd
sudo snap install yq
sudo apt install pipx
pipx install check-jsonschema
- name: Convert YAML to JSON
run: |
cd info
for d in $( ls ); do
cd $d
for y in *.yml; do
yq --output-format json $y > ${y%.yml}.json
done
for j in *.json; do
if [[ "$j" != "schema.json" ]]; then
check-jsonschema --verbose --schemafile schema.json $j
fi
done
cd ..
done
cd ..