Skip to content

chore(packages): update actions/cache action to v4 #584

chore(packages): update actions/cache action to v4

chore(packages): update actions/cache action to v4 #584

Workflow file for this run

name: CI Pull Request
on: pull_request
jobs:
#
# Cancel any workflows that would be duplicated by this run
#
cleanup-runs:
name: Cancel Duplicates
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/release'"
#
# Build the library
#
library_build:
name: Compile Library
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Check last commit message
id: skip
uses: atlwendy/retrieve-commit-messages-from-pr@v2
- name: Set SHOULD_RUN flag
run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
if: env.SHOULD_RUN == 'true'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true' && steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
- name: Manual build
run: yarn library:build:prod
if: env.SHOULD_RUN == 'true'
- name: Upload built files
uses: actions/upload-artifact@v1
with:
name: built-library
path: dist/library
if: env.SHOULD_RUN == 'true'
#
# Test the library
#
library_test:
name: Test Library
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Check last commit message
id: skip
uses: atlwendy/retrieve-commit-messages-from-pr@v2
- name: Set SHOULD_RUN flag
run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
if: env.SHOULD_RUN == 'true'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true' && steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
- name: Run all tests
run: tooling/ci/test-unit.sh
if: env.SHOULD_RUN == 'true'
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: code-coverage-report
path: coverage/lcov-report
if: env.SHOULD_RUN == 'true'
#
# Lint all files
#
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Check last commit message
id: skip
uses: atlwendy/retrieve-commit-messages-from-pr@v2
- name: Set SHOULD_RUN flag
run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
if: env.SHOULD_RUN == 'true'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true' && steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
- name: Lint all library files
run: yarn run library:lint & yarn run demo:lint & yarn run vr:lint
if: env.SHOULD_RUN == 'true'
#
# Build the demos
#
demos_build:
name: Compile Demos
needs: library_build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Check last commit message
id: skip
uses: atlwendy/retrieve-commit-messages-from-pr@v2
- name: Set SHOULD_RUN flag
run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
if: env.SHOULD_RUN == 'true'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true' && steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
- name: Download built library
uses: actions/download-artifact@v1
with:
name: built-library
path: dist/library
if: env.SHOULD_RUN == 'true'
- name: Build demos with AoT
run: tooling/ci/build-demos-aot.sh
if: env.SHOULD_RUN == 'true'
- name: Inject new library version
run: tooling/ci/inject-library-version-number.sh
if: env.SHOULD_RUN == 'true'
- name: Upload built files
uses: actions/upload-artifact@v1
with:
name: built-demos
path: dist/demo
if: env.SHOULD_RUN == 'true'
#
# Run integration test
#
integration_test:
name: Run integration test
needs: demos_build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Check last commit message
id: skip
uses: atlwendy/retrieve-commit-messages-from-pr@v2
- name: Set SHOULD_RUN flag
run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
if: env.SHOULD_RUN == 'true'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true' && steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
- if: env.SHOULD_RUN == 'true'
run: yarn add start-server-and-test
- name: Download built library
uses: actions/download-artifact@v1
with:
name: built-library
path: dist/library
if: env.SHOULD_RUN == 'true'
- name: Download built demo
uses: actions/download-artifact@v1
with:
name: built-demos
path: dist/demo
if: env.SHOULD_RUN == 'true'
- name: Run integration test
run: yarn library:test:integration
if: env.SHOULD_RUN == 'true'
#
# Run regression test
#
regression_test:
name: Run regression test
needs: library_build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get pusher name
run: echo ::set-env name=author::${{ github.event.pull_request.user.login }}
- name: Check last commit message
id: skip
uses: atlwendy/retrieve-commit-messages-from-pr@master
- name: Set SHOULD_RUN flag
run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
if: "! contains(env.author, 'renovate')"
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true'
run: yarn add start-server-and-test
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
if: env.SHOULD_RUN == 'true'
- if: env.SHOULD_RUN == 'true' && steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
- name: Download built library
uses: actions/download-artifact@v1
with:
name: built-library
path: dist/library
if: env.SHOULD_RUN == 'true'
- name: Run regression test
uses: percy/exec-action@v0.3.0
with:
custom-command: yarn run vr:test:regression
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
if: env.SHOULD_RUN == 'true'