mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Cache the apt packages and the npm downloads in CI
AI Assisted
This commit is contained in:
1 parent
e23ef8b3ec
commit
7139d0340c
1 file changed
+30
-1
@@ -105,11 +105,29 @@ jobs:
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('plan2code-app/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ runner.os }}-
|
||||
- name: Name this week for the apt cache
|
||||
if: runner.os == 'Linux'
|
||||
id: week
|
||||
run: echo "week=$(date +%G-%V)" >> "$GITHUB_OUTPUT"
|
||||
- name: Cache the Linux system packages
|
||||
# The WebKit packages are hundreds of MB, and the runner's Ubuntu mirror is sometimes
|
||||
# slow (one download took 7 minutes), so keep the downloaded .deb files. The key rolls
|
||||
# over weekly so versions do not go stale; an older week still restores what it can.
|
||||
if: runner.os == 'Linux'
|
||||
uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: ~/apt-archives
|
||||
key: apt-tauri-${{ runner.os }}-${{ steps.week.outputs.week }}
|
||||
restore-keys: |
|
||||
apt-tauri-${{ runner.os }}-
|
||||
- name: Install Linux system packages
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
mkdir -p "$HOME/apt-archives/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev xvfb
|
||||
sudo apt-get -o Dir::Cache::archives="$HOME/apt-archives" install -y libwebkit2gtk-4.1-dev build-essential libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev xvfb
|
||||
# apt ran as root: hand the folder back so the cache step can read and save it.
|
||||
sudo chown -R "$(id -u):$(id -g)" "$HOME/apt-archives"
|
||||
- name: Install the app's packages
|
||||
run: npm ci
|
||||
- name: Vendor the xterm files cargo needs
|
||||
@@ -164,6 +182,17 @@ jobs:
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Cache the npm downloads
|
||||
# setup-node's own cache needs a tracked lockfile and the root has none, so cache npm's
|
||||
# download folder directly (both places it lives: Linux and macOS, then Windows).
|
||||
uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: |
|
||||
~/.npm
|
||||
~/AppData/Local/npm-cache
|
||||
key: npm-${{ runner.os }}-${{ hashFiles('package.json', 'plan2code-metrics/package.json') }}
|
||||
restore-keys: |
|
||||
npm-${{ runner.os }}-
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
- name: Metrics tests
|
||||
|
||||
Reference in new issue
Block a user