mirror of
https://github.com/zen-browser/www.git
synced 2025-07-07 17:05:32 +02:00
Merge ee79fbcf6e
into f9395041e1
This commit is contained in:
commit
eb94c99fd0
12 changed files with 781 additions and 570 deletions
119
.github/workflows/ci-pipeline.yml
vendored
119
.github/workflows/ci-pipeline.yml
vendored
|
@ -15,21 +15,21 @@ jobs:
|
|||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
exists: ${{ steps.filter.outputs.exists }}
|
||||
exists: ${{ steps.filter.outputs.relevant }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Filter changes
|
||||
uses: yumemi-inc/path-filter@v2
|
||||
uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
patterns: |
|
||||
**
|
||||
!**.md
|
||||
!.gitignore
|
||||
!.gitattributes
|
||||
!.vscode/**
|
||||
!.env.example
|
||||
filters: |
|
||||
relevant:
|
||||
- '!**.md'
|
||||
- '!.gitignore'
|
||||
- '!.gitattributes'
|
||||
- '!.vscode/**'
|
||||
- '!.env.example'
|
||||
|
||||
setup:
|
||||
name: Setup Dependencies
|
||||
|
@ -50,6 +50,7 @@ jobs:
|
|||
lookup-only: true
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
|
@ -80,8 +81,6 @@ jobs:
|
|||
name: Test
|
||||
- check: spell
|
||||
name: Spell Check
|
||||
- check: build
|
||||
name: Build
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
@ -119,22 +118,31 @@ jobs:
|
|||
- name: Run ${{ matrix.name }}
|
||||
run: pnpm exec turbo run ${{ matrix.check }}
|
||||
|
||||
playwright:
|
||||
name: Playwright Tests
|
||||
build:
|
||||
name: Build
|
||||
needs: [check_changes, setup]
|
||||
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Restore Turborepo Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: ${{ runner.os }}-turbo-
|
||||
key: ${{ runner.os }}-turbo-build-${{ github.sha }}
|
||||
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
|
||||
id: cache
|
||||
|
@ -160,23 +168,82 @@ jobs:
|
|||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
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
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: ${{ runner.os }}-playwright-
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-playwright-${{ github.sha }}
|
||||
restore-keys: ${{ runner.os }}-turbo-playwright-
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install --with-deps
|
||||
- name: Restore node_modules cache
|
||||
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
|
||||
run: pnpm exec turbo run test:playwright
|
||||
- name: Setup Node.js
|
||||
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
|
||||
- name: Upload Playwright Report
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 7
|
||||
|
||||
verify:
|
||||
name: Verify
|
||||
needs: [check_changes, quality_checks, playwright]
|
||||
needs: [check_changes, quality_checks, build, playwright]
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
outputs:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
"createdDefault",
|
||||
"createdDesc",
|
||||
"daniel",
|
||||
"dorny",
|
||||
"ferrocyante",
|
||||
"flatpaks",
|
||||
"FMPEG",
|
||||
|
@ -70,7 +71,6 @@
|
|||
"workerd",
|
||||
"xmark",
|
||||
"XPCOM",
|
||||
"yumemi",
|
||||
"zsync"
|
||||
],
|
||||
"flagWords": [],
|
||||
|
|
|
@ -4,6 +4,8 @@ pre-commit:
|
|||
prettier:
|
||||
priority: 1
|
||||
glob: "*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,d.ts,md,mdx,yaml,yml,json,html,css,astro}"
|
||||
exclude:
|
||||
- pnpm-lock.yaml
|
||||
run: |
|
||||
pnpm prettier {staged_files} --write --list-different
|
||||
stage_fixed: true
|
||||
|
@ -27,6 +29,7 @@ eslint:
|
|||
- dist/**
|
||||
- playwright-report/**
|
||||
- test-results/**
|
||||
- pnpm-lock.yaml
|
||||
run: |
|
||||
pnpm eslint {staged_files} --max-warnings=0 --fix --cache
|
||||
stage_fixed: true
|
||||
|
@ -35,6 +38,8 @@ cspell:
|
|||
commands:
|
||||
base:
|
||||
glob: "*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,d.ts,astro,json,yaml,yml,md,mdx}"
|
||||
exclude:
|
||||
- pnpm-lock.yaml
|
||||
run: |
|
||||
pnpm cspell {staged_files}
|
||||
stage_fixed: true
|
||||
|
|
10
package.json
10
package.json
|
@ -21,7 +21,12 @@
|
|||
"commitlint": "commitlint --edit",
|
||||
"test": "vitest run",
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -71,7 +76,7 @@
|
|||
"@eslint/compat": "1.2.9",
|
||||
"@eslint/eslintrc": "3.3.1",
|
||||
"@eslint/js": "9.27.0",
|
||||
"@playwright/test": "1.52.0",
|
||||
"@playwright/test": "1.53.1",
|
||||
"@testing-library/jest-dom": "6.6.3",
|
||||
"@testing-library/user-event": "14.6.1",
|
||||
"@types/animejs": "3.1.13",
|
||||
|
@ -93,6 +98,7 @@
|
|||
"eslint-plugin-react": "7.37.5",
|
||||
"eslint-plugin-react-hooks": "5.2.0",
|
||||
"jsdom": "26.1.0",
|
||||
"playwright": "1.53.1",
|
||||
"prettier": "3.5.3",
|
||||
"prettier-plugin-astro": "0.14.1",
|
||||
"prettier-plugin-tailwindcss": "0.6.11",
|
||||
|
|
|
@ -17,9 +17,8 @@ export default defineConfig({
|
|||
fullyParallel: true,
|
||||
forbidOnly: Boolean(process.env.CI),
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: 'html',
|
||||
reporter: process.env.CI ? [['github'], ['html']] : 'html',
|
||||
use: {
|
||||
baseURL: 'http://localhost:3000',
|
||||
trace: 'on-first-retry',
|
||||
|
@ -27,45 +26,32 @@ export default defineConfig({
|
|||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'webkit',
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
|
||||
/* Test against mobile viewports. */
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
// {
|
||||
// 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' },
|
||||
// },
|
||||
...(process.env.CI
|
||||
? [
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
{
|
||||
name: 'webkit',
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
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',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
|
|
1039
pnpm-lock.yaml
generated
1039
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,4 @@
|
|||
---
|
||||
import h3 from '~/components/Description.astro'
|
||||
import { getLocale, getUI } from '~/utils/i18n'
|
||||
|
||||
const locale = getLocale(Astro)
|
||||
|
|
|
@ -5,7 +5,6 @@ import Button from '../Button.astro'
|
|||
interface ReleaseInfo {
|
||||
label?: string
|
||||
link: string
|
||||
checksum?: string
|
||||
}
|
||||
|
||||
interface PlatformReleases {
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
import Description from '~/components/Description.astro'
|
||||
import DownloadScript from '~/components/download/DownloadScript.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 { getChecksums } from '~/utils/githubChecksums'
|
||||
import { getLocale, getUI } from '~/utils/i18n'
|
||||
|
||||
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 appleIcon = icon({ prefix: 'fab', iconName: 'apple' })
|
||||
|
||||
const checksums = await getChecksums()
|
||||
const releases = getReleasesWithChecksums(locale)(checksums)
|
||||
const releases = getReleases(locale)
|
||||
|
||||
const platformDescriptions = download.platformDescriptions
|
||||
---
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
import { expect, test } from '@playwright/test'
|
||||
|
||||
test('all routes do not return 404', async ({ page }) => {
|
||||
const routes = ['/', '/welcome', '/about', '/privacy-policy', '/download', '/donate', '/whatsnew']
|
||||
for (const route of routes) {
|
||||
const 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' })
|
||||
expect(response?.status()).not.toBe(404)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
36
turbo.json
36
turbo.json
|
@ -18,22 +18,48 @@
|
|||
},
|
||||
"build": {
|
||||
"cache": true,
|
||||
"inputs": ["src/**/*"],
|
||||
"outputs": ["dist/**"]
|
||||
},
|
||||
"test": {
|
||||
"cache": true,
|
||||
"inputs": ["**/*.{ts,tsx,js,jsx}"],
|
||||
"inputs": ["src/**/*"],
|
||||
"outputs": []
|
||||
},
|
||||
"spell": {
|
||||
"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": []
|
||||
},
|
||||
"test:playwright": {
|
||||
"test:e2e": {
|
||||
"cache": true,
|
||||
"dependsOn": ["build"],
|
||||
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
||||
"inputs": ["src/**/*"],
|
||||
"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/**"]
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue