Add cache fetch testing #127
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: Node.js CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# node-version: [16.x, 18.x] | |
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Use Node.js ${{ matrix.node-version }} | |
- uses: actions/setup-node@v4 | |
with: | |
# node-version: ${{ matrix.node-version }} | |
node-version: 18 | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build --if-present | |
- run: npm test | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
# Linux and MacOS | |
start: npm start | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist/ | |
deploy_github_page: | |
if: github.ref == 'refs/heads/main' | |
needs: build-and-test | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
path: ./dist | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |