Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/actions/install-ci-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Install Azure Linux CI dependencies
description: Restore and populate the Azure Linux package cache
description: Restore and populate the Azure Linux RPM and npm package caches

runs:
using: composite
steps:
- name: Configure package cache
- name: Configure RPM package cache
id: configure
shell: bash
run: |
Expand Down Expand Up @@ -73,7 +73,7 @@ runs:
echo "package-manager=$package_manager" >> "$GITHUB_OUTPUT"
echo "setup-script=$setup_script" >> "$GITHUB_OUTPUT"

- name: Restore package cache
- name: Restore RPM package cache
continue-on-error: true
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
Expand All @@ -83,6 +83,17 @@ runs:
azure-linux-${{ steps.configure.outputs.package-manager }}-rpms-${{ runner.arch }}-${{ hashFiles('scripts/setup-ci*.sh') }}-
azure-linux-${{ steps.configure.outputs.package-manager }}-rpms-${{ runner.arch }}-

- name: Restore npm package cache
continue-on-error: true
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: /github/home/.npm
key: azure-linux-npm-packages-${{ runner.arch }}-${{ hashFiles('**/package.json', 'scripts/prettier-checks.sh') }}-${{ github.job }}-${{ steps.configure.outputs.cache-week }}
restore-keys: |
azure-linux-npm-packages-${{ runner.arch }}-${{ hashFiles('**/package.json', 'scripts/prettier-checks.sh') }}-${{ github.job }}-
azure-linux-npm-packages-${{ runner.arch }}-${{ hashFiles('**/package.json', 'scripts/prettier-checks.sh') }}-
azure-linux-npm-packages-${{ runner.arch }}-

- name: Install dependencies
shell: bash
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Documents the various GitHub Actions workflows, the role they fulfill and 3rd pa

## Azure Linux CI dependencies

The local composite action in `.github/actions/install-ci-dependencies/action.yml` installs Azure Linux 3 and 4 CI dependencies and caches downloaded RPMs. Its cache key separates package managers and runner architectures, includes a hash of `scripts/setup-ci*.sh`, and includes the date of the most recent Sunday at midnight UTC. The weekly date makes GitHub Actions create a refreshed immutable cache each week.
The local composite action in `.github/actions/install-ci-dependencies/action.yml` installs Azure Linux 3 and 4 CI dependencies and caches downloaded RPM and npm packages. Cache keys separate runner architectures, hash the relevant dependency inputs, and include the date of the most recent Sunday at midnight UTC. The RPM key also separates package managers, while the npm key separates jobs so each job can save the packages it downloads. The weekly date makes GitHub Actions create refreshed immutable caches each week.

At a weekly rollover, restore keys first reuse the latest cache for the same dependency scripts and then fall back to any cache for the same package manager and architecture. The package manager refreshes repository metadata and downloads only missing or updated RPMs. `actions/cache` saves the populated directory automatically after a successful job when the exact weekly key was not restored.
At a weekly rollover, restore keys first reuse the latest cache for the same dependency inputs and then fall back to a compatible cache for the same architecture. The package managers refresh registry metadata and download only missing or updated packages. `actions/cache` saves each populated directory automatically after a successful job when the exact weekly key was not restored.

# Maintained

Expand Down
Loading