|
|
@@ -184,18 +184,48 @@ jobs:
|
|
|
url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
|
|
|
|
|
+ prime-playwright-cache:
|
|
|
+ if: |
|
|
|
+ github.event_name == 'workflow_dispatch' ||
|
|
|
+ (!inputs.skip-e2e-test && startsWith(github.head_ref, 'mergify/merge-queue/'))
|
|
|
+
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v4
|
|
|
+
|
|
|
+ - uses: pnpm/action-setup@v6
|
|
|
+
|
|
|
+ - uses: actions/setup-node@v6
|
|
|
+ with:
|
|
|
+ node-version: ${{ inputs.node-version }}
|
|
|
+ cache: 'pnpm'
|
|
|
+
|
|
|
+ - name: Install dependencies
|
|
|
+ run: |
|
|
|
+ pnpm install --frozen-lockfile
|
|
|
+
|
|
|
+ - name: Cache Playwright browsers
|
|
|
+ id: playwright-cache
|
|
|
+ uses: actions/cache@v4
|
|
|
+ with:
|
|
|
+ path: ~/.cache/ms-playwright
|
|
|
+ key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
|
+
|
|
|
+ - name: Install Playwright browsers
|
|
|
+ if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
|
+ run: |
|
|
|
+ pnpm playwright install
|
|
|
+
|
|
|
+
|
|
|
run-playwright:
|
|
|
- needs: [build-prod]
|
|
|
+ needs: [build-prod, prime-playwright-cache]
|
|
|
|
|
|
if: |
|
|
|
github.event_name == 'workflow_dispatch' ||
|
|
|
(!inputs.skip-e2e-test && startsWith(github.head_ref, 'mergify/merge-queue/'))
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
- container:
|
|
|
- # Match the Playwright version
|
|
|
- # https://github.com/microsoft/playwright/issues/20010
|
|
|
- image: mcr.microsoft.com/playwright:v1.58.2-jammy
|
|
|
|
|
|
# Playwright spawns `pnpm run server` inside the extracted prod dir via
|
|
|
# GROWI_WEBSERVER_COMMAND. That dir lacks pnpm-workspace.yaml and packages/*,
|
|
|
@@ -215,14 +245,6 @@ jobs:
|
|
|
image: mongo:${{ matrix.mongodb-version }}
|
|
|
ports:
|
|
|
- 27017/tcp
|
|
|
- elasticsearch:
|
|
|
- image: docker.elastic.co/elasticsearch/elasticsearch:9.0.1
|
|
|
- ports:
|
|
|
- - 9200/tcp
|
|
|
- env:
|
|
|
- discovery.type: single-node
|
|
|
- # ES 9.x enables security (HTTPS + auth) by default; disable for plaintext CI access
|
|
|
- xpack.security.enabled: false
|
|
|
|
|
|
steps:
|
|
|
- uses: actions/checkout@v4
|
|
|
@@ -238,9 +260,40 @@ jobs:
|
|
|
run: |
|
|
|
pnpm install --frozen-lockfile
|
|
|
|
|
|
- - name: Install Playwright browsers
|
|
|
+ # Browsers are pre-populated by `prime-playwright-cache`. Always a cache hit;
|
|
|
+ # restore-keys provides a partial fallback if the keyed cache was evicted.
|
|
|
+ - name: Restore Playwright browser cache
|
|
|
+ uses: actions/cache/restore@v4
|
|
|
+ with:
|
|
|
+ path: ~/.cache/ms-playwright
|
|
|
+ key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
|
+ restore-keys: |
|
|
|
+ playwright-${{ runner.os }}-
|
|
|
+
|
|
|
+ # `--with-deps` installs apt system libraries and re-downloads any browser
|
|
|
+ # that wasn't in the restored cache. With a primed cache, this only runs apt.
|
|
|
+ - name: Install Playwright system deps and any missing browsers
|
|
|
+ run: |
|
|
|
+ pnpm playwright install --with-deps
|
|
|
+
|
|
|
+ - name: Start Elasticsearch with plugins
|
|
|
+ uses: elastic/elastic-github-actions/elasticsearch@master
|
|
|
+ with:
|
|
|
+ stack-version: 9.3.3
|
|
|
+ plugins: |
|
|
|
+ analysis-kuromoji
|
|
|
+ analysis-icu
|
|
|
+ security-enabled: false
|
|
|
+
|
|
|
+ - name: Wait for Elasticsearch to be ready
|
|
|
run: |
|
|
|
- pnpm playwright install --with-deps ${{ matrix.browser }}
|
|
|
+ curl \
|
|
|
+ --no-progress-meter \
|
|
|
+ -X GET \
|
|
|
+ --retry 60 \
|
|
|
+ --retry-delay 1 \
|
|
|
+ --retry-connrefused \
|
|
|
+ http://localhost:9200/_cluster/health?wait_for_status=green
|
|
|
|
|
|
- name: Download production files artifact
|
|
|
uses: actions/download-artifact@v4
|
|
|
@@ -263,10 +316,9 @@ jobs:
|
|
|
pnpm playwright test --project=chromium/installer
|
|
|
env:
|
|
|
DEBUG: pw:api
|
|
|
- HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
|
|
|
GROWI_WEBSERVER_COMMAND: 'cd /tmp/growi-prod/apps/app && pnpm run server'
|
|
|
- MONGO_URI: mongodb://mongodb:27017/growi-playwright-installer
|
|
|
- ELASTICSEARCH_URI: http://elasticsearch:9200/growi
|
|
|
+ MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi-playwright-installer
|
|
|
+ ELASTICSEARCH_URI: http://localhost:9200/growi
|
|
|
|
|
|
- name: Copy dotenv file for automatic installation
|
|
|
run: |
|
|
|
@@ -278,10 +330,9 @@ jobs:
|
|
|
pnpm playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shard }}
|
|
|
env:
|
|
|
DEBUG: pw:api
|
|
|
- HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
|
|
|
GROWI_WEBSERVER_COMMAND: 'cd /tmp/growi-prod/apps/app && pnpm run server'
|
|
|
- MONGO_URI: mongodb://mongodb:27017/growi-playwright
|
|
|
- ELASTICSEARCH_URI: http://elasticsearch:9200/growi
|
|
|
+ MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi-playwright
|
|
|
+ ELASTICSEARCH_URI: http://localhost:9200/growi
|
|
|
|
|
|
- name: Copy dotenv file for automatic installation with allowing guest mode
|
|
|
run: |
|
|
|
@@ -293,10 +344,9 @@ jobs:
|
|
|
pnpm playwright test --project=${{ matrix.browser }}/guest-mode --shard=${{ matrix.shard }}
|
|
|
env:
|
|
|
DEBUG: pw:api
|
|
|
- HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
|
|
|
GROWI_WEBSERVER_COMMAND: 'cd /tmp/growi-prod/apps/app && pnpm run server'
|
|
|
- MONGO_URI: mongodb://mongodb:27017/growi-playwright-guest-mode
|
|
|
- ELASTICSEARCH_URI: http://elasticsearch:9200/growi
|
|
|
+ MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi-playwright-guest-mode
|
|
|
+ ELASTICSEARCH_URI: http://localhost:9200/growi
|
|
|
|
|
|
- name: Generate shard ID
|
|
|
id: shard-id
|