This commit is contained in:
Andrew Walsh 2026-10-21 20:06:26 +00:00 committed by GitHub
commit 07b80375f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 143 additions and 63 deletions

View file

@ -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

View file

@ -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"}'

View file

@ -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"}'

View file

@ -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"}'

View file

@ -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

View file

@ -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}"

10
.golangci.yml Normal file
View file

@ -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

View file

@ -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.

28
scripts/release/copy_tag.sh Executable file
View file

@ -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> <target tag>")
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}"

54
scripts/release/lib.sh Executable file
View file

@ -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}"
}

View file

@ -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 tag, e.g. v1.5.3>")
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

View file

@ -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())
}
}