Repository: wagtail/wagtail-ai (language: python)

Issue:
Review CI setup
- Update the CI tooling to use the newest and shiniest stuff from https://github.com/wagtail/cookiecutter-wagtail-package.
- Use PyPI trusted publishing to the list.
- The nightly job does not seem to execute front-end tooling.
- I don't know how the publish job could've worked if the front-end tooling had missing `src/` in the paths. See #21.
```[tasklist]
### Tasks
- [x] Update the CI tooling to use the newest and shiniest stuff from https://github.com/wagtail/cookiecutter-wagtail-package.
- [x] Use PyPI trusted publishing (#45)
- [x] Ensure front-end tooling is executed in the nightly job (#50)
```



Discussion / hints:
Good call!
I would add "Use PyPI trusted publishing to the list" (https://docs.pypi.org/trusted-publishers/using-a-publisher/, https://github.com/wagtail/cookiecutter-wagtail-package/blob/main/%7B%7B%20cookiecutter.__project_name_kebab%20%7D%7D/.github/workflows/publish.yml#L31-L52)
The addition of the `src/` folder was recent - we haven't published a version since then. Thanks for picking up on that.

The CI setup is built on https://github.com/wagtail/cookiecutter-wagtail-package so we might be able to backport some of the recent fixes from there here, where it makes sense.


Fix patch:
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 77d4def..ff015fd 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -4,7 +4,7 @@
     "postCreateCommand": "pip install tox && tox devenv -e interactive && npm ci && ./venv/bin/pre-commit install",
     "features": {
         "ghcr.io/devcontainers/features/node:1": {
-            "version": "21"
+            "version": "20"
         }
     },
     "customizations": {
@@ -19,4 +19,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index c41a845..3f3b84e 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -13,22 +13,32 @@ jobs:
       WEBHOOK_EXISTS: ${{ secrets.SLACK_WEBHOOK_URL != '' }}
 
     steps:
-      - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
+      - uses: actions/checkout@v4
+      - uses: actions/setup-node@v4
+        with:
+          node-version-file: '.nvmrc'
+
+      - name: Install Node dependencies
+        run: npm ci
+
+      - name: Build static files
+        run: ./node_modules/.bin/webpack --mode production
+
+      - uses: actions/setup-python@v5
         with:
           python-version: '3.11'
 
       - run: git clone https://github.com/wagtail/wagtail.git
 
-      - run: python -m pip install flit
+      - run: python -Im pip install flit
       - run: flit install --deps production --extras testing
-      - run: python -m pip install ./wagtail
+      - run: python -Im pip install ./wagtail
 
-      - run: python testmanage.py test
+      - run: pytest
 
       - name: Report failure
         run: |
-          python -m pip install requests
+          python -Im pip install requests
           python ./.github/scripts/report_nightly_build_failure.py
         if: ${{ failure() && env.WEBHOOK_EXISTS == 'true' }}
         env:
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 671ddcc..a4ed9e6 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -17,9 +17,9 @@ jobs:
           fetch-depth: 0
 
       - name: Set up Node
-        uses: actions/setup-node@v3
+        uses: actions/setup-node@v4
         with:
-          node-version: '18'
+          node-version-file: '.nvmrc'
 
       - name: Install Node dependencies
         run: npm ci
@@ -28,7 +28,7 @@ jobs:
         run: ./node_modules/.bin/webpack --mode production
 
       - name: Set up Python 3.11
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: '3.11'
 
diff --git a/.nvmrc b/.nvmrc
index b6a7d89..209e3ef 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1,1 +1,1 @@
-16
+20
diff --git a/docs/contributing.md b/docs/contributing.md
index 7c31059..88d4da9 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -65,7 +65,7 @@ flit install -s
 Frontend assets (React components, admin scripts, custom CSS) are bundled using Webpack. A Node.js environment is required to install and run the dependencies required to build these assets. We recommend [`nvm`](https://github.com/nvm-sh/nvm#install--update-script) for installing and using Node.js locally:
 
 ```shell
-nvm install 21
+nvm install 20
 npm ci
 ```
 


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4ff97ca..bc52a1c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -59,9 +59,9 @@ jobs:
         experimental: [false]
 
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
       - name: Set up Python ${{ matrix.python }}
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python }}
       - name: Install Tox
@@ -102,9 +102,9 @@ jobs:
         options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
 
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
       - name: Set up Python ${{ matrix.python }}
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python }}
       - name: Install Tox