From efecf8d3311d6d77881677b7c08694e8030a1a8b Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 13:20:06 +0100 Subject: [PATCH 01/10] #2638 add new linkcheck workflow --- .github/workflows/linkcheck.yml | 16 ++++++++++++++++ .github/workflows/linkspector.yml | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/linkcheck.yml create mode 100644 .github/workflows/linkspector.yml diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml new file mode 100644 index 0000000000..feb3f78154 --- /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: runner / 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-review + fail_on_error: true + config_file: '.github/workflows/linkspector.yml' \ No newline at end of file diff --git a/.github/workflows/linkspector.yml b/.github/workflows/linkspector.yml new file mode 100644 index 0000000000..34881b830f --- /dev/null +++ b/.github/workflows/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 From e34202f2eebb086c5bca2172364bf6a6d4739310 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 13:26:37 +0100 Subject: [PATCH 02/10] #2638 tidy config file rules --- .github/workflows/linkspector.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linkspector.yml b/.github/workflows/linkspector.yml index 34881b830f..8d84d6dfb3 100644 --- a/.github/workflows/linkspector.yml +++ b/.github/workflows/linkspector.yml @@ -4,7 +4,7 @@ useGitIgnore: true ignorePatterns: - pattern: '^https://mybinder.org/v2/gh/stfc/psyclone' replacementPatterns: - - pattern: '^https:\/\/(psyclone.*\.readthedocs\.io\/en\/)stable$' + - pattern: '^https:\/\/(psyclone.*\.readthedocs\.io\/en)\/stable$' replacement: 'https://$1/latest' aliveStatusCodes: - 200 From 18b758bbf54c6a739e3a62c16afdf222ab472ed2 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 13:26:57 +0100 Subject: [PATCH 03/10] #2638 deliberately break link to test --- tutorial/practicals/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial/practicals/README.md b/tutorial/practicals/README.md index 26cf634add..d47ce9c745 100644 --- a/tutorial/practicals/README.md +++ b/tutorial/practicals/README.md @@ -5,7 +5,7 @@ below this one work through using PSyclone in a 'normal' Linux-type environment. There are two sections to the practicals: 1. Transforming [existing code](nemo/README.md) -2. Using the [LFRic DSL](LFRic/README.md) +2. Using the [LFRic DSL](LFRic/BROKEN_README.md) ## Prerequisites From b99c78898d80e4cc3a1e23ef498d852e34b5a0c8 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 13:28:54 +0100 Subject: [PATCH 04/10] #2638 undo broken link --- tutorial/practicals/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial/practicals/README.md b/tutorial/practicals/README.md index d47ce9c745..26cf634add 100644 --- a/tutorial/practicals/README.md +++ b/tutorial/practicals/README.md @@ -5,7 +5,7 @@ below this one work through using PSyclone in a 'normal' Linux-type environment. There are two sections to the practicals: 1. Transforming [existing code](nemo/README.md) -2. Using the [LFRic DSL](LFRic/BROKEN_README.md) +2. Using the [LFRic DSL](LFRic/README.md) ## Prerequisites From 39004ad5836eb37c7771b608b8d2aaa1c34ae683 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 15:42:19 +0100 Subject: [PATCH 05/10] #2638 update action versions --- .github/workflows/{linkspector.yml => .linkspector.yml} | 0 .github/workflows/linkcheck.yml | 2 +- .github/workflows/python-package.yml | 8 +++++--- 3 files changed, 6 insertions(+), 4 deletions(-) rename .github/workflows/{linkspector.yml => .linkspector.yml} (100%) diff --git a/.github/workflows/linkspector.yml b/.github/workflows/.linkspector.yml similarity index 100% rename from .github/workflows/linkspector.yml rename to .github/workflows/.linkspector.yml diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index feb3f78154..db3cb54022 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -13,4 +13,4 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review fail_on_error: true - config_file: '.github/workflows/linkspector.yml' \ No newline at end of file + config_file: '.github/workflows/.linkspector.yml' diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f7792e99dc..0935576f4c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -67,10 +67,12 @@ jobs: if: ${{ github.repository != 'stfc/PSyclone-mirror' }} # Check all Sphinx documentation for dead links. runs-on: ubuntu-latest + with: + python-version: 3.12 env: GITHUB_PR_NUMBER: ${{ github.event.number }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - run: sudo apt-get install -y graphviz doxygen - run: python -m pip install --upgrade pip @@ -89,7 +91,7 @@ jobs: # Check doctests of developer's guide runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - run: python -m pip install --upgrade pip - run: pip install .[doc] @@ -108,7 +110,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 From 253b520ad580ae46c503750d8e0e2a272751994b Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 15:53:34 +0100 Subject: [PATCH 06/10] #2638 update actions and move config file --- .../{workflows/.linkspector.yml => linkspector.yml} | 0 .github/workflows/linkcheck.yml | 6 +++--- .github/workflows/python-package.yml | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) rename .github/{workflows/.linkspector.yml => linkspector.yml} (100%) diff --git a/.github/workflows/.linkspector.yml b/.github/linkspector.yml similarity index 100% rename from .github/workflows/.linkspector.yml rename to .github/linkspector.yml diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index db3cb54022..877e60e2a6 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -3,7 +3,7 @@ on: [pull_request] jobs: check-links: if: ${{ github.repository != 'stfc/PSyclone-mirror' }} - name: runner / linkspector + name: Run linkspector runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -11,6 +11,6 @@ jobs: uses: umbrelladocs/action-linkspector@v1 with: github_token: ${{ secrets.github_token }} - reporter: github-pr-review + reporter: github-pr-report fail_on_error: true - config_file: '.github/workflows/.linkspector.yml' + config_file: '.github/linkspector.yml' diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0935576f4c..205e89a73f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -67,13 +67,13 @@ jobs: if: ${{ github.repository != 'stfc/PSyclone-mirror' }} # Check all Sphinx documentation for dead links. runs-on: ubuntu-latest - with: - python-version: 3.12 env: GITHUB_PR_NUMBER: ${{ github.event.number }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@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] @@ -92,7 +92,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@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 From 1909461c6e870cf719b12ed0eff336b06045da53 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 16:14:53 +0100 Subject: [PATCH 07/10] #2639 fix report-type in linkcheck yml --- .github/workflows/linkcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 877e60e2a6..296e259e04 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -11,6 +11,6 @@ jobs: uses: umbrelladocs/action-linkspector@v1 with: github_token: ${{ secrets.github_token }} - reporter: github-pr-report + reporter: github-pr-check fail_on_error: true config_file: '.github/linkspector.yml' From 6052624c87b1f6c9e2742fefa2c206104ef605b2 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 16:39:04 +0100 Subject: [PATCH 08/10] #2638 rm old markdown-link-check action --- .github/workflows/mlc_config.json | 14 -------------- .github/workflows/python-package.yml | 11 ----------- 2 files changed, 25 deletions(-) delete mode 100644 .github/workflows/mlc_config.json 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 205e89a73f..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. From bd1eeab4df9d38a7237fbc69024b9d016a7bb005 Mon Sep 17 00:00:00 2001 From: Andrew Porter Date: Mon, 1 Jul 2024 16:48:31 +0100 Subject: [PATCH 09/10] #2638 update Dev Guide --- doc/developer_guide/working_practises.rst | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) 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 From 89b9decd2bd77297a9fc5d5add1c7aa5987da9e0 Mon Sep 17 00:00:00 2001 From: Sergi Siso Date: Mon, 1 Jul 2024 17:47:07 +0100 Subject: [PATCH 10/10] #2638 Update changelog --- changelog | 2 ++ 1 file changed, 2 insertions(+) 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