-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 1.61 KB
/
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
name: test
on:
workflow_call:
jobs:
test-selector:
runs-on: ubuntu-latest
outputs:
topics: ${{ steps.get_topics.outputs.topics }}
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- id: get_topics
name: Get repo topics
run: |
TOKEN=${{ secrets.GITHUB_TOKEN }}
REPO=${{ github.repository }}
RESPONSE=$(curl -s -H "Accept: application/vnd.github.mercy-preview+json" -H "Authorization: token $TOKEN" https://api.github.com/repos/$REPO/topics)
TOPICS=$(echo $RESPONSE | jq -r '.names[]' | tr '\n' ',')
echo "Repo topics are $TOPICS"
echo "::set-output name=topics::$TOPICS"
react-test:
needs: test-selector
runs-on: ubuntu-latest
if: contains(needs.test-selector.outputs.topics, 'react')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
- uses: cypress-io/github-action@v6
with:
start: npm run dev
browser: chrome
headed: true
node-test:
needs: test-selector
runs-on: ubuntu-latest
if: contains(needs.test-selector.outputs.topics, 'node')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- run: npm ci
- name: Run lint
run: npm run lint
- name: Run tests
run: npm test