2020-09-24 20:07:56 +08:00
|
|
|
# Automate, customize, and execute your software development workflows right in your repository with GitHub Actions.
|
|
|
|
# Documentation: https://docs.github.com/en/actions
|
|
|
|
|
2020-08-14 22:34:43 +08:00
|
|
|
name: build
|
|
|
|
|
2020-10-01 17:48:43 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2020-08-14 22:34:43 +08:00
|
|
|
|
|
|
|
jobs:
|
2020-09-24 23:00:46 +08:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-08-24 16:27:43 +08:00
|
|
|
node-version: [16]
|
2020-09-24 23:00:46 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2022-04-25 20:02:00 +08:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2020-10-01 16:55:56 +08:00
|
|
|
|
2020-09-24 23:00:46 +08:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2022-08-22 19:07:07 +08:00
|
|
|
uses: actions/setup-node@v3.4.1
|
2020-09-24 23:00:46 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
|
2020-10-01 16:55:56 +08:00
|
|
|
- name: Load cached dependencies
|
2022-08-22 20:20:03 +08:00
|
|
|
uses: actions/cache@v3.0.8
|
2020-10-01 17:23:35 +08:00
|
|
|
id: cache
|
2020-10-01 16:55:56 +08:00
|
|
|
with:
|
2020-10-01 17:03:32 +08:00
|
|
|
path: |
|
|
|
|
**/node_modules
|
|
|
|
/home/runner/.cache/Cypress
|
2022-05-10 21:30:14 +08:00
|
|
|
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
|
2020-09-24 23:00:46 +08:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
id: install-dependencies
|
2020-10-01 17:23:35 +08:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-05-10 21:30:14 +08:00
|
|
|
run: npm install
|
2020-09-24 23:00:46 +08:00
|
|
|
|
2022-02-03 21:26:32 +08:00
|
|
|
# - name: Fix code style linting errors
|
|
|
|
# id: lint-fix
|
2022-05-10 21:30:14 +08:00
|
|
|
# run: npm run lint:fix
|
2022-02-03 21:26:32 +08:00
|
|
|
# continue-on-error: true
|
|
|
|
#
|
|
|
|
# - name: Commit fixed linting errors
|
|
|
|
# id: commit
|
|
|
|
# uses: stefanzweifel/git-auto-commit-action@v4
|
|
|
|
# with:
|
|
|
|
# commit_message: "ci: fix code style linting errors"
|
2020-11-18 18:28:24 +08:00
|
|
|
|
2020-09-24 23:00:46 +08:00
|
|
|
- name: Lint code
|
|
|
|
id: lint
|
2022-05-10 21:30:14 +08:00
|
|
|
run: npm run lint
|
2020-09-24 23:00:46 +08:00
|
|
|
|
|
|
|
- name: Send Slack notifications
|
|
|
|
uses: act10ns/slack@v1
|
2020-11-18 18:16:51 +08:00
|
|
|
if: failure()
|
2020-09-24 23:00:46 +08:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
steps: ${{ toJson(steps) }}
|
2020-11-05 16:38:39 +08:00
|
|
|
channel: '#tiptap-notifications'
|
2020-11-18 18:16:51 +08:00
|
|
|
|
2020-08-19 23:30:52 +08:00
|
|
|
test:
|
2020-09-11 18:00:16 +08:00
|
|
|
runs-on: ubuntu-latest
|
2020-08-14 22:34:43 +08:00
|
|
|
|
2020-09-11 17:40:35 +08:00
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
|
2020-08-14 22:34:43 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-08-24 16:27:43 +08:00
|
|
|
node-version: [16]
|
2020-08-14 22:34:43 +08:00
|
|
|
|
|
|
|
steps:
|
2020-08-19 23:28:46 +08:00
|
|
|
|
2022-04-25 20:02:00 +08:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2020-10-01 16:55:56 +08:00
|
|
|
|
2020-08-14 22:34:43 +08:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2022-08-22 19:07:07 +08:00
|
|
|
uses: actions/setup-node@v3.4.1
|
2020-08-14 22:34:43 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2020-08-19 23:28:46 +08:00
|
|
|
|
2020-08-20 21:10:16 +08:00
|
|
|
- name: Run tests with Cypress
|
2020-09-11 17:40:35 +08:00
|
|
|
id: cypress
|
2022-09-26 17:06:01 +08:00
|
|
|
uses: cypress-io/github-action@v4.2.0
|
2020-08-19 23:28:46 +08:00
|
|
|
with:
|
2022-05-10 21:30:14 +08:00
|
|
|
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
start: npm run start
|
2020-08-20 20:45:38 +08:00
|
|
|
wait-on: 'http://localhost:3000'
|
2020-08-20 21:08:42 +08:00
|
|
|
project: ./tests
|
2020-08-19 23:28:46 +08:00
|
|
|
browser: chrome
|
2021-02-24 04:05:07 +08:00
|
|
|
quiet: true
|
2020-08-19 23:28:46 +08:00
|
|
|
|
2020-08-19 23:38:05 +08:00
|
|
|
- name: Export screenshots (on failure only)
|
2022-06-06 23:36:16 +08:00
|
|
|
uses: actions/upload-artifact@v3.1.0
|
2020-08-19 23:28:46 +08:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: cypress-screenshots
|
2020-08-19 23:33:39 +08:00
|
|
|
path: tests/cypress/screenshots
|
2020-10-05 16:00:48 +08:00
|
|
|
retention-days: 7
|
2020-08-19 23:28:46 +08:00
|
|
|
|
2020-08-19 23:38:05 +08:00
|
|
|
- name: Export screen recordings (on failure only)
|
2022-06-06 23:36:16 +08:00
|
|
|
uses: actions/upload-artifact@v3.1.0
|
2020-08-19 23:38:05 +08:00
|
|
|
if: failure()
|
2020-08-19 23:28:46 +08:00
|
|
|
with:
|
|
|
|
name: cypress-videos
|
2020-08-19 23:33:39 +08:00
|
|
|
path: tests/cypress/videos
|
2020-10-05 16:00:48 +08:00
|
|
|
retention-days: 7
|
2020-08-20 20:37:47 +08:00
|
|
|
|
2020-09-11 17:53:48 +08:00
|
|
|
- name: Send Slack notifications
|
2020-09-11 18:19:25 +08:00
|
|
|
uses: act10ns/slack@v1
|
2020-11-18 18:16:51 +08:00
|
|
|
if: failure()
|
2020-09-11 17:40:35 +08:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
steps: ${{ toJson(steps) }}
|
2020-11-05 16:38:39 +08:00
|
|
|
channel: '#tiptap-notifications'
|
2020-09-11 17:40:35 +08:00
|
|
|
|
2020-11-11 21:13:43 +08:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
needs: lint
|
|
|
|
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-08-24 16:27:43 +08:00
|
|
|
node-version: [16]
|
2020-11-11 21:13:43 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2022-04-25 20:02:00 +08:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2020-11-11 21:13:43 +08:00
|
|
|
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2022-08-22 19:07:07 +08:00
|
|
|
uses: actions/setup-node@v3.4.1
|
2020-11-11 21:13:43 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
|
|
|
|
- name: Load cached dependencies
|
2022-08-22 20:20:03 +08:00
|
|
|
uses: actions/cache@v3.0.8
|
2020-11-11 21:13:43 +08:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
**/node_modules
|
|
|
|
/home/runner/.cache/Cypress
|
2022-05-10 21:30:14 +08:00
|
|
|
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
|
2020-11-11 21:13:43 +08:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
id: install-dependencies
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-05-10 21:30:14 +08:00
|
|
|
run: npm install
|
2020-11-11 21:13:43 +08:00
|
|
|
|
|
|
|
- name: Try to build the packages
|
|
|
|
id: build-packages
|
2022-05-10 21:30:14 +08:00
|
|
|
run: npm run build:ci
|
2020-11-11 21:13:43 +08:00
|
|
|
|
|
|
|
- name: Send Slack notifications
|
|
|
|
uses: act10ns/slack@v1
|
2020-11-18 18:16:51 +08:00
|
|
|
if: failure()
|
2020-11-11 21:13:43 +08:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
steps: ${{ toJson(steps) }}
|
|
|
|
channel: '#tiptap-notifications'
|