Skip to content

Commit

Permalink
Merge pull request #27 from LaurentiuGabriel/patch-2
Browse files Browse the repository at this point in the history
Update safetest.yml to include caching and running the jobs against multiple node versions to ensure backwards compatibility
  • Loading branch information
kolodny committed Apr 3, 2024
2 parents a5edb9d + 05811f1 commit 8cbdbaf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/safetest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,76 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
Safetest-Action:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- name: Set random environment variables
uses: joellefkowitz/[email protected]
with:
names: |
VERCEL_UUID
- run: echo "VERCEL_UUID is ${{ env.VERCEL_UUID }}."

- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."

- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"

- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

- name: Check out repository code
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm install --legacy-peer-deps
run: npm install --legacy-peer-deps

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Build
run: npm run build

- name: Build deploy artifacts
run: node build.js

- name: Build test reporter
run: cd examples/vite-react-ts && npm run report:build && cp dist/report.html ../../build/

- name: Deploy Project deploy artifacts to Vercel
run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: 'Cache docker build for Safetest'
run: node -e 'require("safetest/docker").buildDocker()'

- name: 'Create test artifacts folder'
run: (rm -rf artifacts|| true) && mkdir artifacts

- name: 'Run Safetest tests'
run: node test.js

- name: 'Process artifacts'
run: node process.js

- name: Deploy test artifacts to Vercel
run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} --meta UUID=${{ env.VERCEL_UUID }}

- run: echo "🍏 This job's status is ${{ job.status }}."

0 comments on commit 8cbdbaf

Please sign in to comment.