From 12c0565d25f59b9c50a4fb7750ba9219c63f1ec7 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 16 Aug 2024 08:25:30 -0700 Subject: [PATCH] Update GitHub Actions configuration Incorporate recent changes from the FastAPI Safir app template. Get rid of the separate link check configuration in favor of link check steps in the regular and periodic configurations. --- .github/workflows/ci.yaml | 56 ++++++++++++++++++++--------- .github/workflows/linkcheck.yaml | 51 -------------------------- .github/workflows/periodic-ci.yaml | 57 +++++++++++++++++++++++++----- 3 files changed, 88 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/linkcheck.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4c0be5c83..831ca9ab2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,16 @@ name: CI +env: + # Current supported Python version for the controller. For applications, + # there is generally no reason to support multiple Python versions, so all + # actions are run with this version. Quote the version to avoid + # interpretation as a floating point number. + # + # The JupyterHub plugins use a separate matrix of versions because they have + # to work with the version of Python that is included in the JupyterHub + # images. + PYTHON_VERSION: "3.12" + "on": merge_group: {} pull_request: {} @@ -20,7 +31,7 @@ name: CI jobs: lint: runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -28,19 +39,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: ${{ env.PYTHON_VERSION }} - name: Run pre-commit uses: pre-commit/action@v3.0.1 test: runs-on: ubuntu-latest - timeout-minutes: 15 - - strategy: - matrix: - python: - - "3.12" + timeout-minutes: 10 steps: - uses: actions/checkout@v4 @@ -50,9 +56,9 @@ jobs: cache-dependency: "controller/requirements/*.txt" cache-key-prefix: test nox-sessions: "typing typing-inithome test test-inithome" - python-version: ${{ matrix.python }} + python-version: ${{ env.PYTHON_VERSION }} - # The controller requires Python 3.11, but the modules we add to the Hub + # The controller requires Python 3.12, but the modules we add to the Hub # have to run with Python 3.10 since that's what the JupyterHub image uses. # Run a separate matrix to test those modules. test-hub: @@ -105,11 +111,7 @@ jobs: cache-dependency: "controller/requirements/*.txt" cache-key-prefix: docs nox-sessions: docs - python-version: "3.12" - - # Manually install setuptools, which is required for Python 3.12. - - name: Install setuptools - run: pip install setuptools + python-version: ${{ env.PYTHON_VERSION }} # Upload docs: # - on any push to main @@ -123,7 +125,29 @@ jobs: password: ${{ secrets.LTD_PASSWORD }} if: > (github.event_name == 'push' && github.ref_name == 'main') - || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'tickets/') && steps.filter.outputs.docs == 'true') + || (github.event_name == 'pull_request' + && startsWith(github.head_ref, 'tickets/') + && steps.filter.outputs.docs == 'true') + + linkcheck: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + + - name: Update package lists + run: sudo apt-get update + + - name: Install extra packages + run: sudo apt install -y graphviz + + - uses: lsst-sqre/run-nox@v1 + with: + cache-dependency: "controller/requirements/*.txt" + cache-key-prefix: docs + nox-sessions: docs-linkcheck + python-version: ${{ env.PYTHON_VERSION }} build: runs-on: ubuntu-latest diff --git a/.github/workflows/linkcheck.yaml b/.github/workflows/linkcheck.yaml deleted file mode 100644 index c666c1692..000000000 --- a/.github/workflows/linkcheck.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# This is a separate documentation build just to check links. We don't check -# links as part of the normal documentation build since, unlike Sphinx errors -# and warnings, we don't want broken links to block a merge. (Sometimes they -# will be fixed by the same merge, sometimes they're temporary rate limit -# issues.) -# -# Instead, we do an advisory run of link checking on relevant PRs that doesn't -# block merging, and we do a weekly link check to catch any links that have -# gone stale. - -name: Link Check - -"on": - pull_request: {} - push: - branches-ignore: - # These should always correspond to pull requests, so ignore them for - # the push trigger and let them be triggered by the pull_request - # trigger, avoiding running the workflow twice. This is a minor - # optimization so there's no need to ensure this is comprehensive. - - "dependabot/**" - - "gh-readonly-queue/**" - - "renovate/**" - - "tickets/**" - - "u/**" - tags: - - "*" - schedule: - - cron: "0 12 * * 1" - workflow_dispatch: {} - -jobs: - linkcheck: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Update package lists - run: sudo apt-get update - - - name: Install extra packages - run: sudo apt install -y graphviz - - - uses: lsst-sqre/run-nox@v1 - with: - cache-dependency: "controller/requirements/*.txt" - cache-key-prefix: docs - nox-sessions: docs-linkcheck - python-version: "3.12" diff --git a/.github/workflows/periodic-ci.yaml b/.github/workflows/periodic-ci.yaml index b091ebc31..12c89a77b 100644 --- a/.github/workflows/periodic-ci.yaml +++ b/.github/workflows/periodic-ci.yaml @@ -4,6 +4,17 @@ name: Periodic CI +env: + # Current supported Python version for the controller. For applications, + # there is generally no reason to support multiple Python versions, so all + # actions are run with this version. Quote the version to avoid + # interpretation as a floating point number. + # + # The JupyterHub plugins use a separate matrix of versions because they have + # to work with the version of Python that is included in the JupyterHub + # images. + PYTHON_VERSION: "3.12" + "on": schedule: - cron: "0 12 * * 1" @@ -14,22 +25,17 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 - strategy: - matrix: - python: - - "3.12" - steps: - uses: actions/checkout@v4 - uses: lsst-sqre/run-nox@v1 with: nox-sessions: "update-deps typing test" - python-version: ${{ matrix.python }} + python-version: ${{ env.PYTHON_VERSION }} use-cache: false - name: Report status - if: always() + if: failed() uses: ravsamhq/notify-slack-action@v2 with: status: ${{ job.status }} @@ -38,7 +44,7 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }} - # The controller requires Python 3.11, but the modules we add to the Hub + # The controller requires Python 3.12, but the modules we add to the Hub # have to run with Python 3.10 since that's what the JupyterHub image uses. # Run a separate matrix to test those modules. test-hub: @@ -63,7 +69,7 @@ jobs: use-cache: false - name: Report status - if: always() + if: failure() uses: ravsamhq/notify-slack-action@v2 with: status: ${{ job.status }} @@ -71,3 +77,36 @@ jobs: notification_title: "Periodic test for {repo} failed" env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }} + + docs: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Update package lists + run: sudo apt-get update + + - name: Install extra packages + run: sudo apt install -y graphviz + + - uses: lsst-sqre/run-nox@v1 + with: + cache-dependency: "controller/requirements/*.txt" + cache-key-prefix: docs + nox-sessions: "docs docs-linkcheck" + python-version: ${{ env.PYTHON_VERSION }} + + - name: Report status + if: failure() + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + notify_when: "failure" + notification_title: "Periodic link check for {repo} failed" + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}