From aca3fda0f512ad34da47e8cc94489e6b4d6fd004 Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Fri, 12 Jun 2026 09:44:43 +0200 Subject: [PATCH] chore: upgrade GitHub Actions to use latest versions of setup-python and checkout actions --- .../actions/ophyd_devices_install/action.yml | 6 +- .github/workflows/child_repos.yml | 23 ++- .github/workflows/device-list-update.yml | 146 +++++++++--------- .github/workflows/formatter.yml | 15 +- .github/workflows/pytest-matrix.yml | 13 +- .github/workflows/pytest.yml | 16 +- .github/workflows/semantic_release.yml | 4 +- 7 files changed, 109 insertions(+), 114 deletions(-) diff --git a/.github/actions/ophyd_devices_install/action.yml b/.github/actions/ophyd_devices_install/action.yml index 2dbb73e..a8a6cfe 100644 --- a/.github/actions/ophyd_devices_install/action.yml +++ b/.github/actions/ophyd_devices_install/action.yml @@ -18,19 +18,19 @@ runs: using: "composite" steps: - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ inputs.PYTHON_VERSION }} - name: Checkout BEC Core - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: bec-project/bec ref: ${{ inputs.BEC_CORE_BRANCH }} path: ./bec - name: Checkout Ophyd Devices - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: bec-project/ophyd_devices ref: ${{ inputs.OPHYD_DEVICES_BRANCH }} diff --git a/.github/workflows/child_repos.yml b/.github/workflows/child_repos.yml index 8ffab36..a63f94f 100644 --- a/.github/workflows/child_repos.yml +++ b/.github/workflows/child_repos.yml @@ -1,24 +1,23 @@ name: Run Pytest with Coverage -on: +on: workflow_call: inputs: BEC_CORE_BRANCH: - description: 'Branch for BEC Core' + description: "Branch for BEC Core" required: false - default: 'main' + default: "main" type: string OPHYD_DEVICES_BRANCH: - description: 'Branch for Ophyd Devices' + description: "Branch for Ophyd Devices" required: false - default: 'main' + default: "main" type: string BEC_WIDGETS_BRANCH: - description: 'Branch for BEC Widgets' + description: "Branch for BEC Widgets" required: false - default: 'main' + default: "main" type: string - jobs: bec: name: BEC Unit Tests @@ -29,7 +28,7 @@ jobs: steps: - name: Checkout BEC - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: bec-project/bec ref: ${{ inputs.BEC_CORE_BRANCH }} @@ -39,7 +38,7 @@ jobs: with: BEC_CORE_BRANCH: ${{ inputs.BEC_CORE_BRANCH }} OPHYD_DEVICES_BRANCH: ${{ inputs.OPHYD_DEVICES_BRANCH }} - PYTHON_VERSION: '3.11' + PYTHON_VERSION: "3.11" - name: Run Pytest run: | cd ./bec @@ -50,7 +49,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout BEC - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: bec-project/bec ref: ${{ inputs.BEC_CORE_BRANCH }} @@ -61,4 +60,4 @@ jobs: BEC_CORE_BRANCH: ${{ inputs.BEC_CORE_BRANCH }} OPHYD_DEVICES_BRANCH: ${{ inputs.OPHYD_DEVICES_BRANCH }} BEC_WIDGETS_BRANCH: ${{ inputs.BEC_WIDGETS_BRANCH }} - PYTHON_VERSION: '3.11' + PYTHON_VERSION: "3.11" diff --git a/.github/workflows/device-list-update.yml b/.github/workflows/device-list-update.yml index 8bce45e..26cb5b9 100644 --- a/.github/workflows/device-list-update.yml +++ b/.github/workflows/device-list-update.yml @@ -1,98 +1,98 @@ name: Update device list on: - push: - branches: - - main + push: + branches: + - main jobs: - device_list_update: - runs-on: ubuntu-latest - permissions: - contents: read - concurrency: - group: device-list-update-${{ github.ref_name }} - cancel-in-progress: true + device_list_update: + runs-on: ubuntu-latest + permissions: + contents: read + concurrency: + group: device-list-update-${{ github.ref_name }} + cancel-in-progress: true - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # required for git diff / reset - ssh-key: ${{ secrets.CI_DEPLOY_SSH_KEY }} - ssh-known-hosts: ${{ secrets.CI_DEPLOY_SSH_KNOWN_HOSTS }} + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 # required for git diff / reset + ssh-key: ${{ secrets.CI_DEPLOY_SSH_KEY }} + ssh-known-hosts: ${{ secrets.CI_DEPLOY_SSH_KNOWN_HOSTS }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" - - name: Setup | Force release branch to be at workflow sha - run: | - git reset --hard ${{ github.sha }} + - name: Setup | Force release branch to be at workflow sha + run: | + git reset --hard ${{ github.sha }} - - name: Evaluate | Verify upstream has NOT changed - shell: bash - run: | - set +o pipefail + - name: Evaluate | Verify upstream has NOT changed + shell: bash + run: | + set +o pipefail - UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)" - printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME" + UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)" + printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME" - set -o pipefail + set -o pipefail - if [ -z "$UPSTREAM_BRANCH_NAME" ]; then - printf >&2 '%s\n' "::error::Unable to determine upstream branch name!" - exit 1 - fi + if [ -z "$UPSTREAM_BRANCH_NAME" ]; then + printf >&2 '%s\n' "::error::Unable to determine upstream branch name!" + exit 1 + fi - git fetch "${UPSTREAM_BRANCH_NAME%%/*}" + git fetch "${UPSTREAM_BRANCH_NAME%%/*}" - if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then - printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!" - exit 1 - fi + if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then + printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!" + exit 1 + fi - HEAD_SHA="$(git rev-parse HEAD)" + HEAD_SHA="$(git rev-parse HEAD)" - if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then - printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]" - printf >&2 '%s\n' "::error::Upstream has changed, aborting release..." - exit 1 - fi + if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then + printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]" + printf >&2 '%s\n' "::error::Upstream has changed, aborting release..." + exit 1 + fi - printf '%s\n' "Verified upstream branch has not changed, continuing..." + printf '%s\n' "Verified upstream branch has not changed, continuing..." - - name: Install Python dependencies - run: | - pip install . + - name: Install Python dependencies + run: | + pip install . - - name: Generate device list - run: | - python .github/scripts/retrieve_device_classes.py \ - "ophyd_devices" \ - "./ophyd_devices/devices/device_list.md" \ - --ignore areadetector.plugins + - name: Generate device list + run: | + python .github/scripts/retrieve_device_classes.py \ + "ophyd_devices" \ + "./ophyd_devices/devices/device_list.md" \ + --ignore areadetector.plugins - - name: Commit and push if device list changed - run: | - FILE="./ophyd_devices/devices/device_list.md" + - name: Commit and push if device list changed + run: | + FILE="./ophyd_devices/devices/device_list.md" - if [ -f "$FILE" ]; then - git add "$FILE" + if [ -f "$FILE" ]; then + git add "$FILE" - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" - if ! git diff-index --quiet HEAD --; then - git commit -m "docs: Update device list" + if ! git diff-index --quiet HEAD --; then + git commit -m "docs: Update device list" - git push origin "${{ github.ref_name }}" + git push origin "${{ github.ref_name }}" - echo "Device list updated" - else - echo "No changes detected" - fi - else - echo "Device list file not found" - fi + echo "Device list updated" + else + echo "No changes detected" + fi + else + echo "Device list file not found" + fi diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 51c6216..8fb01be 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -1,16 +1,15 @@ name: Formatter and Pylint jobs on: [workflow_call] jobs: - Formatter: runs-on: ubuntu-latest steps: - name: Check out repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: '3.13' + python-version: "3.13" - name: Run black and isort run: | @@ -22,12 +21,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: '3.13' + python-version: "3.13" - name: Install dependencies run: | @@ -58,4 +57,4 @@ jobs: name: pylint-artifacts path: | # ./pylint/pylint.log # not sure why this isn't working - ./pylint/pylint.svg \ No newline at end of file + ./pylint/pylint.svg diff --git a/.github/workflows/pytest-matrix.yml b/.github/workflows/pytest-matrix.yml index 7ece5c5..ced4f0b 100644 --- a/.github/workflows/pytest-matrix.yml +++ b/.github/workflows/pytest-matrix.yml @@ -1,16 +1,16 @@ name: Run Pytest with different Python versions -on: +on: workflow_call: inputs: BEC_CORE_BRANCH: - description: 'Branch of BEC Core to install' + description: "Branch of BEC Core to install" required: false - default: 'main' + default: "main" type: string OPHYD_DEVICES_BRANCH: - description: 'Branch of Ophyd Devices to install' + description: "Branch of Ophyd Devices to install" required: false - default: 'main' + default: "main" type: string jobs: @@ -21,9 +21,8 @@ jobs: python-version: ["3.11", "3.12", "3.13"] steps: - - name: Checkout BEC Ophyd Devices - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: bec-project/ophyd_devices ref: ${{ inputs.OPHYD_DEVICES_BRANCH }} diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index d25e761..b31bf6c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,23 +1,21 @@ name: Run Pytest with Coverage -on: +on: workflow_call: inputs: BEC_CORE_BRANCH: - description: 'Branch of BEC Core to install' + description: "Branch of BEC Core to install" required: false - default: 'main' + default: "main" type: string OPHYD_DEVICES_BRANCH: - description: 'Branch of Ophyd Devices to install' + description: "Branch of Ophyd Devices to install" required: false - default: 'main' + default: "main" type: string secrets: CODECOV_TOKEN: required: true - - permissions: pull-requests: write @@ -27,7 +25,7 @@ jobs: steps: - name: Checkout Ophyd Devices - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: bec-project/ophyd_devices ref: ${{ inputs.OPHYD_DEVICES_BRANCH }} @@ -51,4 +49,4 @@ jobs: uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: bec-project/ophyd_devices \ No newline at end of file + slug: bec-project/ophyd_devices diff --git a/.github/workflows/semantic_release.yml b/.github/workflows/semantic_release.yml index 60f47d4..e9b5293 100644 --- a/.github/workflows/semantic_release.yml +++ b/.github/workflows/semantic_release.yml @@ -27,7 +27,7 @@ jobs: # possible that the branch was updated while the workflow was running. This # prevents accidentally releasing un-evaluated changes. - name: Setup | Checkout Repository on Release Branch - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: ${{ github.ref_name }} fetch-depth: 0 @@ -35,7 +35,7 @@ jobs: ssh-known-hosts: ${{ secrets.CI_DEPLOY_SSH_KNOWN_HOSTS }} - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.11"