Update dependency start-server-and-test to v2.0.8 #2234
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: ci | |
on: [push] | |
jobs: | |
install: | |
runs-on: ubuntu-20.04 | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
# check out all commits to get accurate created date | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Print Node version 🖨️ | |
run: node -v | |
# only install dependencies using | |
# https://github.com/cypress-io/github-action | |
# will restore / create folders | |
# ~/.npm | |
# ~/.cache/Cypress | |
- name: Install 📦 | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
- name: Set Cypress version 🎁 | |
id: cypress | |
run: echo "version=$(node ./src/print-cypress-version)" >> $GITHUB_OUTPUT | |
- name: Print Cypress version 🖨 | |
run: echo "Cypress version is ${{ steps.cypress.outputs.version }}" | |
# will create folder ./public | |
- name: Build site 🏗 | |
run: npm run docs:build | |
# will create new JS files inside ./docs | |
- name: Export Markdown specs 🖨 | |
run: node ./md-to-js http://localhost:5000/cypress-examples/ | |
- name: Catch stray .only tests 🚦 | |
run: npm run stop-only | |
# we do not want to run all specs together | |
# since I believe it to be a really bad practice | |
# only pass the local folders we built / updated | |
# ./docs and ./public | |
# TIP: we want to avoid uploading node_modules since it is SLOW | |
# https://glebbahmutov.com/blog/parallel-cypress-tests-gh-action/ | |
- name: Save built folders 🆙 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built | |
path: | | |
docs | |
public | |
test-link: | |
runs-on: ubuntu-20.04 | |
needs: install | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Print Node version 🖨️ | |
run: node -v | |
- name: Download built folders ⏬ | |
uses: actions/download-artifact@v4 | |
with: | |
name: built | |
- name: Install 📦 | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
- name: Check just the room md 🦷 | |
run: npx markdown-link-check --config ./links-check-config.json --verbose ./docs/index.md | |
- name: Check links ⚓️ | |
run: npm run check:links | |
test-markdown: | |
runs-on: ubuntu-20.04 | |
needs: install | |
strategy: | |
# when one test fails, DO NOT cancel the other | |
# containers, because this will kill Cypress processes | |
# leaving the Dashboard hanging ... | |
# https://github.com/cypress-io/github-action/issues/48 | |
fail-fast: false | |
matrix: | |
# run N copies of the current job in parallel | |
containers: [1, 2, 3, 4, 5, 6, 7] | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Print Node version 🖨️ | |
run: node -v | |
- name: Download built folders ⏬ | |
uses: actions/download-artifact@v4 | |
with: | |
name: built | |
# download cached ~/.npm and ~/.cache/Cypress | |
# and install node_modules | |
- name: Cypress tests 🧪 | |
uses: cypress-io/github-action@v6 | |
# run all tests straight from Markdown files | |
# using Cypress GH action | |
# https://github.com/cypress-io/github-action | |
with: | |
record: true | |
parallel: true | |
group: 1. Markdown | |
tag: markdown | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.recordKey }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: See any changed files 👀 | |
run: git status | |
# if there are any updated PNG images, commit and push them | |
- name: Commit any changed images 💾 | |
# https://github.com/stefanzweifel/git-auto-commit-action | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
# only perform it for the master branch | |
if: github.ref == 'refs/heads/master' | |
with: | |
commit_message: Updated screenshots | |
branch: master | |
file_pattern: '*.png' | |
test-js: | |
runs-on: ubuntu-20.04 | |
# temporarily skip testing JavaScript | |
# https://github.com/bahmutov/cypress-examples/issues/137 | |
if: ${{ false }} | |
needs: deploy | |
strategy: | |
# when one test fails, DO NOT cancel the other | |
# containers, because this will kill Cypress processes | |
# leaving the Dashboard hanging ... | |
# https://github.com/cypress-io/github-action/issues/48 | |
fail-fast: false | |
matrix: | |
# run 4 copies of the current job in parallel | |
containers: [1, 2, 3, 4] | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Print Node version 🖨️ | |
run: node -v | |
- name: Download built folders ⏬ | |
uses: actions/download-artifact@v4 | |
with: | |
name: built | |
- name: Test built site 🧪 | |
uses: cypress-io/github-action@v6 | |
with: | |
start: npm run serve | |
config-file: cypress-dist.config.js | |
record: true | |
parallel: true | |
# use a custom CI build id to put the JavaScript spec results into a separate run | |
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-javascript' | |
group: 2. JavaScript specs | |
tag: javascript | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.recordKey }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
runs-on: ubuntu-20.04 | |
# do not depend on testing the links | |
# since some external sites are not always available | |
needs: [install, test-markdown] | |
# only deploy from the master branch | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Print Node version 🖨️ | |
run: node -v | |
- name: Download built folders ⏬ | |
uses: actions/download-artifact@v4 | |
with: | |
name: built | |
- name: Install 📦 | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
- name: Set Cypress version 🎁 | |
id: cypress | |
run: echo "version=$(node ./src/print-cypress-version)" >> $GITHUB_OUTPUT | |
# https://github.com/marketplace/actions/github-pages-action | |
- name: Deploy 🚀 | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public/cypress-examples |