Handle browser / page crash gracefully #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Examples (branch) | |
on: | |
push: | |
branches-ignore: | |
- master | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
find-examples: | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
name: Prepare | |
run: echo "matrix=$(node -p "JSON.stringify(fs.readdirSync('examples').filter(f => f !== 'readme.md'))")" >> $GITHUB_OUTPUT | |
- run: npm -v | |
build-package: | |
runs-on: ubuntu-20.04 | |
container: | |
image: cypress/base:20.5.0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache NPM modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm-linux@latest | |
- name: Cache Cypress binaries | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/Cypress | |
key: cypress-linux@latest | |
- name: Change owner | |
run: "chown root: ." | |
- name: Dependencies | |
env: | |
CYPRESS_INSTALL_BINARY: "0" | |
run: | | |
npm install | |
- name: Build | |
run: npm run build | |
- name: Pack | |
run: npm pack | |
- name: Store dirty build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: badeball-* | |
example: | |
needs: | |
- find-examples | |
- build-package | |
runs-on: ubuntu-20.04 | |
container: | |
image: cypress/base:20.5.0 | |
strategy: | |
matrix: | |
example: ${{fromJson(needs.find-examples.outputs.matrix)}} | |
env: | |
NPM_CONFIG_PACKAGE_LOCK: "false" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache NPM modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm@${{ matrix.example }} | |
- name: Cache Cypress binaries | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/Cypress | |
key: cypress-examples | |
# In lack of native support, https://github.com/actions/checkout/issues/172. | |
- name: Make checkout sparse | |
run: | | |
shopt -s extglob | |
rm -rf examples/!(${{ matrix.example }}) | |
rm -rf !(examples) | |
- name: Retrieve dirty build | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: examples/${{ matrix.example }} | |
- name: Install NPM modules | |
working-directory: examples/${{ matrix.example }} | |
run: npm install | |
- name: Install dirty build | |
working-directory: examples/${{ matrix.example }} | |
run: npm install badeball-* | |
- name: Run Cypress | |
working-directory: examples/${{ matrix.example }} | |
run: | | |
if [[ "${{ matrix.example }}" == ct-* ]]; then | |
npx cypress run --component | |
else | |
npx cypress run --e2e | |
fi |