-
Notifications
You must be signed in to change notification settings - Fork 6
58 lines (49 loc) · 1.87 KB
/
test.yml
File metadata and controls
58 lines (49 loc) · 1.87 KB
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: [push, workflow_dispatch]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
cache: npm
# Skip this line if not installing your own Node.js packages
- run: npm ci
# Install Testmo CLI tool locally (then use npx testmo .. to run it)
- run: npm install --no-save @testmo/testmo-cli
# Optionally add a couple of fields such as the git hash and link to the build
- run: |
npx testmo automation:resources:add-field --name git --type string \
--value ${GITHUB_SHA:0:7} --resources resources.json
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
npx testmo automation:resources:add-link --name build \
--url $RUN_URL --resources resources.json
# Check if the required variables are available
- run: |
if [[ -z "${TESTMO_URL}" ]]; then
echo "The TESTMO_URL secret is not defined for this repository"
exit 1
fi
if [[ -z "${TESTMO_TOKEN}" ]]; then
echo "The TESTMO_TOKEN secret is not defined for this repository"
exit 1
fi
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
# Run automated tests and report results to Testmo
- run: |
npx testmo automation:run:submit \
--instance "$TESTMO_URL" \
--project-id 1 \
--name "Mocha test run" \
--source "unit-tests" \
--resources resources.json \
--results results/*.xml \
-- npm run mocha-junit # Note space after --
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}