2023-02-14 21:52:45 +03:00
|
|
|
name: Build & Test
|
2022-12-30 16:40:15 +03:00
|
|
|
|
|
|
|
on:
|
2023-04-25 03:26:07 +03:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2023-05-10 04:27:07 +03:00
|
|
|
- v[0-9]+.[0-9]+.x-staging
|
|
|
|
- v[0-9]+.[0-9]+.x
|
2023-05-10 07:03:22 +03:00
|
|
|
paths-ignore:
|
|
|
|
- README.md
|
|
|
|
- .github/**
|
|
|
|
- '!.github/workflows/build.yml'
|
2023-06-17 12:49:07 +03:00
|
|
|
- '!.github/actions/build-rust/action.yml'
|
|
|
|
- '!.github/actions/setup-node/action.yml'
|
2023-03-28 06:52:19 +03:00
|
|
|
pull_request:
|
2023-06-28 12:56:02 +03:00
|
|
|
merge_group:
|
2023-03-28 06:52:19 +03:00
|
|
|
branches:
|
|
|
|
- master
|
2023-05-10 04:27:07 +03:00
|
|
|
- v[0-9]+.[0-9]+.x-staging
|
|
|
|
- v[0-9]+.[0-9]+.x
|
|
|
|
paths-ignore:
|
|
|
|
- README.md
|
|
|
|
- .github/**
|
|
|
|
- '!.github/workflows/build.yml'
|
2023-06-17 12:49:07 +03:00
|
|
|
- '!.github/actions/build-rust/action.yml'
|
|
|
|
- '!.github/actions/setup-node/action.yml'
|
2022-12-30 16:40:15 +03:00
|
|
|
|
2023-05-10 13:38:23 +03:00
|
|
|
env:
|
|
|
|
DEBUG: napi:*
|
2023-06-29 12:25:42 +03:00
|
|
|
BUILD_TYPE: canary
|
2023-05-10 13:38:23 +03:00
|
|
|
APP_NAME: affine
|
2023-08-29 13:07:05 +03:00
|
|
|
AFFINE_ENV: dev
|
2023-06-09 19:46:24 +03:00
|
|
|
COVERAGE: true
|
2023-08-20 22:29:22 +03:00
|
|
|
DISTRIBUTION: browser
|
2023-05-10 13:38:23 +03:00
|
|
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
2023-06-19 18:07:40 +03:00
|
|
|
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
2023-05-10 13:38:23 +03:00
|
|
|
|
2022-12-30 16:40:15 +03:00
|
|
|
jobs:
|
2023-03-28 20:48:40 +03:00
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
2023-07-03 14:09:17 +03:00
|
|
|
with:
|
|
|
|
electron-install: false
|
2023-06-29 07:13:35 +03:00
|
|
|
- name: Run i18n codegen
|
|
|
|
run: yarn i18n-codegen gen
|
|
|
|
- name: Run ESLint
|
2023-07-06 06:49:17 +03:00
|
|
|
run: yarn lint:eslint --max-warnings=0
|
2023-06-29 07:13:35 +03:00
|
|
|
- name: Run Prettier
|
2023-07-03 14:09:17 +03:00
|
|
|
# Set nmMode in `actions/setup-node` will modify the .yarnrc.yml
|
|
|
|
run: |
|
|
|
|
git checkout .yarnrc.yml
|
2023-07-06 06:49:17 +03:00
|
|
|
yarn lint:prettier
|
2023-06-29 07:13:35 +03:00
|
|
|
- name: Run circular
|
|
|
|
run: yarn circular
|
2023-08-03 07:47:05 +03:00
|
|
|
- name: Run Type Check
|
|
|
|
run: yarn typecheck
|
2023-03-28 20:48:40 +03:00
|
|
|
|
2023-09-05 04:37:38 +03:00
|
|
|
check-yarn-binary:
|
|
|
|
name: Check yarn binary
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Run check
|
|
|
|
run: |
|
|
|
|
yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])")
|
|
|
|
git diff --exit-code
|
|
|
|
|
2023-08-10 08:05:34 +03:00
|
|
|
build-prototype:
|
|
|
|
name: Build Prototype
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
electron-install: false
|
|
|
|
- name: Build Prototype
|
|
|
|
run: yarn nx build prototype
|
|
|
|
- name: Upload prototype artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: prototype
|
|
|
|
path: ./apps/prototype/dist
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2023-06-25 16:18:23 +03:00
|
|
|
build-docs:
|
|
|
|
name: Build Docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
2023-07-03 14:09:17 +03:00
|
|
|
with:
|
|
|
|
electron-install: false
|
2023-06-25 16:18:23 +03:00
|
|
|
- run: yarn nx build @affine/docs
|
|
|
|
env:
|
|
|
|
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
|
|
|
|
2023-07-29 05:43:52 +03:00
|
|
|
e2e-plugin-test:
|
|
|
|
name: E2E Plugin Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
playwright-install: true
|
|
|
|
electron-install: false
|
|
|
|
- name: Run playwright tests
|
|
|
|
run: yarn e2e --forbid-only
|
|
|
|
working-directory: tests/affine-plugin
|
|
|
|
env:
|
|
|
|
COVERAGE: true
|
|
|
|
- name: Collect code coverage report
|
|
|
|
run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
|
|
|
|
|
|
|
- name: Upload e2e test coverage results
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
files: ./.coverage/lcov.info
|
|
|
|
flags: e2e-plugin-test
|
|
|
|
name: affine
|
|
|
|
fail_ci_if_error: false
|
|
|
|
|
|
|
|
- name: Upload test results
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: test-results-e2e-plugin
|
|
|
|
path: ./test-results
|
|
|
|
if-no-files-found: ignore
|
|
|
|
|
2023-08-10 08:05:34 +03:00
|
|
|
e2e-prototype-test:
|
|
|
|
name: E2E Prototype Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
needs: build-prototype
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
playwright-install: true
|
|
|
|
electron-install: false
|
|
|
|
- name: Download prototype artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: prototype
|
|
|
|
path: ./apps/prototype/dist
|
|
|
|
- name: Run playwright tests
|
|
|
|
run: yarn e2e --forbid-only
|
|
|
|
working-directory: tests/affine-prototype
|
|
|
|
env:
|
|
|
|
COVERAGE: true
|
|
|
|
|
|
|
|
# - name: Collect code coverage report
|
|
|
|
# run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
|
|
|
|
|
|
|
# - name: Upload e2e test coverage results
|
|
|
|
# uses: codecov/codecov-action@v3
|
|
|
|
# with:
|
|
|
|
# token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
# files: ./.coverage/lcov.info
|
|
|
|
# flags: e2etest-prototype
|
|
|
|
# name: affine
|
|
|
|
# fail_ci_if_error: false
|
|
|
|
|
|
|
|
- name: Upload test results
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: test-results-e2e-prototype
|
|
|
|
path: ./test-results
|
|
|
|
if-no-files-found: ignore
|
|
|
|
|
2023-03-07 14:24:41 +03:00
|
|
|
e2e-test:
|
|
|
|
name: E2E Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-07-01 13:47:26 +03:00
|
|
|
shard: [1, 2, 3, 4, 5]
|
2022-12-30 16:40:15 +03:00
|
|
|
environment: development
|
|
|
|
steps:
|
2023-02-06 18:21:23 +03:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-24 18:44:14 +03:00
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
2023-03-28 07:21:51 +03:00
|
|
|
with:
|
|
|
|
playwright-install: true
|
2023-07-03 14:09:17 +03:00
|
|
|
electron-install: false
|
2022-12-30 16:40:15 +03:00
|
|
|
|
2023-03-07 14:24:41 +03:00
|
|
|
- name: Run playwright tests
|
2023-06-09 19:46:24 +03:00
|
|
|
run: yarn e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
2023-07-13 12:05:01 +03:00
|
|
|
working-directory: tests/affine-local
|
2023-03-07 14:24:41 +03:00
|
|
|
env:
|
|
|
|
COVERAGE: true
|
2023-02-06 18:21:23 +03:00
|
|
|
|
|
|
|
- name: Collect code coverage report
|
2023-03-20 10:05:02 +03:00
|
|
|
run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
2023-02-06 18:21:23 +03:00
|
|
|
|
|
|
|
- name: Upload e2e test coverage results
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
files: ./.coverage/lcov.info
|
|
|
|
flags: e2etest
|
|
|
|
name: affine
|
2023-06-29 12:39:16 +03:00
|
|
|
fail_ci_if_error: false
|
2023-02-06 18:21:23 +03:00
|
|
|
|
|
|
|
- name: Upload test results
|
|
|
|
if: ${{ failure() }}
|
2023-05-10 13:38:23 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
2023-02-06 18:21:23 +03:00
|
|
|
with:
|
2023-04-14 00:22:49 +03:00
|
|
|
name: test-results-e2e-${{ matrix.shard }}
|
2023-03-07 14:24:41 +03:00
|
|
|
path: ./test-results
|
|
|
|
if-no-files-found: ignore
|
|
|
|
|
2023-06-27 22:10:08 +03:00
|
|
|
e2e-migration-test:
|
|
|
|
name: E2E Migration Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
2023-08-03 02:50:10 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
spec:
|
|
|
|
- { package: 0.7.0-canary.18 }
|
|
|
|
- { package: 0.8.0-canary.7 }
|
2023-09-06 10:44:53 +03:00
|
|
|
- { package: 0.8.3 }
|
2023-06-27 22:10:08 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
playwright-install: true
|
2023-07-03 14:09:17 +03:00
|
|
|
electron-install: false
|
2023-06-27 22:10:08 +03:00
|
|
|
|
|
|
|
- name: Unzip
|
|
|
|
run: yarn unzip
|
2023-08-03 02:50:10 +03:00
|
|
|
working-directory: ./tests/affine-legacy/${{ matrix.spec.package }}
|
2023-06-27 22:10:08 +03:00
|
|
|
|
2023-08-03 02:50:10 +03:00
|
|
|
- name: Run playwright tests
|
2023-06-27 22:10:08 +03:00
|
|
|
run: yarn e2e --forbid-only
|
2023-08-03 02:50:10 +03:00
|
|
|
working-directory: ./tests/affine-legacy/${{ matrix.spec.package }}
|
2023-06-29 09:52:31 +03:00
|
|
|
|
2023-06-29 09:50:26 +03:00
|
|
|
- name: Upload test results
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-08-03 02:50:10 +03:00
|
|
|
name: test-results-e2e-migration-${{ matrix.spec.package }}
|
|
|
|
path: ./tests/affine-legacy/${{ matrix.spec.package }}/test-results
|
2023-06-29 09:50:26 +03:00
|
|
|
if-no-files-found: ignore
|
|
|
|
|
2023-03-07 14:24:41 +03:00
|
|
|
unit-test:
|
|
|
|
name: Unit Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: development
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-03-24 18:44:14 +03:00
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
2023-07-03 14:09:17 +03:00
|
|
|
with:
|
|
|
|
electron-install: false
|
2023-03-07 14:24:41 +03:00
|
|
|
|
|
|
|
- name: Unit Test
|
2023-06-09 19:46:24 +03:00
|
|
|
run: yarn nx test:coverage @affine/monorepo
|
2023-03-07 14:24:41 +03:00
|
|
|
|
|
|
|
- name: Upload unit test coverage results
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
files: ./.coverage/store/lcov.info
|
|
|
|
flags: unittest
|
|
|
|
name: affine
|
2023-06-29 12:39:16 +03:00
|
|
|
fail_ci_if_error: false
|