-
Notifications
You must be signed in to change notification settings - Fork 965
124 lines (103 loc) · 4.29 KB
/
e2e.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Cypress E2E tests
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
cypress-run:
if: github.repository == 'redwoodjs/redwood'
strategy:
matrix:
os: ['ubuntu-latest']
node-version: ['14', '16']
fail-fast: true
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} | Node ${{ matrix.node-version }} latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# For network flakiness. See https://github.com/vercel/next.js/pull/28264
- name: Tune linux network
run: sudo ethtool -K eth0 tx off rx off
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Cache yarn
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Create a temporary directory
id: createpath
run: |
project_path=$(mktemp -d -t redwood.XXXXXX)
echo "::set-output name=project_path::$project_path"
framework_path=$(pwd)
echo "::set-output name=framework_path::$framework_path"
- name: Create a RedwoodJS app
run: ./tasks/run-e2e ${{ steps.createpath.outputs.project_path }} --no-start
- name: Init Git for RedwoodJS app directory
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git init --initial-branch main && git add .
git commit -a --message=init
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Start server in background
run: yarn rw dev --no-generate --fwd="--no-open" &
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Cypress run
uses: cypress-io/github-action@v2
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RW_PATH: "${{ steps.createpath.outputs.project_path }}"
with:
# we've already installed dependencies
install: false
env: true
browser: chrome
record: false
wait-on: 'http://localhost:8910'
working-directory: ./tasks/e2e
spec: |
cypress/integration/01-tutorial/*.spec.js
cypress/integration/04-logger/*.spec.js
- name: Prepare for CLI checks by restoring 01-tutorial end state
run: |
git restore . && git clean -df
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw storybook`
run: yarn rw storybook --smoke-test
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw test api`
run: yarn rw test api --no-watch
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw test web`
run: yarn rw test web --no-watch
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw build` (no prerender)
run: yarn rw build --no-prerender --verbose
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw prerender`
run: yarn rw prerender --verbose
# TODO: We should have a script that verifies this.
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rwfw lint`
# choosing a simple command to verify; --help requires prompt input
run: RWFW_PATH=${{ steps.createpath.outputs.framework_path }} yarn rwfw lint
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw exec` generate and execute
run: yarn rw g script testScript && yarn rw exec testScript
working-directory: ${{ steps.createpath.outputs.project_path }}
- name: Run `rw data-migrate up`
run: yarn rw dm up
working-directory: ${{ steps.createpath.outputs.project_path }}