mirror of
https://github.com/zen-browser/www
synced 2026-04-25 17:14:56 +02:00
chore(ci): enhance CI pipeline with playwright container and adjust job dependencies (#739)
This commit is contained in:
58
.github/workflows/ci-pipeline.yml
vendored
58
.github/workflows/ci-pipeline.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
|
|
||||||
setup:
|
setup:
|
||||||
name: Setup Dependencies
|
name: Setup Dependencies
|
||||||
needs: check_changes
|
needs: [check_changes]
|
||||||
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -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/*
|
||||||
@@ -66,22 +67,24 @@ jobs:
|
|||||||
|
|
||||||
quality_checks:
|
quality_checks:
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
needs: [check_changes, setup]
|
needs: [setup]
|
||||||
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- check: lint
|
- name: Lint
|
||||||
name: Lint
|
check: lint
|
||||||
- check: format
|
- name: Format
|
||||||
name: Format
|
check: format
|
||||||
- check: test
|
- name: Test
|
||||||
name: Test
|
check: test
|
||||||
- check: spell
|
- name: Build
|
||||||
name: Spell Check
|
check: build
|
||||||
- check: build
|
- name: TypeScript
|
||||||
name: Build
|
check: typecheck
|
||||||
|
- name: Spell Check
|
||||||
|
check: spell
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -119,11 +122,22 @@ jobs:
|
|||||||
- name: Run ${{ matrix.name }}
|
- name: Run ${{ matrix.name }}
|
||||||
run: pnpm exec turbo run ${{ matrix.check }}
|
run: pnpm exec turbo run ${{ matrix.check }}
|
||||||
|
|
||||||
|
- name: Upload Build Artifact
|
||||||
|
if: matrix.name == 'Build'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-dist-${{ github.sha }}
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
# We should depend on quality checks to save CI running time.
|
||||||
playwright:
|
playwright:
|
||||||
name: Playwright Tests
|
name: Playwright Tests
|
||||||
needs: [check_changes, setup]
|
needs: [setup, quality_checks]
|
||||||
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: mcr.microsoft.com/playwright:v1.54.1-noble
|
||||||
|
options: --user 1001
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -146,10 +160,12 @@ jobs:
|
|||||||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
restore-keys: ${{ runner.os }}-node-modules-
|
restore-keys: ${{ runner.os }}-node-modules-
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Download Build Artifact
|
||||||
uses: actions/setup-node@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
path: dist/
|
||||||
|
pattern: build-dist*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
@@ -160,16 +176,6 @@ 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
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cache/ms-playwright
|
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: ${{ runner.os }}-playwright-
|
|
||||||
|
|
||||||
- name: Install Playwright Browsers
|
|
||||||
run: pnpm exec playwright install --with-deps
|
|
||||||
|
|
||||||
- name: Run Playwright Tests
|
- name: Run Playwright Tests
|
||||||
run: pnpm exec turbo run test:playwright
|
run: pnpm exec turbo run test:playwright
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,5 +33,6 @@ npm-debug.log*
|
|||||||
|
|
||||||
# cache
|
# cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
.cspellcache
|
||||||
# Turborepo
|
# Turborepo
|
||||||
.turbo
|
.turbo
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
pre-commit:
|
pre-commit:
|
||||||
piped: true
|
piped: true
|
||||||
|
exclude:
|
||||||
|
- pnpm-lock.yaml
|
||||||
commands:
|
commands:
|
||||||
prettier:
|
prettier:
|
||||||
priority: 1
|
priority: 1
|
||||||
@@ -36,7 +38,7 @@ cspell:
|
|||||||
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}"
|
||||||
run: |
|
run: |
|
||||||
pnpm cspell {staged_files}
|
pnpm cspell {staged_files} --cache --cache-strategy=content --cache-location=.cspellcache
|
||||||
stage_fixed: true
|
stage_fixed: true
|
||||||
|
|
||||||
commit-msg:
|
commit-msg:
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev --port 3000",
|
"dev": "astro dev --port 3000",
|
||||||
"start": "astro preview --port 3000",
|
"start": "astro preview --port 3000",
|
||||||
"build": "astro check && astro build",
|
"build": "astro build",
|
||||||
"preview": "astro preview --port 3000",
|
"preview": "astro preview --port 3000",
|
||||||
"wrangler": "wrangler",
|
"wrangler": "wrangler",
|
||||||
"astro": "astro",
|
"typecheck": "astro check",
|
||||||
"lint": "eslint . --max-warnings=0 --cache",
|
"lint": "eslint . --max-warnings=0 --cache",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
"spell": "cspell \"**/*.{ts,tsx,js,jsx,astro,md,json,yml,yaml}\"",
|
"spell": "cspell \"**/*.{ts,tsx,js,jsx,astro,md,json,yml,yaml}\"",
|
||||||
|
|||||||
@@ -1,69 +1,38 @@
|
|||||||
import { defineConfig, devices } from '@playwright/test'
|
import { defineConfig, devices } from '@playwright/test'
|
||||||
|
|
||||||
/**
|
|
||||||
* Read environment variables from file.
|
|
||||||
* https://github.com/motdotla/dotenv
|
|
||||||
*/
|
|
||||||
// import dotenv from 'dotenv';
|
|
||||||
// import path from 'path';
|
|
||||||
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See https://playwright.dev/docs/test-configuration.
|
|
||||||
*/
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: './src/tests',
|
testDir: './src/tests',
|
||||||
testIgnore: ['**.test.ts'],
|
testIgnore: ['**.test.ts'],
|
||||||
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: 'html',
|
||||||
use: {
|
use: {
|
||||||
baseURL: 'http://localhost:3000',
|
baseURL: 'http://localhost:3000',
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
},
|
},
|
||||||
|
projects: process.env.CI
|
||||||
/* Configure projects for major browsers */
|
? [
|
||||||
projects: [
|
{
|
||||||
{
|
name: 'firefox',
|
||||||
name: 'chromium',
|
use: { ...devices['Desktop Firefox'] },
|
||||||
use: { ...devices['Desktop Chrome'] },
|
},
|
||||||
},
|
]
|
||||||
|
: [
|
||||||
{
|
{
|
||||||
name: 'firefox',
|
name: 'chromium',
|
||||||
use: { ...devices['Desktop Firefox'] },
|
use: { ...devices['Desktop Chrome'] },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
{
|
name: 'firefox',
|
||||||
name: 'webkit',
|
use: { ...devices['Desktop Firefox'] },
|
||||||
use: { ...devices['Desktop Safari'] },
|
},
|
||||||
},
|
{
|
||||||
|
name: 'webkit',
|
||||||
/* Test against mobile viewports. */
|
use: { ...devices['Desktop Safari'] },
|
||||||
// {
|
},
|
||||||
// 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' },
|
|
||||||
// },
|
|
||||||
],
|
|
||||||
|
|
||||||
/* 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 ? 'npm run start' : 'npm run dev',
|
||||||
url: 'http://localhost:3000',
|
url: 'http://localhost:3000',
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
---
|
---
|
||||||
import h3 from '~/components/Description.astro'
|
import Image from 'astro/components/Image.astro'
|
||||||
|
import blacksmithLogo from '~/assets/sponsors/blacksmith-logo-dark.svg'
|
||||||
|
import crowdinLogo from '~/assets/sponsors/crowdin-logo-dark.svg'
|
||||||
|
import tutaLogo from '~/assets/sponsors/tutaLogo-dark.svg'
|
||||||
import { getLocale, getUI } from '~/utils/i18n'
|
import { getLocale, getUI } from '~/utils/i18n'
|
||||||
|
|
||||||
const locale = getLocale(Astro)
|
const locale = getLocale(Astro)
|
||||||
|
|
||||||
import tutaLogo from '~/assets/sponsors/tutaLogo-dark.svg'
|
|
||||||
import blacksmithLogo from '~/assets/sponsors/blacksmith-logo-dark.svg'
|
|
||||||
import crowdinLogo from '~/assets/sponsors/crowdin-logo-dark.svg'
|
|
||||||
|
|
||||||
import Image from 'astro/components/Image.astro'
|
|
||||||
const { showSponsors = true } = Astro.props
|
const { showSponsors = true } = Astro.props
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -59,3 +59,52 @@ export function getReleasesWithChecksums(locale: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
---
|
---
|
||||||
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 Layout from '~/layouts/Layout.astro'
|
|
||||||
import { getChecksums } from '~/utils/githubChecksums'
|
|
||||||
import { getLocale, getUI } from '~/utils/i18n'
|
|
||||||
|
|
||||||
import { icon, library } from '@fortawesome/fontawesome-svg-core'
|
import { icon, library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faApple, faGithub, faLinux, faWindows } from '@fortawesome/free-brands-svg-icons'
|
import { faApple, faGithub, faLinux, faWindows } from '@fortawesome/free-brands-svg-icons'
|
||||||
import Image from 'astro/components/Image.astro'
|
import Image from 'astro/components/Image.astro'
|
||||||
|
|
||||||
import AppIconDark from '~/assets/app-icon-dark.png'
|
import AppIconDark from '~/assets/app-icon-dark.png'
|
||||||
import AppIconLight from '~/assets/app-icon-light.png'
|
import AppIconLight from '~/assets/app-icon-light.png'
|
||||||
|
import Description from '~/components/Description.astro'
|
||||||
|
import DownloadScript from '~/components/download/DownloadScript.astro'
|
||||||
|
import PlatformDownload from '~/components/download/PlatformDownload.astro'
|
||||||
|
import { getReleases } from '~/components/download/release-data'
|
||||||
|
import Layout from '~/layouts/Layout.astro'
|
||||||
|
import { getLocale, getUI } from '~/utils/i18n'
|
||||||
|
|
||||||
export { getStaticPaths } from '~/utils/i18n'
|
export { getStaticPaths } from '~/utils/i18n'
|
||||||
|
|
||||||
@@ -27,8 +24,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
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://turborepo.com/schema.json",
|
"$schema": "https://turborepo.com/schema.json",
|
||||||
|
"globalPassThroughEnv": ["PLAYWRIGHT_*"],
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"dev": {
|
"dev": {
|
||||||
"cache": false,
|
"cache": false,
|
||||||
@@ -33,7 +34,6 @@
|
|||||||
},
|
},
|
||||||
"test:playwright": {
|
"test:playwright": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"dependsOn": ["build"],
|
|
||||||
"inputs": ["src"],
|
"inputs": ["src"],
|
||||||
"outputs": ["playwright-report/**", "test-results/**"]
|
"outputs": ["playwright-report/**", "test-results/**"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user