logseq/.github/workflows/e2e.yml

160 lines
4.5 KiB
YAML
Raw Normal View History

2022-08-31 09:38:36 +00:00
name: E2E
# Running E2E test multiple times to confirm test stability.
# E2E test could be randomly failed due to the batch update mechanism of React.
# Robust E2E test could help improving dev experience.
on:
push:
branches: [master]
paths:
- 'e2e-tests/**'
pull_request:
branches: [master]
paths:
- 'e2e-tests/**'
env:
2023-02-21 15:02:58 +00:00
CLOJURE_VERSION: '1.10.1.763'
JAVA_VERSION: '11'
# This is the latest node version we can run.
NODE_VERSION: '18'
2022-12-08 16:22:01 +00:00
BABASHKA_VERSION: '1.0.168'
jobs:
2022-09-05 16:04:24 +00:00
e2e-test-build:
name: Build Test Artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Set up Node
2023-02-21 15:02:58 +00:00
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
2023-05-22 09:43:40 +00:00
cache: 'yarn'
cache-dependency-path: |
yarn.lock
static/yarn.lock
- name: Set up Java
2023-02-21 15:02:58 +00:00
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Clojure
2023-02-21 15:02:58 +00:00
uses: DeLaGuardo/setup-clojure@10.1
with:
cli: ${{ env.CLOJURE_VERSION }}
- name: Clojure cache
2023-02-21 15:02:58 +00:00
uses: actions/cache@v3
id: clojure-deps
with:
path: |
~/.m2/repository
~/.gitlibs
key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
restore-keys: ${{ runner.os }}-clojure-deps-
- name: Fetch Clojure deps
if: steps.clojure-deps.outputs.cache-hit != 'true'
run: clojure -A:cljs -P
- name: Shadow-cljs cache
2023-02-21 15:02:58 +00:00
uses: actions/cache@v3
with:
path: .shadow-cljs
# ensure update cache every time
key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
# will match most recent upload
restore-keys: |
${{ runner.os }}-shadow-cljs-
- name: Fetch yarn deps
2023-05-22 09:43:40 +00:00
run: yarn install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
2022-09-18 11:54:26 +00:00
# NOTE: require the app to be build with DEV-RELEASE flag
- name: Prepare E2E test build
run: |
2022-09-18 11:54:26 +00:00
yarn gulp:build && clojure -M:cljs release app electron --config-merge "{:closure-defines {frontend.config/DEV-RELEASE true}}" --debug
2022-09-05 16:04:24 +00:00
# NOTE: should include .shadow-cljs if in dev mode(compile)
- name: Create Archive for build
run: tar czf static.tar.gz static
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: logseq-e2e-artifact
path: static.tar.gz
retention-days: 1
e2e-test-run:
needs: [ e2e-test-build ]
name: Test Shard ${{ matrix.shard }} Repeat ${{ matrix.repeat }}
runs-on: ubuntu-latest
strategy:
matrix:
repeat: [1, 2]
shard: [1, 2, 3]
steps:
- name: Repeat message
run: echo ::info title=StartUp::E2E testing shard ${{ matrix.shard}}/3 repeat ${{ matrix.repeat }}
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
2022-09-05 16:04:24 +00:00
- name: Download test build artifact
uses: actions/download-artifact@v3
with:
name: logseq-e2e-artifact
- name: Extract test Artifact
run: tar xzf static.tar.gz
- name: Set up Node
2023-02-21 15:02:58 +00:00
uses: actions/setup-node@v3
2022-09-05 16:04:24 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: |
yarn.lock
static/yarn.lock
- name: Fetch yarn deps for E2E test
run: |
yarn install
(cd static && yarn install && yarn rebuild:all)
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
- name: Ensure static yarn.lock is up to date
run: git diff --exit-code static/yarn.lock
2023-05-22 09:41:31 +00:00
- name: Install fluxbox
2023-05-22 10:11:46 +00:00
run: sudo apt-get update && sudo apt-get install -y fluxbox
2023-05-22 09:41:31 +00:00
2023-05-22 11:10:08 +00:00
- name: Export display
run: export DISPLAY=:99
- name: Run Playwright test
2023-05-22 11:10:08 +00:00
run: Xvfb :99 -screen 0 1024x768x16 & fluxbox & npx playwright test --reporter github --shard=${{ matrix.shard }}/3
env:
LOGSEQ_CI: true
DEBUG: "pw:api"
2022-09-05 16:04:24 +00:00
RELEASE: true # skip dev only test
2022-11-30 11:29:18 +00:00
- name: Save e2e artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: e2e-repeat-report-${{ matrix.shard}}-${{ matrix.repeat }}
path: e2e-dump/*
retention-days: 1