Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 89 additions & 26 deletions .github/workflows/main-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
changes:
name: Detect Changes 🔎
name: 🔎 Detect Changes
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
outputs:
build: ${{ steps.filter.outputs.build }}
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- '.github/workflows/main-pipeline.yaml'

setup:
name: pnpm install 🛠️
name: 🛠️ pnpm install
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
timeout-minutes: 15
steps:
Expand All @@ -102,7 +102,7 @@ jobs:
- run: pnpm install --prefer-offline --frozen-lockfile

license-check:
name: License Check 📄
name: 📄 License Check
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
needs: setup
timeout-minutes: 15
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
2.0;Unlicense;Unlicensed;:CC0-1.0;CC-BY-4.0;WTFPL;0BSD;UNLICENSED;Python-2.0;MPL-2.0;CC-BY-3.0;CC0-1.0'

format:
name: Format Check 🎨
name: 🎨 Format Check
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
needs: setup
timeout-minutes: 15
Expand All @@ -162,11 +162,14 @@ jobs:
- run: pnpm format:check

build:
name: Build 📦
name: 📦 Build
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
timeout-minutes: 15
needs: [setup, changes]
if: needs.changes.outputs.build == 'true'
if: >-
needs.changes.outputs.build == 'true' || needs.changes.outputs.e2e_node_ssr_only == 'true' ||
needs.changes.outputs.e2e_node_ssr_web_vanilla == 'true' || needs.changes.outputs.e2e_web ==
'true' || needs.changes.outputs.e2e_react_native_android == 'true'
steps:
- uses: namespacelabs/nscloud-checkout-action@v8

Expand All @@ -183,9 +186,20 @@ jobs:

- run: pnpm install --prefer-offline --frozen-lockfile
- run: pnpm build:ci
- name: Pack SDK tarballs for implementations
run: |
rm -rf pkgs
mkdir -p pkgs
pnpm run pack:pkgs
- uses: actions/upload-artifact@v6
with:
name: sdk-package-tarballs
path: pkgs/*.tgz
if-no-files-found: error
retention-days: 1

type-check:
name: Type Check 🔷
name: 🔷 Type Check
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
needs: setup
timeout-minutes: 15
Expand All @@ -207,7 +221,7 @@ jobs:
- run: pnpm typecheck

lint:
name: Lint 🎨
name: 🎨 Lint
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
needs: setup
timeout-minutes: 15
Expand All @@ -226,10 +240,19 @@ jobs:
cache: pnpm

- run: pnpm install --prefer-offline --frozen-lockfile
- run: pnpm build:pkgs
- run: pnpm store prune
- run:
pnpm --dir implementations/node-ssr-only --ignore-workspace install --no-frozen-lockfile
- run:
pnpm --dir implementations/node-ssr-web-vanilla --ignore-workspace install
--no-frozen-lockfile
- run: pnpm --dir implementations/web-vanilla --ignore-workspace install --no-frozen-lockfile
- run: pnpm --dir implementations/react-native --ignore-workspace install --no-frozen-lockfile
- run: pnpm lint:check

test-unit:
name: Test 🧪 (${{ matrix.package }})
name: 🧪 Test (${{ matrix.package }})
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
timeout-minutes: 15
needs: [setup, changes]
Expand Down Expand Up @@ -263,10 +286,10 @@ jobs:
- run: pnpm --filter ${{ matrix.package }} test:unit

e2e-node-ssr-only:
name: E2E Node SSR Only 🖥️
name: 🖥️ E2E Node SSR Only
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
timeout-minutes: 15
needs: [setup, changes]
needs: [setup, changes, build]
if: needs.changes.outputs.e2e_node_ssr_only == 'true'
steps:
- uses: namespacelabs/nscloud-checkout-action@v8
Expand Down Expand Up @@ -300,8 +323,17 @@ jobs:
apt

- run: pnpm install --prefer-offline --frozen-lockfile
- run: pnpm --filter @implementation/node-ssr-only exec playwright install --with-deps
- run: pnpm --filter @implementation/node-ssr-only test:e2e
- uses: actions/download-artifact@v6
with:
name: sdk-package-tarballs
path: pkgs
- run: pnpm store prune
- run:
pnpm --dir implementations/node-ssr-only --ignore-workspace install --no-frozen-lockfile
- run:
pnpm --dir implementations/node-ssr-only --ignore-workspace exec playwright install
--with-deps
- run: pnpm --dir implementations/node-ssr-only --ignore-workspace test:e2e

- uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
Expand All @@ -313,10 +345,10 @@ jobs:
retention-days: 1

e2e-node-ssr-web-vanilla:
name: E2E Node SSR + Web Vanilla 🖥️
name: 🖥️ E2E Node SSR + Web Vanilla
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
timeout-minutes: 15
needs: [setup, changes]
needs: [setup, changes, build]
if: needs.changes.outputs.e2e_node_ssr_web_vanilla == 'true'
steps:
- uses: namespacelabs/nscloud-checkout-action@v8
Expand Down Expand Up @@ -350,8 +382,18 @@ jobs:
apt

- run: pnpm install --prefer-offline --frozen-lockfile
- run: pnpm --filter @implementation/node-ssr-web-vanilla exec playwright install --with-deps
- run: pnpm --filter @implementation/node-ssr-web-vanilla test:e2e
- uses: actions/download-artifact@v6
with:
name: sdk-package-tarballs
path: pkgs
- run: pnpm store prune
- run:
pnpm --dir implementations/node-ssr-web-vanilla --ignore-workspace install
--no-frozen-lockfile
- run:
pnpm --dir implementations/node-ssr-web-vanilla --ignore-workspace exec playwright install
--with-deps
- run: pnpm --dir implementations/node-ssr-web-vanilla --ignore-workspace test:e2e

- uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
Expand All @@ -363,10 +405,10 @@ jobs:
retention-days: 1

e2e-web:
name: E2E Web Vanilla 🖥️
name: 🖥️ E2E Web Vanilla
runs-on: namespace-profile-linux-8-vcpu-16-gb-ram-optimal
timeout-minutes: 15
needs: [setup, changes]
needs: [setup, changes, build]
if: needs.changes.outputs.e2e_web == 'true'
steps:
- uses: docker/setup-compose-action@v1
Expand Down Expand Up @@ -407,8 +449,16 @@ jobs:
apt

- run: pnpm install --prefer-offline --frozen-lockfile
- run: pnpm --filter @implementation/web-vanilla exec playwright install --with-deps
- run: pnpm --filter @implementation/web-vanilla test:e2e
- uses: actions/download-artifact@v6
with:
name: sdk-package-tarballs
path: pkgs
- run: pnpm store prune
- run: pnpm --dir implementations/web-vanilla --ignore-workspace install --no-frozen-lockfile
- run:
pnpm --dir implementations/web-vanilla --ignore-workspace exec playwright install
--with-deps
- run: pnpm --dir implementations/web-vanilla --ignore-workspace test:e2e

- uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
Expand All @@ -420,10 +470,10 @@ jobs:
retention-days: 1

e2e-react-native-android:
name: E2E React Native Android 📱
name: 📱 E2E React Native Android
runs-on: namespace-profile-linux-16-vcpu-32-gb-ram-optimal
timeout-minutes: 60
needs: [setup, changes]
needs: [setup, changes, build]
if: needs.changes.outputs.e2e_react_native_android == 'true'
env:
DETOX_AVD_NAME: test
Expand Down Expand Up @@ -497,6 +547,19 @@ jobs:
- name: Install JS dependencies
run: pnpm install --prefer-offline --frozen-lockfile

- name: Download SDK package tarballs
uses: actions/download-artifact@v6
with:
name: sdk-package-tarballs
path: pkgs

- name: Prune pnpm store metadata cache
run: pnpm store prune

- name: Install React Native implementation dependencies
run: >
pnpm --dir implementations/react-native --ignore-workspace install --no-frozen-lockfile

- name: Create .env file for React Native
run: |
cat > implementations/react-native/.env << 'EOF'
Expand All @@ -513,11 +576,11 @@ jobs:

- name: Build Android app (Detox)
run: |
pnpm --filter @implementation/react-native test:e2e:android:build
pnpm --dir implementations/react-native --ignore-workspace test:e2e:android:build

- name: Start Mock Server
run: |
pnpm --filter mocks serve > /tmp/mock-server.log 2>&1 &
pnpm --dir lib/mocks serve > /tmp/mock-server.log 2>&1 &
echo $! > /tmp/mock-server.pid
for i in {1..60}; do
if nc -z localhost 8000 2>/dev/null; then
Expand Down Expand Up @@ -576,7 +639,7 @@ jobs:
adb reverse tcp:8000 tcp:8000
adb reverse tcp:8081 tcp:8081
echo "Running E2E tests..."
pnpm --filter @implementation/react-native test:e2e:android:run --retries 2
pnpm --dir implementations/react-native --ignore-workspace test:e2e:android:run --retries 2

- name: Upload Metro logs on failure
if: failure()
Expand Down
20 changes: 10 additions & 10 deletions implementations/node-ssr-only/.env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
DOTENV_CONFIG_QUIET=true

VITE_NINETAILED_CLIENT_ID="mock-client-id"
VITE_NINETAILED_ENVIRONMENT="main"
PUBLIC_NINETAILED_CLIENT_ID="mock-client-id"
PUBLIC_NINETAILED_ENVIRONMENT="main"

VITE_EXPERIENCE_API_BASE_URL="http://localhost:8000/experience/"
VITE_INSIGHTS_API_BASE_URL="http://localhost:8000/insights/"
PUBLIC_EXPERIENCE_API_BASE_URL="http://localhost:8000/experience/"
PUBLIC_INSIGHTS_API_BASE_URL="http://localhost:8000/insights/"

VITE_CONTENTFUL_TOKEN="mock-token"
VITE_CONTENTFUL_PREVIEW_TOKEN="mosk-preview-token"
VITE_CONTENTFUL_ENVIRONMENT="master"
VITE_CONTENTFUL_SPACE_ID="mock-space-id"
PUBLIC_CONTENTFUL_TOKEN="mock-token"
PUBLIC_CONTENTFUL_PREVIEW_TOKEN="mosk-preview-token"
PUBLIC_CONTENTFUL_ENVIRONMENT="master"
PUBLIC_CONTENTFUL_SPACE_ID="mock-space-id"

VITE_CONTENTFUL_CDA_HOST="localhost:8000"
VITE_CONTENTFUL_BASE_PATH="contentful"
PUBLIC_CONTENTFUL_CDA_HOST="localhost:8000"
PUBLIC_CONTENTFUL_BASE_PATH="contentful"
1 change: 1 addition & 0 deletions implementations/node-ssr-only/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shared-workspace-lockfile=false
33 changes: 28 additions & 5 deletions implementations/node-ssr-only/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,60 @@ All steps should be run from the monorepo root.
4. Start the mock API and application servers:

```sh
pnpm --filter @implementations/node-ssr-only serve
pnpm --dir implementations/node-ssr-only --ignore-workspace serve
```

5. The application can be accessed via Web browser at `http://localhost:3000`

6. Stop the mock API and application servers:

```sh
pnpm --filter @implementations/node-ssr-only serve:stop
pnpm --dir implementations/node-ssr-only --ignore-workspace serve:stop
```

See `implementations/node-ssr-only/package.json` for more commands.

## Running From Root Scripts

You can run this implementation from the monorepo root via the root `package.json` implementation
scripts.

1. Start servers:

```sh
pnpm run implementation:node-ssr-only -- serve
```

2. Stop servers:

```sh
pnpm run implementation:node-ssr-only -- serve:stop
```

3. Run E2E:

```sh
pnpm run implementation:node-ssr-only -- test:e2e
```

## Running E2E Tests

E2E tests are run using Playwright.

1. Install Playwright dependencies:

```sh
pnpm --filter @implementation/node-ssr-only exec playwright install --with-deps
pnpm --dir implementations/node-ssr-only --ignore-workspace exec playwright install --with-deps
```

2. Run the E2E test suite:

```sh
pnpm --filter @implementation/node-ssr-only test:e2e
pnpm --dir implementations/node-ssr-only --ignore-workspace test:e2e
```

The tests can alternatively be run using Playwright's GUI:

```sh
pnpm --filter @implementation/node-ssr-only test:e2e:ui
pnpm --dir implementations/node-ssr-only --ignore-workspace test:e2e:ui
```
Loading