-
Notifications
You must be signed in to change notification settings - Fork 34
68 lines (56 loc) · 2.07 KB
/
lint-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Lint and test workflow
on:
workflow_call:
inputs:
workspace:
required: true
description: the workspace to run the linting and tests for. Input one of "runner", "designer", or "model"
type: string
jobs:
lint-and-test:
if: ${{!contains(github.event.head_commit.message, 'chore(deps-dev)')}}
runs-on: ubuntu-latest
name: lint and test ${{inputs.workspace}}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{inputs.workspace}}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{inputs.workspace}}
- name: Install project deps
run: yarn
- name: Install dependencies
run: yarn ${{inputs.workspace}} install
- name: Check existing forms
if: ${{ inputs.workspace == 'runner' }}
run: yarn runner check-forms
- name: Build dependencies
run: yarn build:dependencies
- name: Lint
run: yarn ${{inputs.workspace}} lint
- name: Test
run: yarn ${{inputs.workspace}} test-cov
- name: Upload test results artifacts
uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: test-results-${{inputs.workspace}}
path: ${{inputs.workspace}}/test-results
retention-days: 14
- name: Upload test coverage artifacts
uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: test-coverage-${{inputs.workspace}}
path: ${{inputs.workspace}}/test-coverage
retention-days: 14