Skip to content
Merged
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
60 changes: 60 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Install dependencies
description: Install a version-pinned, checksum-verified Socket Firewall (sfw) and run `bun install` through it.

# Requires Bun to be set up beforehand (oven-sh/setup-bun).
# Socket Firewall Free (https://socket.dev/features/firewall) blocks malicious
# packages while installing. The binary is ~130 MB, so it is cached per version + checksum. Bump
# SFW_VERSION and SFW_SHA256 together (sha256 is shown as the asset digest
# on https://github.com/SocketDev/sfw-free/releases). Linux x86_64 only.
runs:
using: composite
steps:
- name: Resolve Socket Firewall version
id: sfw
shell: bash
env:
SFW_VERSION: v1.16.0
SFW_SHA256: 1f24d2628aeb3995f1f2651509e37641c7c41d07749ac68594ecb5bb2dd44d8a
run: |
set -euo pipefail
{
echo "version=${SFW_VERSION}"
echo "sha256=${SFW_SHA256}"
echo "dir=${RUNNER_TOOL_CACHE}/sfw/${SFW_VERSION}"
} >> "$GITHUB_OUTPUT"

- name: Restore Socket Firewall from cache
id: sfw-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.sfw.outputs.dir }}
key: sfw-${{ runner.os }}-${{ runner.arch }}-${{ steps.sfw.outputs.version }}-${{ steps.sfw.outputs.sha256 }}

- name: Download Socket Firewall
if: steps.sfw-cache.outputs.cache-hit != 'true'
shell: bash
env:
SFW_VERSION: ${{ steps.sfw.outputs.version }}
SFW_SHA256: ${{ steps.sfw.outputs.sha256 }}
SFW_DIR: ${{ steps.sfw.outputs.dir }}
run: |
set -euo pipefail
mkdir -p "$SFW_DIR"
curl -fsSL -o "$SFW_DIR/sfw" "https://github.com/SocketDev/sfw-free/releases/download/${SFW_VERSION}/sfw-free-linux-x86_64"
echo "${SFW_SHA256} $SFW_DIR/sfw" | sha256sum -c -
chmod +x "$SFW_DIR/sfw"

- name: Add Socket Firewall to PATH
shell: bash
env:
SFW_SHA256: ${{ steps.sfw.outputs.sha256 }}
SFW_DIR: ${{ steps.sfw.outputs.dir }}
run: |
set -euo pipefail
# Re-verify on cache hits too, so a poisoned cache entry cannot run.
echo "${SFW_SHA256} $SFW_DIR/sfw" | sha256sum -c -
echo "$SFW_DIR" >> "$GITHUB_PATH"

- name: Install dependencies
shell: bash
run: sfw bun install --frozen-lockfile
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- run: bun install --frozen-lockfile
- uses: ./.github/actions/install-deps

# e2e/builder.spec.js drives the Image Builder page in a browser, so install Chromium.
- run: bunx playwright install --with-deps chromium
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- run: bun install --frozen-lockfile
- uses: ./.github/actions/install-deps

- run: bun run build

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- run: bun install --frozen-lockfile
- uses: ./.github/actions/install-deps

- run: bun run test
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "node build.js",
"readme": "node scripts/readme.js && bun fmt readme.md",
"dev": "npm run build && wrangler dev index.js --name it-icons --compatibility-date 2026-11-01",
"deploy": "npm run test:e2e && npm run build && wrangler deploy index.js --name it-icons --compatibility-date 2026-11-01",
"prepare": "husky",
"build": "bun build.js",
"readme": "bun scripts/readme.js && bun fmt readme.md",
"dev": "bun run build && wrangler dev index.js --name it-icons --compatibility-date 2026-11-01",
"deploy": "bun run test:e2e && bun run build && wrangler deploy index.js --name it-icons --compatibility-date 2026-11-01",
"test": "bun run build && bun test",
"test:e2e": "playwright test"
},
"devDependencies": {
"@playwright/test": "^1.65.1",
"husky": "^9.1.7",
"valibot": "^1.5.0",
"wrangler": "^4"
}
Expand Down
Loading