diff --git a/.github/linkspector.yml b/.github/linkspector.yml new file mode 100644 index 0000000000..8d84d6dfb3 --- /dev/null +++ b/.github/linkspector.yml @@ -0,0 +1,13 @@ +dirs: + - . +useGitIgnore: true +ignorePatterns: + - pattern: '^https://mybinder.org/v2/gh/stfc/psyclone' +replacementPatterns: + - pattern: '^https:\/\/(psyclone.*\.readthedocs\.io\/en)\/stable$' + replacement: 'https://$1/latest' +aliveStatusCodes: + - 200 + - 401 + - 502 + - 503 diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml new file mode 100644 index 0000000000..296e259e04 --- /dev/null +++ b/.github/workflows/linkcheck.yml @@ -0,0 +1,16 @@ +name: Linkspector +on: [pull_request] +jobs: + check-links: + if: ${{ github.repository != 'stfc/PSyclone-mirror' }} + name: Run linkspector + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run linkspector + uses: umbrelladocs/action-linkspector@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-check + fail_on_error: true + config_file: '.github/linkspector.yml' diff --git a/.github/workflows/mlc_config.json b/.github/workflows/mlc_config.json deleted file mode 100644 index 1ce91eb467..0000000000 --- a/.github/workflows/mlc_config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^https://mybinder.org/v2/gh/stfc/psyclone" - } - ], - "replacementPatterns": [ - { - "pattern": "^https://psyclone.readthedocs.io/en/stable", - "replacement": "https://psyclone.readthedocs.io/en/latest" - } - ], - "aliveStatusCodes": [200, 401, 502, 503] -} diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f7792e99dc..eec02a9151 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -52,17 +52,6 @@ on: workflow_dispatch: jobs: - markdown-link-check: - if: ${{ github.repository != 'stfc/PSyclone-mirror' }} - # Check all markdown files for dead links. See the 'mlc_config.json' - # file in the project root directory for configuration. - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - use-verbose-mode: 'yes' - config-file: '.github/workflows/mlc_config.json' sphinx-link-check: if: ${{ github.repository != 'stfc/PSyclone-mirror' }} # Check all Sphinx documentation for dead links. @@ -70,8 +59,10 @@ jobs: env: GITHUB_PR_NUMBER: ${{ github.event.number }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - run: sudo apt-get install -y graphviz doxygen - run: python -m pip install --upgrade pip - run: pip install .[doc] @@ -89,8 +80,10 @@ jobs: # Check doctests of developer's guide runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - run: python -m pip install --upgrade pip - run: pip install .[doc] # Sphinx since version 7.2 (7.2.0/1/2) aborts with @@ -108,7 +101,7 @@ jobs: matrix: python-version: [3.7, 3.8, 3.12] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive # This is required to get the commit history for merge commits for diff --git a/changelog b/changelog index 624e36ae45..f21d7eaca7 100644 --- a/changelog +++ b/changelog @@ -146,6 +146,8 @@ 52) PR #2632 for #2116. Update the code-transformation tutorial. + 53) PR #2639 for #2638. Upgrade CI markdown-linkcheck to linkspector. + release 2.5.0 14th of February 2024 1) PR #2199 for #2189. Fix bugs with missing maps in enter data diff --git a/doc/developer_guide/working_practises.rst b/doc/developer_guide/working_practises.rst index ec7bd45534..12403d2fc0 100644 --- a/doc/developer_guide/working_practises.rst +++ b/doc/developer_guide/working_practises.rst @@ -439,26 +439,22 @@ triggered whenever there is a push to a pull-request on the repository and consists of five main checks performed, in order of increasing computational cost (so that we 'fail fast'): - 1. All links within all MarkDown files are checked. Those links to skip - (because they are e.g. password protected) are specified in the - ``PSyclone/.github/workflows/mlc_config.json`` configuration file. - - 2. All examples in the Developer Guide are checked for correctness by + 1. All examples in the Developer Guide are checked for correctness by running ``make doctest``. - 3. The code base, examples and tutorials are lint'ed with flake8. + 2. The code base, examples and tutorials are lint'ed with flake8. (Configuration of flake8 is performed in ``setup.cfg``.) - 4. All links within the Sphinx documentation (rst files) are checked (see + 3. All links within the Sphinx documentation (rst files) are checked (see note below); - 5. All of the examples are tested (for Python versions 3.7, 3.8 and 3.12) + 4. All of the examples are tested (for Python versions 3.7, 3.8 and 3.12) using the ``Makefile`` in the ``examples`` directory. No compilation is performed; only the ``transform`` (performs the PSyclone transformations) and ``notebook`` (runs the various Jupyter notebooks) targets are used. The ``transform`` target is run 2-way parallel (``-j 2``). - 6. The full test suite is run for Python versions 3.7, 3.8 and 3.12 but + 5. The full test suite is run for Python versions 3.7, 3.8 and 3.12 but without the compilation checks. ``pytest`` is passed the ``-n auto`` flag so that it will run the tests in parallel on as many cores as are available (currently 2 on GHA instances). @@ -488,7 +484,7 @@ and therefore the line described above must be commented out again before making a release. A single run of the test suite on GitHub Actions uses -approximately 20 minutes of CPU time and we run the test suite on three +approximately 15 minutes of CPU time and we run the test suite on three different versions of Python. Therefore, it is good practise to avoid triggering the tests unnecessarily (e.g. when we know that a certain commit won't pass). This may be achieved by including the "[skip ci]" tag (without @@ -497,6 +493,14 @@ the quotes) in the associated commit message. Link checking ------------- +Link checking for all of the MarkDown files is performed using the +linkspector GitHub Action which has its own workflow file, +``linkspector.yml``. Those links to skip (because they are e.g. password +protected) are specified in the ``PSyclone/.github/linkspector.yml`` +configuration file. That file also ensures that links to the PSyclone +documentation are always checked against the 'latest' version on +ReadTheDocs rather than 'stable'. + The link checking performed for the Sphinx documentation uses Sphinx's `linkcheck` functionality. Some URLs are excluded from this checking (due to ssl issues with an outdated http server or pages