Browse Source
Use frozen lockfile and run build script tests in CI, make webfont builds reproducible (#1624)
pull/1626/head
Paweł Kuna
6 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
18 additions and
4 deletions
-
.github/workflows/build.yml
-
.github/workflows/validate-pr.yml
-
package.json
-
packages/icons-webfont/.build/utilities.mjs
|
|
|
@ -44,7 +44,16 @@ jobs: |
|
|
|
${{ runner.os }}-pnpm-store- |
|
|
|
|
|
|
|
- name: Install dependencies |
|
|
|
run: pnpm install --no-frozen-lockfile |
|
|
|
run: pnpm install --frozen-lockfile |
|
|
|
|
|
|
|
- name: Lint |
|
|
|
run: pnpm run lint |
|
|
|
|
|
|
|
- name: Check formatting |
|
|
|
run: pnpm run format:check |
|
|
|
|
|
|
|
- name: Test build scripts |
|
|
|
run: pnpm run test:build |
|
|
|
|
|
|
|
- name: Lint |
|
|
|
run: pnpm run lint |
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ jobs: |
|
|
|
${{ runner.os }}-pnpm-store- |
|
|
|
|
|
|
|
- name: Install dependencies |
|
|
|
run: pnpm install --no-frozen-lockfile |
|
|
|
run: pnpm install --frozen-lockfile |
|
|
|
|
|
|
|
- name: Validate icons |
|
|
|
id: validate |
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ |
|
|
|
"import": "node ./.build/import.mjs && pnpm run optimize", |
|
|
|
"import-tags": "node ./.build/import-tags.mjs", |
|
|
|
"import-categories": "node ./.build/import-categories.mjs", |
|
|
|
"generate-preview": "pnpm run preview-icons && pnpm run preview-stroke", |
|
|
|
"generate-preview": "pnpm run generate-preview-icons && pnpm run generate-preview-stroke", |
|
|
|
"generate-preview-icons": "node ./.build/preview-icons.mjs", |
|
|
|
"generate-preview-random-icons": "node ./.build/preview-random-icons.mjs", |
|
|
|
"generate-preview-stroke": "node ./.build/preview-stroke.mjs", |
|
|
|
|
|
|
|
@ -110,6 +110,11 @@ export function removeComments(svgBuffer) { |
|
|
|
return svgBuffer; |
|
|
|
} |
|
|
|
|
|
|
|
// svg2ttf stamps fonts with the current time by default, which makes every
|
|
|
|
// build produce different binaries. Use a fixed timestamp (overridable with
|
|
|
|
// SOURCE_DATE_EPOCH) so identical icons give identical font files.
|
|
|
|
const FONT_TIMESTAMP = process.env.SOURCE_DATE_EPOCH || 0; |
|
|
|
|
|
|
|
export function calculateHash(content) { |
|
|
|
return crypto.createHash('sha1').update(content).digest('hex'); |
|
|
|
} |
|
|
|
@ -120,7 +125,7 @@ export async function generateFont(strokeName, type, DIR) { |
|
|
|
path.join(DIR, `icons-${type === 'outline' ? `outlined/${strokeName}` : 'filled'}`), |
|
|
|
); |
|
|
|
const svgFontFileSource = await buildSvgFont(svgFiles); |
|
|
|
const ttfFile = Buffer.from(svg2ttf(svgFontFileSource).buffer); |
|
|
|
const ttfFile = Buffer.from(svg2ttf(svgFontFileSource, { ts: FONT_TIMESTAMP }).buffer); |
|
|
|
const woffFile = Buffer.from(ttf2woff(ttfFile).buffer); |
|
|
|
const woff2File = await wawoff2.compress(ttfFile); |
|
|
|
|
|
|
|
|