Main perspectives merge #745
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
# Run tests on push or pull_request | |
# per: https://joelhooks.com/jest-and-github-actions/ | |
# also uses github-actions-reporter.js for reporting | |
# | |
# LOCAL ACTIONS TESTING NOTES: | |
# (this doesn't work because there is no local macos docker image i have found yet) | |
# test github actions locally using act https://github.com/nektos/act | |
# first time install: brew install act | |
# then just run `act` from the command line to test a push action | |
# | |
# REMOTE NOTES (e.g. for after a push has been done and failed): | |
# to see the results of the last github actions run (e.g. on push) | |
# gh run view | |
# ... and select the latest run (and at the end it tells you how to see the detailed errors) | |
name: Node.js CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
Run-all-Jest-Tests: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
# node-version: [14.x, 16.x, 18.x, 19.x] | |
node-version: [20.x,22.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 }} | |
cache: 'npm' | |
# shoulde eventually be a clean install using: - run: npm ci --legacy-peer-deps | |
# - run: npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" | |
- run: npm ci # clean install (deletes node_modules) | |
- run: npm link # necessary for some reason specific to NP dev setup | |
# note: when upgrade to node 16+, add this to the following --max-old-space-size=8192 | |
- run: NODE_OPTIONS=--max-old-space-size=8192 npm run test:ci # run Jest CI version and stop if errors | |
- name: Log Passing Tests ✅ | |
if: ${{ success() }} | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"context": "tests", | |
"state": "success", | |
"description": "Jest Tests passed", | |
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' | |
- name: Log Failed Tests 🚨 | |
if: ${{ failure() }} | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"context": "tests", | |
"state": "failure", | |
"description": "Jest Tests failed", | |
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' | |
Build-All-Plugins: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
node-version: [20.x,22.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 }} | |
cache: 'npm' | |
# shoulde eventually be a clean install using: - run: npm ci --legacy-peer-deps | |
# - run: npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" | |
- run: npm ci # clean install (deletes node_modules) | |
- run: npm link # necessary for some reason specific to NP dev setup | |
# note: when upgrade to node 16+, add this to the following --max-old-space-size=8192 | |
- run: NODE_OPTIONS=--max-old-space-size=8192 node scripts/rollup.js -b -ci # build all plugins and stop if errors | |
- name: Log Plugin Build Success ✅ | |
if: ${{ success() }} | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"context": "tests", | |
"state": "success", | |
"description": "Plugins Build successful", | |
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' | |
- name: Log Plugin Build Failure 🚨 | |
if: ${{ failure() }} | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"context": "tests", | |
"state": "failure", | |
"description": "Plugins Build failed", | |
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' |