mirror of
https://github.com/Canner/WrenAI.git
synced 2026-10-16 15:07:41 +08:00
50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
# create the github action to run the UI tests when PR created
|
|
|
|
name: Wren-UI Test
|
|
|
|
on:
|
|
pull_request:
|
|
types: [ labeled, synchronize ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
# avoid mis-canceling the ci runs while other labels are added to the PR, so we add the label name as the condition
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.label.name == 'ci/ui' && github.event.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: wren-ui
|
|
|
|
jobs:
|
|
unit-test:
|
|
# run this job only if the PR is labeled with "ci/ui"
|
|
if: ${{ github.event.label.name == 'ci/ui'}}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
- uses: actions/cache@v2
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
with:
|
|
path: | # should cache node_modules as well
|
|
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
- if: ${{ steps.yarn-cache.cache-hit != 'true' }}
|
|
name: List the state of node modules
|
|
continue-on-error: true
|
|
run: yarn list
|
|
- name: Install dependencies
|
|
run: yarn
|
|
- name: Run tests
|
|
run: yarn test |