From 438c39d8e6e2302ef1016993f8988947120f7917 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Mon, 19 Oct 2026 13:06:42 -0700 Subject: [PATCH 1/3] Remove dependency on cache-apt-pkgs-action-ci repo The action's own workflows (action-tests.yml) already run the same test jobs as the -ci repo, against the local checkout before merge, so the separate CI repo is redundant. - Remove the pub_{master,dev,staging}_push_event.yml workflows that dispatched events to the -ci repo (PUBLISH_PUSH_TOKEN secret can be deleted from repository settings). - Point the README test badges at action-tests.yml. - Port the release-tag tooling (moves the v1 and latest tags) from the -ci repo into scripts/release/ and add an update_release_tags workflow. Scripts now operate on the current clone instead of assuming a sibling checkout, run non-interactively when CI=true, and fix the target-tag validation bug in copy_tag.sh. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_0112vpMFQJc7Nz7FwE71r5do --- .github/workflows/pub_dev_push_event.yml | 19 ------- .github/workflows/pub_master_push_event.yml | 19 ------- .github/workflows/pub_staging_push_event.yml | 19 ------- .github/workflows/update_release_tags.yml | 29 +++++++++++ README.md | 4 +- scripts/release/copy_tag.sh | 28 ++++++++++ scripts/release/lib.sh | 54 ++++++++++++++++++++ scripts/release/update_release_tags.sh | 16 ++++++ 8 files changed, 129 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/pub_dev_push_event.yml delete mode 100644 .github/workflows/pub_master_push_event.yml delete mode 100644 .github/workflows/pub_staging_push_event.yml create mode 100644 .github/workflows/update_release_tags.yml create mode 100755 scripts/release/copy_tag.sh create mode 100755 scripts/release/lib.sh create mode 100755 scripts/release/update_release_tags.sh diff --git a/.github/workflows/pub_dev_push_event.yml b/.github/workflows/pub_dev_push_event.yml deleted file mode 100644 index 3600112..0000000 --- a/.github/workflows/pub_dev_push_event.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Dev Push Event -on: - workflow_dispatch: - push: - branches: - - dev - -jobs: - publish_event: - runs-on: ubuntu-latest - name: Publish dev push - steps: - - run: | - curl -i \ - -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.PUBLISH_PUSH_TOKEN }}" \ - https://api.github.com/repos/awalsh128/cache-apt-pkgs-action-ci/dispatches \ - -d '{"event_type":"dev_push"}' diff --git a/.github/workflows/pub_master_push_event.yml b/.github/workflows/pub_master_push_event.yml deleted file mode 100644 index 0339a05..0000000 --- a/.github/workflows/pub_master_push_event.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Master Push Event -on: - workflow_dispatch: - push: - branches: - - master - -jobs: - publish_event: - runs-on: ubuntu-latest - name: Publish master push - steps: - - run: | - curl -i \ - -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.PUBLISH_PUSH_TOKEN }}" \ - https://api.github.com/repos/awalsh128/cache-apt-pkgs-action-ci/dispatches \ - -d '{"event_type":"master_push"}' diff --git a/.github/workflows/pub_staging_push_event.yml b/.github/workflows/pub_staging_push_event.yml deleted file mode 100644 index 681c5cb..0000000 --- a/.github/workflows/pub_staging_push_event.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Staging Push Event -on: - workflow_dispatch: - push: - branches: - - staging - -jobs: - publish_event: - runs-on: ubuntu-latest - name: Publish staging push - steps: - - run: | - curl -i \ - -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.PUBLISH_PUSH_TOKEN }}" \ - https://api.github.com/repos/awalsh128/cache-apt-pkgs-action-ci/dispatches \ - -d '{"event_type":"staging_push"}' \ No newline at end of file diff --git a/.github/workflows/update_release_tags.yml b/.github/workflows/update_release_tags.yml new file mode 100644 index 0000000..0118a42 --- /dev/null +++ b/.github/workflows/update_release_tags.yml @@ -0,0 +1,29 @@ +name: Update Release Tags +on: + workflow_dispatch: + inputs: + version: + description: "Version tag to update to." + type: string + required: true + +permissions: + contents: write + +jobs: + update_release_tags: + runs-on: ubuntu-latest + name: Run update_release_tags.sh script. + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + - name: Configure git identity + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Update tags + env: + CI: "true" + VERSION: ${{ github.event.inputs.version }} + run: ./scripts/release/update_release_tags.sh "${VERSION}" diff --git a/README.md b/README.md index 0a20b42..eab8ef4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # cache-apt-pkgs-action [![License: Apache2](https://shields.io/badge/license-apache2-blue.svg)](https://github.com/awalsh128/fluentcpp/blob/master/LICENSE) -[![Master Test status](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/master_test.yml/badge.svg)](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/master_test.yml) -[![Dev Test status](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/dev_test.yml/badge.svg)](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/dev_test.yml) +[![Master Test status](https://github.com/awalsh128/cache-apt-pkgs-action/actions/workflows/action-tests.yml/badge.svg?branch=master)](https://github.com/awalsh128/cache-apt-pkgs-action/actions/workflows/action-tests.yml?query=branch%3Amaster) +[![Dev Test status](https://github.com/awalsh128/cache-apt-pkgs-action/actions/workflows/action-tests.yml/badge.svg?branch=dev)](https://github.com/awalsh128/cache-apt-pkgs-action/actions/workflows/action-tests.yml?query=branch%3Adev) This action allows caching of Advanced Package Tool (APT) package dependencies to improve workflow execution time instead of installing the packages on every run. diff --git a/scripts/release/copy_tag.sh b/scripts/release/copy_tag.sh new file mode 100755 index 0000000..efc7ccc --- /dev/null +++ b/scripts/release/copy_tag.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Point a (moving) tag, e.g. v1 or latest, at the commit of another tag. +# Run from anywhere inside a clone of this repository. + +set -euo pipefail + +# shellcheck source=lib.sh +source "$(dirname -- "$(realpath -- "${0}")")/lib.sh" +usage_msg=$(usage "${0}" " ") + +source_tag="${1:-}" +validate_arg "${source_tag}" "Source tag arg must be non-empty." "${usage_msg}" + +target_tag="${2:-}" +validate_arg "${target_tag}" "Target tag arg must be non-empty." "${usage_msg}" + +cd "$(git rev-parse --show-toplevel)" +git fetch origin --tags --force + +if ! git rev-parse --verify --quiet "refs/tags/${source_tag}" > /dev/null; then + echo "error: source tag '${source_tag}' does not exist." >&2 + exit 1 +fi + +confirm_prompt "Do you want to update '${target_tag}' from '${source_tag}'?" + +git tag -fa "${target_tag}" -m "Points ${target_tag} to ${source_tag}." "${source_tag}^{commit}" +git push --force origin "refs/tags/${target_tag}" diff --git a/scripts/release/lib.sh b/scripts/release/lib.sh new file mode 100755 index 0000000..4e35454 --- /dev/null +++ b/scripts/release/lib.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Shared helpers for the release scripts in this directory. +# Source this file; do not execute it directly. + +####################################### +# Yes or no prompt. Auto-confirms when CI=true or ASSUME_YES=1 so the +# scripts can also run from a GitHub workflow. +# Arguments: +# Message to display at prompt. +# Returns: +# 0 on yes, exits the script on no. +####################################### +function confirm_prompt { + if [[ "${CI:-}" == "true" || "${ASSUME_YES:-}" == "1" ]]; then + echo "${1} [auto-confirmed]" + return 0 + fi + while true; do + read -r -p "${1} [Y|n] " response + case ${response} in + [Yy]*) return 0 ;; + [Nn]*) exit 0 ;; + *) echo "Invalid option selected." ;; + esac + done +} + +####################################### +# Validate argument and exit if invalid. +# Arguments: +# Argument to validate. +# Message to display on error. +# Usage message. +# Returns: +# None, exits non-zero when the argument is empty. +####################################### +function validate_arg { + if [[ -z "${1:-}" ]]; then + printf 'error: %s\n%s\n' "${2}" "${3}" >&2 + exit 1 + fi +} + +####################################### +# Print out command usage. +# Arguments: +# Name of command. +# Parameters. +# Returns: +# Usage message. +####################################### +function usage { + echo "usage: $(basename "${1}") ${2}" +} diff --git a/scripts/release/update_release_tags.sh b/scripts/release/update_release_tags.sh new file mode 100755 index 0000000..bcc7be8 --- /dev/null +++ b/scripts/release/update_release_tags.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Move the floating release tags (v1 and latest) to a released version tag. +# Run from anywhere inside a clone of this repository. + +set -euo pipefail + +script_dir="$(dirname -- "$(realpath -- "${0}")")" +# shellcheck source=lib.sh +source "${script_dir}/lib.sh" +usage_msg=$(usage "${0}" "") + +version="${1:-}" +validate_arg "${version}" "Version tag arg must be non-empty." "${usage_msg}" + +"${script_dir}/copy_tag.sh" "${version}" v1 +"${script_dir}/copy_tag.sh" "${version}" latest From 3c1d213e955c63f3dfa27c158bbc125215b75947 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Wed, 21 Oct 2026 12:59:39 -0700 Subject: [PATCH 2/3] Upgrade golangci-lint to v2 for golangci-lint-action v9 golangci-lint-action >= v7 rejects golangci-lint v1, so the Lint step failed before installing. Move to golangci-lint v2.14.0 and add a v2 config that keeps the default exclusions v1 applied implicitly. Fix the one new staticcheck QF1008 finding. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/pull_request.yml | 2 +- .golangci.yml | 10 ++++++++++ src/internal/cmdtesting/cmdtesting.go | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 802865f..e837bac 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -26,4 +26,4 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@d583c34f0599d37dbac4a198b9c83201be380893 # v9.3.0 with: - version: v1.52.2 + version: v2.14.0 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..9c585f7 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,10 @@ +version: "2" + +linters: + exclusions: + # Keep the default exclusions that golangci-lint v1 applied implicitly. + presets: + - comments + - common-false-positives + - legacy + - std-error-handling diff --git a/src/internal/cmdtesting/cmdtesting.go b/src/internal/cmdtesting/cmdtesting.go index 4b6555c..afebbbe 100644 --- a/src/internal/cmdtesting/cmdtesting.go +++ b/src/internal/cmdtesting/cmdtesting.go @@ -55,7 +55,7 @@ func (t *CmdTesting) Run(command string, pkgNames ...string) RunResult { if t.createReplayLogs { err := common.AppendFile(binaryName+".log", t.replayFilename) if err != nil { - t.T.Fatalf("Error encountered appending log file.\n%s", err.Error()) + t.Fatalf("Error encountered appending log file.\n%s", err.Error()) } } From 60f71d22c8a7fbb2931fa53eb1f12a929bd8c7b0 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Wed, 21 Oct 2026 13:06:20 -0700 Subject: [PATCH 3/3] Update expected gir1.2-gdkpixbuf-2.0 version in action tests Co-Authored-By: Claude Opus 5.5 --- .github/workflows/action-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action-tests.yml b/.github/workflows/action-tests.yml index 86cb1c0..b34d352 100644 --- a/.github/workflows/action-tests.yml +++ b/.github/workflows/action-tests.yml @@ -54,13 +54,13 @@ jobs: - name: Verify if: | steps.execute.outputs.cache-hit != 'false' || - steps.execute.outputs.all-package-version-list != 'fonts-liberation2=1:2.1.5-3,gir1.2-atk-1.0=2.52.0-1build1,gir1.2-freedesktop=1.80.1-1,gir1.2-gdkpixbuf-2.0=2.42.10+dfsg-3ubuntu3.2,gir1.2-gtk-3.0=3.24.41-4ubuntu1.3,gir1.2-harfbuzz-0.0=8.3.0-2build2,gir1.2-pango-1.0=1.52.1+ds-1build1,graphviz=2.42.2-9ubuntu0.1,libann0=1.1.2+doc-9build1,libblas3=3.12.0-3build1.1,libcdt5=2.42.2-9ubuntu0.1,libcgraph6=2.42.2-9ubuntu0.1,libgts-0.7-5t64=0.7.6+darcs121130-5.2build1,libgts-bin=0.7.6+darcs121130-5.2build1,libgvc6=2.42.2-9ubuntu0.1,libgvpr2=2.42.2-9ubuntu0.1,libharfbuzz-gobject0=8.3.0-2build2,liblab-gamut1=2.42.2-9ubuntu0.1,liblapack3=3.12.0-3build1.1,libpangoxft-1.0-0=1.52.1+ds-1build1,libpathplan4=2.42.2-9ubuntu0.1,python3-cairo=1.25.1-2build2,python3-gi-cairo=3.48.2-1,python3-numpy=1:1.26.4+ds-6ubuntu1,xdot=1.3-1' + steps.execute.outputs.all-package-version-list != 'fonts-liberation2=1:2.1.5-3,gir1.2-atk-1.0=2.52.0-1build1,gir1.2-freedesktop=1.80.1-1,gir1.2-gdkpixbuf-2.0=2.42.10+dfsg-3ubuntu3.3,gir1.2-gtk-3.0=3.24.41-4ubuntu1.3,gir1.2-harfbuzz-0.0=8.3.0-2build2,gir1.2-pango-1.0=1.52.1+ds-1build1,graphviz=2.42.2-9ubuntu0.1,libann0=1.1.2+doc-9build1,libblas3=3.12.0-3build1.1,libcdt5=2.42.2-9ubuntu0.1,libcgraph6=2.42.2-9ubuntu0.1,libgts-0.7-5t64=0.7.6+darcs121130-5.2build1,libgts-bin=0.7.6+darcs121130-5.2build1,libgvc6=2.42.2-9ubuntu0.1,libgvpr2=2.42.2-9ubuntu0.1,libharfbuzz-gobject0=8.3.0-2build2,liblab-gamut1=2.42.2-9ubuntu0.1,liblapack3=3.12.0-3build1.1,libpangoxft-1.0-0=1.52.1+ds-1build1,libpathplan4=2.42.2-9ubuntu0.1,python3-cairo=1.25.1-2build2,python3-gi-cairo=3.48.2-1,python3-numpy=1:1.26.4+ds-6ubuntu1,xdot=1.3-1' run: | echo "cache-hit = ${{ steps.execute.outputs.cache-hit }}" echo "package-version-list = ${{ steps.execute.outputs.package-version-list }}" echo "all-package-version-list = ${{ steps.execute.outputs.all-package-version-list }}" echo "diff all-package-version-list" - diff <(echo "${{ steps.execute.outputs.all-package-version-list }}" ) <(echo "fonts-liberation2=1:2.1.5-3,gir1.2-atk-1.0=2.52.0-1build1,gir1.2-freedesktop=1.80.1-1,gir1.2-gdkpixbuf-2.0=2.42.10+dfsg-3ubuntu3.2,gir1.2-gtk-3.0=3.24.41-4ubuntu1.3,gir1.2-harfbuzz-0.0=8.3.0-2build2,gir1.2-pango-1.0=1.52.1+ds-1build1,graphviz=2.42.2-9ubuntu0.1,libann0=1.1.2+doc-9build1,libblas3=3.12.0-3build1.1,libcdt5=2.42.2-9ubuntu0.1,libcgraph6=2.42.2-9ubuntu0.1,libgts-0.7-5t64=0.7.6+darcs121130-5.2build1,libgts-bin=0.7.6+darcs121130-5.2build1,libgvc6=2.42.2-9ubuntu0.1,libgvpr2=2.42.2-9ubuntu0.1,libharfbuzz-gobject0=8.3.0-2build2,liblab-gamut1=2.42.2-9ubuntu0.1,liblapack3=3.12.0-3build1.1,libpangoxft-1.0-0=1.52.1+ds-1build1,libpathplan4=2.42.2-9ubuntu0.1,python3-cairo=1.25.1-2build2,python3-gi-cairo=3.48.2-1,python3-numpy=1:1.26.4+ds-6ubuntu1,xdot=1.3-1") + diff <(echo "${{ steps.execute.outputs.all-package-version-list }}" ) <(echo "fonts-liberation2=1:2.1.5-3,gir1.2-atk-1.0=2.52.0-1build1,gir1.2-freedesktop=1.80.1-1,gir1.2-gdkpixbuf-2.0=2.42.10+dfsg-3ubuntu3.3,gir1.2-gtk-3.0=3.24.41-4ubuntu1.3,gir1.2-harfbuzz-0.0=8.3.0-2build2,gir1.2-pango-1.0=1.52.1+ds-1build1,graphviz=2.42.2-9ubuntu0.1,libann0=1.1.2+doc-9build1,libblas3=3.12.0-3build1.1,libcdt5=2.42.2-9ubuntu0.1,libcgraph6=2.42.2-9ubuntu0.1,libgts-0.7-5t64=0.7.6+darcs121130-5.2build1,libgts-bin=0.7.6+darcs121130-5.2build1,libgvc6=2.42.2-9ubuntu0.1,libgvpr2=2.42.2-9ubuntu0.1,libharfbuzz-gobject0=8.3.0-2build2,liblab-gamut1=2.42.2-9ubuntu0.1,liblapack3=3.12.0-3build1.1,libpangoxft-1.0-0=1.52.1+ds-1build1,libpathplan4=2.42.2-9ubuntu0.1,python3-cairo=1.25.1-2build2,python3-gi-cairo=3.48.2-1,python3-numpy=1:1.26.4+ds-6ubuntu1,xdot=1.3-1") exit 1 shell: bash