DO NOT MERGE #6799
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: Run lint | |
on: | |
# Push to master or PR | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
linter: | |
name: "Run linter" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Setup flake8 annotations | |
uses: rbialon/flake8-annotations@v1 | |
- name: Install linter | |
run: | | |
pip install flake8 pylint | |
- name: Lint codebase | |
run: | | |
make lint GITHUB_ACTIONS_FORMATTING=1 | |
- name: Install bibtex linter | |
run: | | |
pip install bibtexparser | |
- name: Check bibtex | |
run: | | |
cd docs | |
make validate-bibtex | |
actionlint: | |
name: "Lint Github actions YAML files" | |
# There's a way to add error formatting so GH actions adds messages to code, | |
# but I can't work out the right number of quotes to get it to work | |
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md | |
# #example-error-annotation-on-github-actions | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check workflow files | |
uses: docker://rhysd/actionlint:latest | |
with: | |
args: -color | |
docker_linter: | |
name: "Lint dockerfiles" | |
runs-on: ubuntu-latest | |
container: | |
image: hadolint/hadolint:latest-alpine | |
env: | |
HADOLINT_IGNORE: "DL3005,DL3007,DL3008,DL3015,DL3059" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lint dockerfiles inside hadolint container | |
run: | | |
for DOCKERFILE in docker/Dockerfile.*; \ | |
do \ | |
echo " Linting $DOCKERFILE"; \ | |
hadolint "$DOCKERFILE" \ | |
|| exit 1; \ | |
done |