|
|
@@ -6,7 +6,7 @@ on:
|
|
|
node-version:
|
|
|
required: true
|
|
|
type: string
|
|
|
- skip-cypress:
|
|
|
+ skip-e2e-test:
|
|
|
type: boolean
|
|
|
cypress-report-artifact-name-prefix:
|
|
|
type: string
|
|
|
@@ -43,44 +43,43 @@ jobs:
|
|
|
|
|
|
- name: Prune repositories
|
|
|
run: |
|
|
|
- turbo prune --scope=@growi/app
|
|
|
+ turbo prune @growi/app
|
|
|
rm -rf apps packages
|
|
|
mv out/* .
|
|
|
|
|
|
- name: Cache/Restore node_modules
|
|
|
- id: cache-dependencies
|
|
|
uses: actions/cache@v4
|
|
|
with:
|
|
|
path: |
|
|
|
**/node_modules
|
|
|
- key: node_modules-app-7.x-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
+ !**/node_modules/.cache/turbo
|
|
|
+ key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
restore-keys: |
|
|
|
- node_modules-app-7.x-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
+ node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
|
|
|
- name: Install dependencies
|
|
|
run: |
|
|
|
yarn global add node-gyp
|
|
|
yarn --frozen-lockfile
|
|
|
|
|
|
- - name: Restore dist
|
|
|
+ - name: Cache/Restore dist
|
|
|
uses: actions/cache@v4
|
|
|
with:
|
|
|
path: |
|
|
|
- node_modules/.cache/turbo
|
|
|
**/.turbo
|
|
|
**/dist
|
|
|
+ **/node_modules/.cache/turbo
|
|
|
${{ github.workspace }}/apps/app/.next
|
|
|
- key: dist-app-7.x-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ github.sha }}
|
|
|
+ key: dist-app-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.sha }}
|
|
|
restore-keys: |
|
|
|
- dist-app-7.x-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
|
|
|
- dist-app-7.x-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
+ dist-app-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
|
|
|
- name: Build
|
|
|
working-directory: ./apps/app
|
|
|
run: |
|
|
|
- turbo run build
|
|
|
+ turbo run build --env-mode=loose
|
|
|
env:
|
|
|
- ANALYZE_BUNDLE_SIZE: 1
|
|
|
+ ANALYZE: 1
|
|
|
|
|
|
- name: Archive production files
|
|
|
id: archive-prod-files
|
|
|
@@ -155,19 +154,19 @@ jobs:
|
|
|
|
|
|
- name: Prune repositories
|
|
|
run: |
|
|
|
- turbo prune --scope=@growi/app
|
|
|
+ turbo prune @growi/app
|
|
|
rm -rf apps packages
|
|
|
mv out/* .
|
|
|
|
|
|
- - name: Cache/Restore node_modules
|
|
|
- id: cache-dependencies
|
|
|
- uses: actions/cache@v4
|
|
|
+ - name: Restore node_modules
|
|
|
+ uses: actions/cache/restore@v4
|
|
|
with:
|
|
|
path: |
|
|
|
**/node_modules
|
|
|
- key: node_modules-app-7.x-launch-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
+ # shared key with build-prod
|
|
|
+ key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
restore-keys: |
|
|
|
- node_modules-app-7.x-launch-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
+ node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
|
|
|
- name: Install dependencies
|
|
|
run: |
|
|
|
@@ -206,7 +205,7 @@ jobs:
|
|
|
run-cypress:
|
|
|
needs: [build-prod]
|
|
|
|
|
|
- if: ${{ !inputs.skip-cypress }}
|
|
|
+ if: ${{ !inputs.skip-e2e-test }}
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
@@ -214,7 +213,7 @@ jobs:
|
|
|
fail-fast: false
|
|
|
matrix:
|
|
|
# List string expressions that is comma separated ids of tests in "test/cypress/integration"
|
|
|
- spec-group: ['10', '20', '21', '22', '23', '30', '40', '50', '60']
|
|
|
+ spec-group: ['20', '21', '22', '23', '30', '50', '60']
|
|
|
|
|
|
services:
|
|
|
mongodb:
|
|
|
@@ -246,19 +245,19 @@ jobs:
|
|
|
|
|
|
- name: Prune repositories
|
|
|
run: |
|
|
|
- turbo prune --scope=@growi/app
|
|
|
+ turbo prune @growi/app
|
|
|
rm -rf apps packages
|
|
|
mv out/* .
|
|
|
|
|
|
- - name: Cache/Restore node_modules
|
|
|
- id: cache-dependencies
|
|
|
- uses: actions/cache@v4
|
|
|
+ - name: Restore node_modules
|
|
|
+ uses: actions/cache/restore@v4
|
|
|
with:
|
|
|
path: |
|
|
|
**/node_modules
|
|
|
- key: node_modules-app-7.x-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
+ # saved key by build-prod
|
|
|
+ key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
restore-keys: |
|
|
|
- node_modules-app-7.x-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
+ node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
|
|
|
- name: Cache/Restore Cypress files
|
|
|
uses: actions/cache@v4
|
|
|
@@ -339,3 +338,114 @@ jobs:
|
|
|
channel: '#ci'
|
|
|
isCompactMode: true
|
|
|
url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ run-playwright:
|
|
|
+ needs: [build-prod]
|
|
|
+
|
|
|
+ if: ${{ !inputs.skip-e2e-test }}
|
|
|
+
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ container:
|
|
|
+ image: mcr.microsoft.com/playwright:latest
|
|
|
+
|
|
|
+ strategy:
|
|
|
+ fail-fast: false
|
|
|
+ matrix:
|
|
|
+ browser: [chromium, firefox, webkit]
|
|
|
+ shard: [1/2, 2/2]
|
|
|
+
|
|
|
+ services:
|
|
|
+ mongodb:
|
|
|
+ image: mongo:6.0
|
|
|
+ ports:
|
|
|
+ - 27017/tcp
|
|
|
+ elasticsearch:
|
|
|
+ image: docker.elastic.co/elasticsearch/elasticsearch:7.17.1
|
|
|
+ ports:
|
|
|
+ - 9200/tcp
|
|
|
+ env:
|
|
|
+ discovery.type: single-node
|
|
|
+
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v4
|
|
|
+
|
|
|
+ - uses: actions/setup-node@v4
|
|
|
+ with:
|
|
|
+ node-version: ${{ inputs.node-version }}
|
|
|
+ cache: 'yarn'
|
|
|
+ cache-dependency-path: '**/yarn.lock'
|
|
|
+
|
|
|
+ - name: Restore node_modules
|
|
|
+ uses: actions/cache/restore@v4
|
|
|
+ with:
|
|
|
+ path: |
|
|
|
+ **/node_modules
|
|
|
+ # saved key by build-prod
|
|
|
+ key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
+ restore-keys: |
|
|
|
+ node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
|
|
|
+
|
|
|
+ - name: Install dependencies
|
|
|
+ run: |
|
|
|
+ yarn global add node-gyp
|
|
|
+ yarn --frozen-lockfile
|
|
|
+
|
|
|
+ - name: Install Playwright browsers
|
|
|
+ run: |
|
|
|
+ yarn playwright install --with-deps ${{ matrix.browser }}
|
|
|
+
|
|
|
+ - name: Download production files artifact
|
|
|
+ uses: actions/download-artifact@v4
|
|
|
+ with:
|
|
|
+ name: Production Files (node${{ inputs.node-version }})
|
|
|
+
|
|
|
+ - name: Extract procution files artifact
|
|
|
+ run: |
|
|
|
+ tar -xf ${{ needs.build-prod.outputs.PROD_FILES }}
|
|
|
+
|
|
|
+ - name: Copy dotenv file for ci
|
|
|
+ working-directory: ./apps/app
|
|
|
+ run: |
|
|
|
+ cat config/ci/.env.local.for-ci >> .env.production.local
|
|
|
+
|
|
|
+ - name: Playwright Run (--project=chromium/installer)
|
|
|
+ if: ${{ matrix.browser == 'chromium' }}
|
|
|
+ working-directory: ./apps/app
|
|
|
+ run: |
|
|
|
+ yarn playwright test --project=chromium/installer
|
|
|
+ env:
|
|
|
+ HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
|
|
|
+ MONGO_URI: mongodb://mongodb:27017/growi-playwright-installer
|
|
|
+ ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi
|
|
|
+
|
|
|
+ - name: Copy dotenv file for automatic installation
|
|
|
+ working-directory: ./apps/app
|
|
|
+ run: |
|
|
|
+ cat config/ci/.env.local.for-auto-install >> .env.production.local
|
|
|
+
|
|
|
+ # - name: Copy dotenv file for automatic installation with allowing guest mode
|
|
|
+ # if: ${{ matrix.spec-group == '21' }}
|
|
|
+ # working-directory: ./apps/app
|
|
|
+ # run: |
|
|
|
+ # cat config/ci/.env.local.for-auto-install-with-allowing-guest >> .env.production.local
|
|
|
+
|
|
|
+ - name: Playwright Run
|
|
|
+ working-directory: ./apps/app
|
|
|
+ run: |
|
|
|
+ yarn playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shard }}
|
|
|
+ env:
|
|
|
+ HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
|
|
|
+ MONGO_URI: mongodb://mongodb:27017/growi-playwright
|
|
|
+ ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi
|
|
|
+
|
|
|
+ - name: Slack Notification
|
|
|
+ uses: weseek/ghaction-slack-notification@master
|
|
|
+ if: failure()
|
|
|
+ with:
|
|
|
+ type: ${{ job.status }}
|
|
|
+ job_name: '*Node CI for growi - run-playwright*'
|
|
|
+ channel: '#ci'
|
|
|
+ isCompactMode: true
|
|
|
+ url: ${{ secrets.SLACK_WEBHOOK_URL }}
|