Skip to content

Commit a2b0758

Browse files
Merge branch 'main' into revops-snippet
2 parents b32a5e2 + 7849893 commit a2b0758

File tree

9 files changed

+83
-27
lines changed

9 files changed

+83
-27
lines changed

.github/workflows/tests.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,51 @@ jobs:
3535
run: pnpm install --frozen-lockfile
3636
- name: Check formatting
3737
run: pnpm format:check
38-
38+
tests:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
ref: ${{ github.event.pull_request.head.sha }}
44+
- uses: actions/setup-node@v4
45+
with:
46+
node-version: 20
47+
- name: Install corepack
48+
run: npm i -g corepack@latest
49+
- name: Install pnpm
50+
run: corepack enable
51+
- name: Get pnpm store directory
52+
shell: bash
53+
run: |
54+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
55+
- uses: actions/cache@v4
56+
name: Setup pnpm cache
57+
with:
58+
path: ${{ env.STORE_PATH }}
59+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
60+
restore-keys: |
61+
${{ runner.os }}-pnpm-store-
62+
- name: Install dependencies
63+
run: pnpm install --frozen-lockfile
64+
- name: Install playwright dependencies
65+
run: pnpm exec playwright install --with-deps chromium
66+
- name: Run tests
67+
env:
68+
PUBLIC_APPWRITE_ENDPOINT: ${{ vars.PUBLIC_APPWRITE_ENDPOINT }}
69+
PUBLIC_APPWRITE_DASHBOARD: ${{ vars.PUBLIC_APPWRITE_DASHBOARD }}
70+
PUBLIC_APPWRITE_PROJECT_ID: ${{ vars.PUBLIC_APPWRITE_PROJECT_ID }}
71+
PUBLIC_APPWRITE_DB_MAIN_ID: ${{ vars.PUBLIC_APPWRITE_DB_MAIN_ID }}
72+
PUBLIC_APPWRITE_COL_THREADS_ID: ${{ vars.PUBLIC_APPWRITE_COL_THREADS_ID }}
73+
PUBLIC_APPWRITE_COL_MESSAGES_ID: ${{ vars.PUBLIC_APPWRITE_COL_MESSAGES_ID }}
74+
PUBLIC_APPWRITE_FN_TLDR_ID: ${{ vars.PUBLIC_APPWRITE_FN_TLDR_ID }}
75+
PUBLIC_APPWRITE_PROJECT_INIT_ID: ${{ vars.PUBLIC_APPWRITE_PROJECT_INIT_ID }}
76+
PUBLIC_GROWTH_ENDPOINT: ${{ vars.PUBLIC_GROWTH_ENDPOINT }}
77+
PUBLIC_POSTHOG_API_KEY: ${{ vars.PUBLIC_POSTHOG_API_KEY }}
78+
APPWRITE_DB_INIT_ID: ${{ secrets.APPWRITE_DB_INIT_ID }}
79+
APPWRITE_COL_INIT_ID: ${{ secrets.APPWRITE_COL_INIT_ID }}
80+
APPWRITE_API_KEY_INIT: ${{ secrets.APPWRITE_API_KEY_INIT }}
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
run: pnpm test
3983
build:
4084
runs-on: ubuntu-latest
4185
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ terraform/**/.t*
2121
terraform/**/.env
2222
terraform/**/**/*.tfstate*
2323
/.cache
24+
/test-results

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"icons:optimize": "node ./src/icons/optimize.js",
1818
"lint": "prettier --check . && eslint .",
1919
"preview": "vite preview",
20-
"test": "npm run test:integration && npm run test:unit",
20+
"test": "npm run test:integration",
2121
"test:integration": "playwright test",
2222
"test:unit": "vitest",
2323
"optimize": "node ./scripts/optimize-assets.js",
@@ -96,5 +96,16 @@
9696
"vite-plugin-image-optimizer": "^1.1.8",
9797
"vite-plugin-manifest-sri": "^0.2.0",
9898
"vitest": "^1.6.0"
99+
},
100+
"pnpm": {
101+
"onlyBuiltDependencies": [
102+
"@parcel/watcher",
103+
"@sentry/cli",
104+
"core-js",
105+
"esbuild",
106+
"sharp",
107+
"svelte-preprocess",
108+
"ttf2woff2"
109+
]
99110
}
100111
}

playwright.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import type { PlaywrightTestConfig } from '@playwright/test';
22

33
const config: PlaywrightTestConfig = {
44
webServer: {
5-
command: 'npm run build && npm run preview',
6-
port: 4173
5+
command: 'pnpm run dev',
6+
port: 5173
77
},
8+
fullyParallel: true,
89
testDir: 'tests',
910
testMatch: /(.+\.)?(test|spec)\.[jt]s/
1011
};

src/redirects.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@
139139
"link": "/docs/authentication-management",
140140
"redirect": "/docs/products/auth/users"
141141
},
142-
{
143-
"link": "/docs/authentication-server",
144-
"redirect": "/docs/authentication-server"
145-
},
146142
{
147143
"link": "/docs/authentication-security",
148144
"redirect": "/docs/products/auth/security"
@@ -265,7 +261,7 @@
265261
},
266262
{
267263
"link": "/docs/debugging",
268-
"redirect": "/docs/advanced/self-hosting/debugging"
264+
"redirect": "/docs/advanced/self-hosting/debug"
269265
},
270266
{
271267
"link": "/docs/upgrade",
@@ -467,10 +463,6 @@
467463
"link": "/docs/models/collection",
468464
"redirect": "/docs/references/cloud/models/collection"
469465
},
470-
{
471-
"link": "/docs/models/attribute",
472-
"redirect": "/docs/references/cloud/models/attribute"
473-
},
474466
{
475467
"link": "/docs/models/index",
476468
"redirect": "/docs/references/cloud/models/index"
@@ -659,10 +651,6 @@
659651
"link": "/keyboard",
660652
"redirect": "/docs/tooling/appwriter"
661653
},
662-
{
663-
"link": "/careers",
664-
"redirect": "https://appwrite.careers"
665-
},
666654
{
667655
"link": "/policy/terms",
668656
"redirect": "/terms"
@@ -671,10 +659,7 @@
671659
"link": "/policy/privacy",
672660
"redirect": "/privacy"
673661
},
674-
{
675-
"link": "/cli/install.sh",
676-
"redirect": "https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/install.sh"
677-
},
662+
678663
{
679664
"link": "/case-studies",
680665
"redirect": "/customer-stories"

src/routes/careers/+page.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from '@sveltejs/kit';
2+
3+
export function load() {
4+
redirect(301, 'https://careers.appwrite.io');
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from '@sveltejs/kit';
2+
3+
export function load() {
4+
redirect(301, 'https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/install.sh');
5+
}

tests/redirects.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expect, test } from '@playwright/test';
2+
import redirects from '../src/redirects.json' with { type: 'json' };
3+
4+
redirects.forEach(({ link, redirect }) => {
5+
test(`redirected from ${link} to ${redirect} exists`, async ({ page }) => {
6+
const response = await page.goto(redirect);
7+
8+
expect(response?.ok()).toBeTruthy();
9+
});
10+
});

tests/test.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)