Repository: cylc/cylc-uiserver (language: python)

Issue:
GH Actions improvements
- Run on MacOS 11 to avoid DNS problem https://github.com/actions/runner-images/issues/8649
- Various other improvements

**Check List**

- [x] I have read `CONTRIBUTING.md` and added my name as a Code Contributor.
- [x] Contains logically grouped changes (else tidy your branch by rebase).
- [x] Does not contain off-topic changes (use other PRs for other changes).


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1d33e30c..be24d1cb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -27,13 +27,13 @@ jobs:
         uses: actions/checkout@v4
 
       - name: Setup Python
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python }}
 
       - name: Build
         uses: cylc/release-actions/build-python-package@v1
-        with: 
+        with:
           check-dependencies: false
 
       - name: Inspect


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5fb436a7..3f472a06 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -4,18 +4,28 @@ on:
   pull_request:
   workflow_dispatch:
   push:
-    branches: [master]
+    branches:
+      - master
+      - '*.*.x'
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+env:
+  FORCE_COLOR: 2
 
 jobs:
   test:
     runs-on: ${{ matrix.os }}
     timeout-minutes: 15
     strategy:
+      fail-fast: false
       matrix:
         os: ['ubuntu-latest']
         python: ['3.8', '3.9']
         include:
-          - os: 'macos-latest'
+          - os: 'macos-11'
             python: '3.8'
     env:
       PYTEST_ADDOPTS: --cov --color=yes
@@ -44,7 +54,7 @@ jobs:
           __HERE__
 
       - name: Setup Python
-        uses: actions/setup-python@v4
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python }}
 
@@ -58,9 +68,11 @@ jobs:
         run: pip install -e .[all]
 
       - name: Style test
+        if: startsWith(matrix.os, 'ubuntu')
         run: flake8
 
       - name: Type checking
+        if: startsWith(matrix.os, 'ubuntu')
         run: mypy
 
       - name: Check changelog
@@ -75,8 +87,30 @@ jobs:
           coverage xml --ignore-errors
           coverage report
 
+      - name: Upload coverage artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: coverage_${{ matrix.os }}_py-${{ matrix.python }}
+          path: coverage.xml
+          retention-days: 4
+
+  codecov:
+    needs: test
+    runs-on: ubuntu-latest
+    timeout-minutes: 2
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Download coverage artifacts
+        uses: actions/download-artifact@v4
+
       - name: Codecov upload
         uses: codecov/codecov-action@v3
         with:
-          name: '${{ matrix.os }} py-${{ matrix.python }}'
-          fail_ci_if_error: false
+          name: ${{ github.workflow }}
+          fail_ci_if_error: true
+          verbose: true
+          # Token not required for public repos, but avoids upload failure due
+          # to rate-limiting (but not for PRs opened from forks)
+          token: ${{ secrets.CODECOV_TOKEN }}