This commit is contained in:
Shintaro Jokagi 2025-06-22 19:40:02 +12:00 committed by GitHub
commit eb94c99fd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 781 additions and 570 deletions

View file

@ -15,21 +15,21 @@ jobs:
permissions: permissions:
contents: read contents: read
outputs: outputs:
exists: ${{ steps.filter.outputs.exists }} exists: ${{ steps.filter.outputs.relevant }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Filter changes - name: Filter changes
uses: yumemi-inc/path-filter@v2 uses: dorny/paths-filter@v3
id: filter id: filter
with: with:
patterns: | filters: |
** relevant:
!**.md - '!**.md'
!.gitignore - '!.gitignore'
!.gitattributes - '!.gitattributes'
!.vscode/** - '!.vscode/**'
!.env.example - '!.env.example'
setup: setup:
name: Setup Dependencies name: Setup Dependencies
@ -50,6 +50,7 @@ jobs:
lookup-only: true lookup-only: true
- name: Setup Node.js - name: Setup Node.js
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: lts/* node-version: lts/*
@ -80,8 +81,6 @@ jobs:
name: Test name: Test
- check: spell - check: spell
name: Spell Check name: Spell Check
- check: build
name: Build
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -119,22 +118,31 @@ jobs:
- name: Run ${{ matrix.name }} - name: Run ${{ matrix.name }}
run: pnpm exec turbo run ${{ matrix.check }} run: pnpm exec turbo run ${{ matrix.check }}
playwright: build:
name: Playwright Tests name: Build
needs: [check_changes, setup] needs: [check_changes, setup]
if: ${{ needs.check_changes.outputs.exists == 'true' }} if: ${{ needs.check_changes.outputs.exists == 'true' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore Turborepo Cache - name: Restore Turborepo Cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: .turbo path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }} key: ${{ runner.os }}-turbo-build-${{ github.sha }}
restore-keys: ${{ runner.os }}-turbo- restore-keys: ${{ runner.os }}-turbo-build-
- name: Restore Astro Cache
uses: actions/cache@v4
with:
path: |
.astro
node_modules/.astro
key: ${{ runner.os }}-astro-${{ hashFiles('**/pnpm-lock.yaml', 'src/**', 'public/**', 'astro.config.mjs') }}
restore-keys: |
${{ runner.os }}-astro-${{ hashFiles('**/pnpm-lock.yaml') }}-
${{ runner.os }}-astro-
- name: Restore node_modules cache - name: Restore node_modules cache
id: cache id: cache
@ -160,23 +168,82 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Cache Playwright Browsers - name: Build project
run: pnpm exec turbo run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 1
playwright:
name: Playwright Tests
needs: [check_changes, setup, build]
if: ${{ needs.check_changes.outputs.exists == 'true' }}
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.53.1-jammy
env:
CI: true
steps:
- uses: actions/checkout@v4
- name: Configure Git safe directory
run: git config --global --add safe.directory /__w/www/www
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Restore Turborepo Cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.cache/ms-playwright path: .turbo
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-turbo-playwright-${{ github.sha }}
restore-keys: ${{ runner.os }}-playwright- restore-keys: ${{ runner.os }}-turbo-playwright-
- name: Install Playwright Browsers - name: Restore node_modules cache
run: pnpm exec playwright install --with-deps id: cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node-modules-
- name: Run Playwright Tests - name: Setup Node.js
run: pnpm exec turbo run test:playwright uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
- name: Run Playwright Tests (4 Shards)
run: pnpm exec turbo run test:e2e:all
timeout-minutes: 10 timeout-minutes: 10
- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7
verify: verify:
name: Verify name: Verify
needs: [check_changes, quality_checks, playwright] needs: [check_changes, quality_checks, build, playwright]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: always() if: always()
outputs: outputs:

View file

@ -18,6 +18,7 @@
"createdDefault", "createdDefault",
"createdDesc", "createdDesc",
"daniel", "daniel",
"dorny",
"ferrocyante", "ferrocyante",
"flatpaks", "flatpaks",
"FMPEG", "FMPEG",
@ -70,7 +71,6 @@
"workerd", "workerd",
"xmark", "xmark",
"XPCOM", "XPCOM",
"yumemi",
"zsync" "zsync"
], ],
"flagWords": [], "flagWords": [],

View file

@ -4,6 +4,8 @@ pre-commit:
prettier: prettier:
priority: 1 priority: 1
glob: "*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,d.ts,md,mdx,yaml,yml,json,html,css,astro}" glob: "*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,d.ts,md,mdx,yaml,yml,json,html,css,astro}"
exclude:
- pnpm-lock.yaml
run: | run: |
pnpm prettier {staged_files} --write --list-different pnpm prettier {staged_files} --write --list-different
stage_fixed: true stage_fixed: true
@ -27,6 +29,7 @@ eslint:
- dist/** - dist/**
- playwright-report/** - playwright-report/**
- test-results/** - test-results/**
- pnpm-lock.yaml
run: | run: |
pnpm eslint {staged_files} --max-warnings=0 --fix --cache pnpm eslint {staged_files} --max-warnings=0 --fix --cache
stage_fixed: true stage_fixed: true
@ -35,6 +38,8 @@ cspell:
commands: commands:
base: base:
glob: "*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,d.ts,astro,json,yaml,yml,md,mdx}" glob: "*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,d.ts,astro,json,yaml,yml,md,mdx}"
exclude:
- pnpm-lock.yaml
run: | run: |
pnpm cspell {staged_files} pnpm cspell {staged_files}
stage_fixed: true stage_fixed: true

View file

@ -21,7 +21,12 @@
"commitlint": "commitlint --edit", "commitlint": "commitlint --edit",
"test": "vitest run", "test": "vitest run",
"test:coverage": "vitest --coverage", "test:coverage": "vitest --coverage",
"test:playwright": "playwright test --reporter=list", "test:e2e": "playwright test",
"test:e2e:shard1": "playwright test --shard=1/4",
"test:e2e:shard2": "playwright test --shard=2/4",
"test:e2e:shard3": "playwright test --shard=3/4",
"test:e2e:shard4": "playwright test --shard=4/4",
"test:e2e:all": "turbo run test:e2e:all",
"prepare": "lefthook install" "prepare": "lefthook install"
}, },
"dependencies": { "dependencies": {
@ -71,7 +76,7 @@
"@eslint/compat": "1.2.9", "@eslint/compat": "1.2.9",
"@eslint/eslintrc": "3.3.1", "@eslint/eslintrc": "3.3.1",
"@eslint/js": "9.27.0", "@eslint/js": "9.27.0",
"@playwright/test": "1.52.0", "@playwright/test": "1.53.1",
"@testing-library/jest-dom": "6.6.3", "@testing-library/jest-dom": "6.6.3",
"@testing-library/user-event": "14.6.1", "@testing-library/user-event": "14.6.1",
"@types/animejs": "3.1.13", "@types/animejs": "3.1.13",
@ -93,6 +98,7 @@
"eslint-plugin-react": "7.37.5", "eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0", "eslint-plugin-react-hooks": "5.2.0",
"jsdom": "26.1.0", "jsdom": "26.1.0",
"playwright": "1.53.1",
"prettier": "3.5.3", "prettier": "3.5.3",
"prettier-plugin-astro": "0.14.1", "prettier-plugin-astro": "0.14.1",
"prettier-plugin-tailwindcss": "0.6.11", "prettier-plugin-tailwindcss": "0.6.11",

View file

@ -17,9 +17,8 @@ export default defineConfig({
fullyParallel: true, fullyParallel: true,
forbidOnly: Boolean(process.env.CI), forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0, retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined, workers: process.env.CI ? 1 : undefined,
reporter: 'html', reporter: process.env.CI ? [['github'], ['html']] : 'html',
use: { use: {
baseURL: 'http://localhost:3000', baseURL: 'http://localhost:3000',
trace: 'on-first-retry', trace: 'on-first-retry',
@ -27,45 +26,32 @@ export default defineConfig({
/* Configure projects for major browsers */ /* Configure projects for major browsers */
projects: [ projects: [
{ ...(process.env.CI
name: 'chromium', ? [
use: { ...devices['Desktop Chrome'] }, {
}, name: 'firefox',
use: { ...devices['Desktop Firefox'] },
{ },
name: 'firefox', ]
use: { ...devices['Desktop Firefox'] }, : [
}, {
name: 'chromium',
{ use: { ...devices['Desktop Chrome'] },
name: 'webkit', },
use: { ...devices['Desktop Safari'] }, {
}, name: 'firefox',
use: { ...devices['Desktop Firefox'] },
/* Test against mobile viewports. */ },
// { {
// name: 'Mobile Chrome', name: 'webkit',
// use: { ...devices['Pixel 5'] }, use: { ...devices['Desktop Safari'] },
// }, },
// { ]),
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
], ],
/* Run your local dev server before starting the tests */ /* Run your local dev server before starting the tests */
webServer: { webServer: {
command: process.env.CI ? 'npm run start' : 'npm run dev', command: process.env.CI ? 'pnpm run start' : 'pnpm run dev',
url: 'http://localhost:3000', url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },

1039
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,4 @@
--- ---
import h3 from '~/components/Description.astro'
import { getLocale, getUI } from '~/utils/i18n' import { getLocale, getUI } from '~/utils/i18n'
const locale = getLocale(Astro) const locale = getLocale(Astro)

View file

@ -5,7 +5,6 @@ import Button from '../Button.astro'
interface ReleaseInfo { interface ReleaseInfo {
label?: string label?: string
link: string link: string
checksum?: string
} }
interface PlatformReleases { interface PlatformReleases {

View file

@ -59,3 +59,55 @@ export function getReleasesWithChecksums(locale: string) {
} }
} }
} }
/**
* Returns the releases object, without checksums.
* @param locale The locale to use for labels
*/
export function getReleases(locale: string) {
const {
routes: {
download: {
links: { macos, windows, linux },
},
},
} = getUI(locale)
return {
macos: {
universal: {
link: 'https://github.com/zen-browser/desktop/releases/latest/download/zen.macos-universal.dmg',
label: macos.universal,
},
},
windows: {
x86_64: {
link: 'https://github.com/zen-browser/desktop/releases/latest/download/zen.installer.exe',
label: windows['64bit'],
},
arm64: {
link: 'https://github.com/zen-browser/desktop/releases/latest/download/zen.installer-arm64.exe',
label: windows.ARM64,
},
},
linux: {
x86_64: {
tarball: {
link: 'https://github.com/zen-browser/desktop/releases/latest/download/zen.linux-x86_64.tar.xz',
label: linux.x86_64,
},
},
aarch64: {
tarball: {
link: 'https://github.com/zen-browser/desktop/releases/latest/download/zen.linux-aarch64.tar.xz',
label: linux.aarch64,
},
},
flathub: {
all: {
link: 'https://flathub.org/apps/app.zen_browser.zen',
label: linux.flathub,
},
},
},
}
}

View file

@ -2,9 +2,8 @@
import Description from '~/components/Description.astro' import Description from '~/components/Description.astro'
import DownloadScript from '~/components/download/DownloadScript.astro' import DownloadScript from '~/components/download/DownloadScript.astro'
import PlatformDownload from '~/components/download/PlatformDownload.astro' import PlatformDownload from '~/components/download/PlatformDownload.astro'
import { getReleasesWithChecksums } from '~/components/download/release-data' import { getReleases } from '~/components/download/release-data'
import Layout from '~/layouts/Layout.astro' import Layout from '~/layouts/Layout.astro'
import { getChecksums } from '~/utils/githubChecksums'
import { getLocale, getUI } from '~/utils/i18n' import { getLocale, getUI } from '~/utils/i18n'
import { icon, library } from '@fortawesome/fontawesome-svg-core' import { icon, library } from '@fortawesome/fontawesome-svg-core'
@ -27,8 +26,7 @@ const windowsIcon = icon({ prefix: 'fab', iconName: 'windows' })
const linuxIcon = icon({ prefix: 'fab', iconName: 'linux' }) const linuxIcon = icon({ prefix: 'fab', iconName: 'linux' })
const appleIcon = icon({ prefix: 'fab', iconName: 'apple' }) const appleIcon = icon({ prefix: 'fab', iconName: 'apple' })
const checksums = await getChecksums() const releases = getReleases(locale)
const releases = getReleasesWithChecksums(locale)(checksums)
const platformDescriptions = download.platformDescriptions const platformDescriptions = download.platformDescriptions
--- ---

View file

@ -1,9 +1,21 @@
import { expect, test } from '@playwright/test' import { expect, test } from '@playwright/test'
test('all routes do not return 404', async ({ page }) => { const routes = [
const routes = ['/', '/welcome', '/about', '/privacy-policy', '/download', '/donate', '/whatsnew'] '/',
for (const route of routes) { '/welcome',
'/about',
'/privacy-policy',
'/download',
'/donate',
'/whatsnew',
'/mods',
'/release-notes',
'/feed.xml',
]
routes.forEach(route => {
test(`route ${route} does not return 404`, async ({ page }) => {
const response = await page.goto(route, { waitUntil: 'domcontentloaded' }) const response = await page.goto(route, { waitUntil: 'domcontentloaded' })
expect(response?.status()).not.toBe(404) expect(response?.status()).not.toBe(404)
} })
}) })

View file

@ -18,22 +18,48 @@
}, },
"build": { "build": {
"cache": true, "cache": true,
"inputs": ["src/**/*"],
"outputs": ["dist/**"] "outputs": ["dist/**"]
}, },
"test": { "test": {
"cache": true, "cache": true,
"inputs": ["**/*.{ts,tsx,js,jsx}"], "inputs": ["src/**/*"],
"outputs": [] "outputs": []
}, },
"spell": { "spell": {
"cache": true, "cache": true,
"inputs": ["src/**/*.{ts,tsx,js,jsx,astro,md,json,yml,yaml}"], "inputs": ["src/**/*.{ts,tsx,js,jsx,astro,md,json,yml,yaml,yml}"],
"outputs": [] "outputs": []
}, },
"test:playwright": { "test:e2e": {
"cache": true, "cache": true,
"dependsOn": ["build"], "inputs": ["src/**/*"],
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"], "outputs": ["playwright-report/**", "test-results/**"]
},
"test:e2e:shard1": {
"cache": true,
"inputs": ["src/**/*"],
"outputs": ["playwright-report/**", "test-results/**"]
},
"test:e2e:shard2": {
"cache": true,
"inputs": ["src/**/*"],
"outputs": ["playwright-report/**", "test-results/**"]
},
"test:e2e:shard3": {
"cache": true,
"inputs": ["src/**/*"],
"outputs": ["playwright-report/**", "test-results/**"]
},
"test:e2e:shard4": {
"cache": true,
"inputs": ["src/**/*"],
"outputs": ["playwright-report/**", "test-results/**"]
},
"test:e2e:all": {
"cache": true,
"dependsOn": ["test:e2e:shard1", "test:e2e:shard2", "test:e2e:shard3", "test:e2e:shard4"],
"inputs": ["src/**/*"],
"outputs": ["playwright-report/**", "test-results/**"] "outputs": ["playwright-report/**", "test-results/**"]
} }
}, },