Skip to content

Allow sets of covariates to be selected (#63) #348

Allow sets of covariates to be selected (#63)

Allow sets of covariates to be selected (#63) #348

Workflow file for this run

# This workflow will install Python dependencies and run tests
# For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: tests
on: # yamllint disable-line rule:truthy
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
poetry-version: ["1.8.2"]
node_version: ["lts/*"]
steps:
# Setup
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install Python Dependencies
run: poetry install --with daq,web,ana,dev
# File filters
- name: Paths Changes Filter
uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
filters: |
poetry:
# Do not run poetry check and lock if just the pyproject.toml file changes
# - added|modified: '**/pyproject.toml'
- added|modified: '**/poetry.lock'
python:
- added|modified: '**.py'
- added|modified: '**.ipynb'
javascript:
- added|modified: '**.js'
html:
- added|modified: '**.html'
prettier:
- added|modified: '**.html'
- added|modified: '**.css'
- added|modified: '**.scss'
- added|modified: '**.json'
# prettier-plugin-toml is not being properly installed on the actions runner,
# lint toml files locally
# - added|modified: '**.toml'
yaml:
- added|modified: '**.yaml'
- added|modified: '**.yml'
makefile:
- added|modified: '**/Makefile'
- added|modified: '**/makefile'
markdown:
- added|modified: '**.md'
tex:
- added|modified: '**.tex'
rst:
- added|modified: '**.rst'
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: false
# Does not break anything, and saves a lot of space, but runs slowly,
# do not use unless necessary, i.e. when running poetry checks.
large-packages: ${{steps.filter.outputs.poetry}}
# Needed by any dockerized github action
docker-images: false
# Gets the poetry cache back
swap-storage: false
# These will be cleaned
android: true
dotnet: true
haskell: true
# Filtered setup
- name: Install Node
if: steps.filter.outputs.javascript == 'true' || steps.filter.outputs.prettier == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
check-latest: true
- name: Install Node Dependencies
if: steps.filter.outputs.javascript == 'true' || steps.filter.outputs.prettier == 'true'
run: sudo npm install --global standard prettier
# All files
- name: detect-secrets
run: poetry run detect-secrets-hook --exclude-lines 'integrity='
- name: blocklint
run: poetry run blocklint --skip-files=poetry.lock --max-issue-threshold=1
# poetry
- name: poetry
if: steps.filter.outputs.poetry == 'true'
run: poetry check && poetry lock --no-update
# python
- name: isort
if: steps.filter.outputs.python == 'true'
run: poetry run isort ${{ steps.filter.outputs.python_files }}
- name: black
if: steps.filter.outputs.python == 'true'
run: poetry run black --check --diff ${{ steps.filter.outputs.python_files }}
- name: flake8
if: steps.filter.outputs.python == 'true'
run: |
echo "::group::version and plugins"
poetry run flake8 --version
echo "::endgroup::"
poetry run flake8 ${{ steps.filter.outputs.python_files }}
- name: mypy
if: steps.filter.outputs.python == 'true'
run: poetry run mypy ${{ steps.filter.outputs.python_files }}
- name: pylint
if: steps.filter.outputs.python == 'true'
run: poetry run pylint ${{ steps.filter.outputs.python_files }}
- name: bandit
if: steps.filter.outputs.python == 'true'
run: poetry run bandit -r ${{ steps.filter.outputs.python_files }}
- name: vulture
if: steps.filter.outputs.python == 'true'
run: poetry run vulture . # Needs to run on whole package
- name: pyupgrade
if: steps.filter.outputs.python == 'true'
run: poetry run pyupgrade ${{ steps.filter.outputs.python_files }}
- name: deptry
if: steps.filter.outputs.python == 'true'
run: poetry run deptry . # Runs on whole package
# javascript
- name: standard
if: steps.filter.outputs.javascript == 'true'
run: standard ${{ steps.filter.outputs.javascript_files }}
# html
- name: html5validator
if: steps.filter.outputs.html == 'true'
uses: Cyb3r-Jak3/html5validator-action@master # blocklint: pragma
with:
config: .dev_config/.html5validator.yaml
# only configurable to run on paths, so just run on whole package
# prettier: html css scss json
- name: prettier
if: steps.filter.outputs.prettier == 'true'
id: prettier
run: prettier --ignore-path .dev_config/.prettierignore --ignore-path .gitignore --config .dev_config/.prettierrc.yaml --check ${{ steps.filter.outputs.prettier_files }} # yamllint disable-line rule:line-length
# yaml
- name: yamllint
if: steps.filter.outputs.yaml == 'true'
run: poetry run yamllint -c .dev_config/.yamllint.yaml --strict ${{ steps.filter.outputs.yaml_files }} # yamllint disable-line rule:line-length
# makefile
- name: checkmake
if: steps.filter.outputs.makefile == 'true'
uses: Uno-Takashi/checkmake-action@main # Can not pass multiple files
# shell files - no extension to filter on, always run
- name: shellcheck shfmt checkbashisms
uses: luizm/action-sh-checker@master # blocklint: pragma
env:
SHFMT_OPTS: -bn -ci -sr -s -d
with:
sh_checker_checkbashisms_enable: true
# typos - always run
- name: typos
uses: crate-ci/typos@v1.19.0
with:
config: pyproject.toml
# docs
- name: markdownlint
if: steps.filter.outputs.markdown == 'true'
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: ${{ steps.filter.outputs.markdown_files }}
dot: true
config_file: .dev_config/.markdownlint.yaml
ignore_files: LICENSE.md
- name: blacken-docs
if: steps.filter.outputs.python == 'true' || steps.filter.outputs.markdown == 'true' || steps.filter.outputs.rst == 'true' || steps.filter.outputs.tex == 'true' # yamllint disable-line rule:line-length
run: poetry run blacken-docs --line-length=100 ${{ steps.filter.outputs.python_files }} ${{ steps.filter.outputs.markdown_files }} ${{ steps.filter.outputs.rst_files }} ${{ steps.filter.outputs.tex_files }} # yamllint disable-line rule:line-length