diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml deleted file mode 100644 index 7fc6b6f..0000000 --- a/.github/workflows/links.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Check URLs with Lychee - -on: - push: - branches: - - main - pull_request: - schedule: - - cron: "0 3 * * *" - -jobs: - Check-URLs: - runs-on: ubuntu-latest - steps: - - - name: Restore Lychee cache - uses: actions/cache@v4 - with: - path: .lycheecache - key: cache-lychee-${{ github.sha }} - restore-keys: cache-lychee- - - - uses: actions/checkout@v4 - - - name: Link checker - id: lychee - uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 - with: - # Same as those in the PyBaMM repository - args: | - --cache - --max-cache-age 3d . - --verbose - --no-progress - --timeout 10 - --max-retries 5 - --skip-missing - --exclude-loopback - --exclude https://twitter.com/* - --exclude "https://doi\.org|www.sciencedirect\.com/*" - --exclude https://plausible.io/pybamm.org - --accept 200,429,999 - format: markdown - jobSummary: true - fail: true - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - # TBD: automatically open an issue if any links fail diff --git a/.gitignore b/.gitignore index e858068..7d4281c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ __pycache__/ # env Folder env/ + +# Lychee pre-commit hook +.lycheecache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0d7b68..a9bc3b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,29 +7,64 @@ ci: # Standard hooks repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files - - id: mixed-line-ending + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: mixed-line-ending + # Lychee: check links + - repo: https://github.com/lycheeverse/lychee.git + rev: v0.15.1 + hooks: + - id: lychee + entry: lychee + pass_filenames: false + args: + - . + - --verbose + - --no-progress + - --timeout + - "10" + - --max-retries + - "5" + - --skip-missing + - --exclude-loopback + - --exclude + - https://twitter.com/* + - --exclude + - https://doi\.org|www.sciencedirect\.com/* + - --exclude + - https://plausible.io/pybamm.org + # Exclude the theme submodule and the built files. The latter are + # generated from the build and we don't bother with them because + # their links are either not relevant or are already checked. + - --exclude-path + - themes/ + - --exclude-path + - static/ + - --exclude-path + - public/ + - --exclude-path + - resources/ + - --accept + - 200,429,999 -# Python files -- repo: https://github.com/astral-sh/ruff-pre-commit + # Python files + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.4 hooks: - - id: ruff + - id: ruff args: ["--fix", "--show-fixes"] - -# Spelling errors and typos -- repo: https://github.com/codespell-project/codespell + # Spelling errors and typos + - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - - id: codespell + - id: codespell exclude: content/gsoc/2024/ankit-meda.md args: - "-Lrecuse,Meda" diff --git a/README.md b/README.md index d3affca..7c5daf8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # pybamm.org [![Netlify](https://api.netlify.com/api/v1/badges/c4c60d47-1de1-4d0a-8a25-726d3cf100c8/deploy-status)](https://app.netlify.com/sites/pybamm-developer-preview/deploys) -[![Links](https://github.com/pybamm-team/pybamm.org/actions/workflows/links.yml/badge.svg)](https://github.com/pybamm-team/pybamm.org/actions/workflows/links.yml) [![pre-commit.ci](https://results.pre-commit.ci/badge/github/pybamm-team/pybamm.org/main.svg)](https://results.pre-commit.ci/latest/github/pybamm-team/pybamm.org/main) [![Gitpod](https://img.shields.io/badge/open%20in-Gitpod-blue?logo=gitpod)](https://gitpod.io/#https://github.com/pybamm-team/pybamm.org/)