1212 - cron : 0 18 * * *
1313
1414 # Allows you to run this workflow manually from the Actions tab
15- workflow_dispatch : { }
15+ workflow_dispatch : {}
1616
1717jobs :
1818 check :
@@ -24,19 +24,32 @@ jobs:
2424
2525 - uses : actions/setup-node@v3
2626 with :
27- node-version : ' 16 '
27+ node-version : " 16 "
2828 cache : yarn
2929
30- - uses : actions/cache@v3
31- with :
32- path : ' **/node_modules'
33- key : ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
34-
3530 - id : install
3631 run : yarn install --immutable
3732
3833 - run : yarn build
3934
35+ - run : yarn workspace @unflakable/cypress-plugin pack
36+ - uses : actions/upload-artifact@v3
37+ with :
38+ name : cypress-plugin
39+ path : packages/cypress-plugin/package.tgz
40+
41+ - run : yarn workspace @unflakable/jest-plugin pack
42+ - uses : actions/upload-artifact@v3
43+ with :
44+ name : jest-plugin
45+ path : packages/jest-plugin/package.tgz
46+
47+ - run : yarn workspace @unflakable/js-api pack
48+ - uses : actions/upload-artifact@v3
49+ with :
50+ name : js-api
51+ path : packages/js-api/package.tgz
52+
4053 - if : ${{ always() && steps.install.outcome == 'success' }}
4154 run : yarn lint
4255
5669 # it's ignored for PR events, but that's fine.
5770 base : ${{ github.ref }}
5871 filters : |
72+ cypress:
73+ - package.json
74+ - tsconfig.json
75+ - .github/workflows/ci.yaml
76+ - packages/cypress-plugin/**
77+ - packages/js-api/**
78+ - packages/plugins-common/**
5979 jest:
6080 - package.json
6181 - tsconfig.json
@@ -65,10 +85,86 @@ jobs:
6585 - packages/plugins-common/**
6686 - scripts/set-jest-version.ts
6787 outputs :
88+ affects_cypress : ${{ steps.affects_plugins.outputs.cypress }}
6889 affects_jest : ${{ steps.affects_plugins.outputs.jest }}
6990
91+ cypress_integration_tests :
92+ name : " Cypress Integration Tests: Cypress ${{ matrix.cypress }} + Node ${{ matrix.node }}"
93+ # FIXME: also test on Windows
94+ runs-on : ubuntu-latest
95+ timeout-minutes : 45
96+ needs :
97+ # Don't incur the cost of the test matrix if the basic build fails.
98+ - check
99+ if : github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.check.outputs.affects_cypress == 'true'
100+ strategy :
101+ fail-fast : false
102+ matrix :
103+ node :
104+ - 16
105+ - 18
106+ - 20
107+ cypress :
108+ # FIXME: support earlier versions
109+ # - "10.0"
110+ # - "10.11"
111+ # - "11.0"
112+ - " 11.2"
113+ - " 12.0"
114+ - " 12.10"
115+ - " 12.14"
116+ steps :
117+ - uses : actions/checkout@v3
118+
119+ - uses : actions/setup-node@v3
120+ with :
121+ node-version : ${{ matrix.node }}
122+ cache : yarn
123+
124+ - name : Cache Cypress binary
125+ uses : actions/cache@v3
126+ with :
127+ path : ~/.cache/Cypress
128+ key : cypress-${{ runner.os }}-node${{ matrix.node }}-cypress${{ matrix.cypress }}-modules-${{ hashFiles('yarn.lock') }}
129+
130+ - id : install
131+ run : yarn install --immutable
132+
133+ - name : Set Cypress version
134+ run : |
135+ yarn set resolution "cypress@npm:10 - 12" ${{ matrix.cypress }}
136+ grep --after-context=1 "^\".*cypress.*" yarn.lock
137+
138+ - run : yarn build:plugins && yarn build:cypress-tests
139+
140+ - name : Test
141+ env :
142+ # Enable debug logs within the Jest tests that run Cypress. WARNING: these are very
143+ # verbose but are useful for seeing the raw chalk terminal codes.
144+ # DEBUG: unflakable:*
145+
146+ # Enable debug logs within the Cypress plugin.
147+ # TEST_DEBUG: unflakable:*
148+
149+ # Enable terminal colors for debug() output.
150+ DEBUG_COLORS : " 1"
151+
152+ # Make chalk emit TTY colors.
153+ FORCE_COLOR : " 1"
154+ run : |
155+ if [ "${{ github.repository }}" == "unflakable/unflakable-javascript" ]; then
156+ export UNFLAKABLE_SUITE_ID=2QwtGckRudLNUGBsdkVEoSknck1
157+ else
158+ export UNFLAKABLE_SUITE_ID=2Qwt9RyPIbOI95C6qjXCzcTelni
159+ fi
160+ UNFLAKABLE_API_KEY=${{ secrets.UNFLAKABLE_API_KEY }} \
161+ yarn workspace cypress-integration test \
162+ --reporters @unflakable/jest-plugin/dist/reporter \
163+ --runner @unflakable/jest-plugin/dist/runner
164+
70165 jest_integration_tests :
71166 name : " Jest Integration Tests: Jest ${{ matrix.jest }} + Node ${{ matrix.node }}"
167+ # FIXME: also test on Windows
72168 runs-on : ubuntu-latest
73169 timeout-minutes : 15
74170 needs :
@@ -118,11 +214,6 @@ jobs:
118214 node-version : ${{ matrix.node }}
119215 cache : yarn
120216
121- - uses : actions/cache@v3
122- with :
123- path : ' **/node_modules'
124- key : ${{ runner.os }}-node${{ matrix.node }}-jest${{ matrix.jest }}-modules-${{ hashFiles('yarn.lock') }}
125-
126217 - id : install
127218 run : yarn install --immutable
128219
0 commit comments