Enhancement: add github actions caching option #3411
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: Run e2e tests | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize # canary on new commit | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all tags for ship-it | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
**/node_modules | |
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/lerna.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}- | |
${{ runner.os }}-build- | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
# Increase the Jest timeout | |
echo "module.exports = { testTimeout: 30000 };" > jest.config.js | |
npm run test |