style: Code reformat #5844
Workflow file for this run
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: Code quality | |
on: | |
pull_request: | |
branches_ignore: [] | |
jobs: | |
formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup mamba | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: fmt | |
channels: "conda-forge, bioconda" | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
- name: Setup environment | |
shell: bash -el {0} | |
run: | | |
conda config --set channel_priority strict | |
mamba install -n fmt -y black snakefmt | |
- name: Check Python formatting | |
shell: bash -el {0} | |
run: | | |
black --check */*/*/wrapper.py */*/wrapper.py | |
# TODO reactivate once comment errors are fixed | |
# - name: Check Snakemake formatting | |
# run: | | |
# export PATH="/usr/share/miniconda/bin:$PATH" | |
# source activate fmt | |
# snakefmt --check $(git diff origin/master --name-only | grep Snakefile) | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup mamba | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: snakemake | |
channels: "conda-forge, bioconda" | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
- name: Setup Snakemake environment | |
shell: bash -el {0} | |
run: | | |
conda config --set channel_priority strict | |
mamba install -n snakemake -y snakemake-minimal snakemake | |
- name: Fetch master | |
run: | | |
git fetch origin master | |
- name: Linting | |
shell: bash -el {0} | |
run: | | |
declare -i ERRORS=0 | |
# get all modified and added files, not those that are deleted | |
for f in $(git diff origin/master --name-only --diff-filter=d | grep Snakefile) | |
do | |
snakemake -s $f --lint | |
ERRORS+=$? | |
done | |
if (( $ERRORS > 0 )) | |
then | |
echo "There are some lints above. Please fix them." | |
exit 1 | |
fi |