-
Notifications
You must be signed in to change notification settings - Fork 27
85 lines (74 loc) · 2.87 KB
/
ci.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: ci
on: [push]
jobs:
tests:
runs-on: ubuntu-20.04
env:
# pass TestRail settings from the project secrets
# via environment variables
TESTRAIL_HOST: ${{secrets.TESTRAIL_HOST}}
TESTRAIL_USERNAME: ${{secrets.TESTRAIL_USERNAME}}
TESTRAIL_PASSWORD: ${{secrets.TESTRAIL_PASSWORD}}
# the project ID is not that secret
TESTRAIL_PROJECTID: 1
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Checkout 🛎
uses: actions/checkout@v3
# Install NPM dependencies, cache them correctly
- name: Install 📦
uses: cypress-io/github-action@v5
with:
runTests: false
# verify that all case IDs in the spec files are valid
# for this TestRail project
- name: Check case IDs 🔎
run: |
runId=$(node ./bin/testrail-check-case-ids.js --find-specs)
env:
DEBUG: cypress-testrail-simple
# you can pass GitHub information in the name and description
# to include in the TestRail run information
# https://docs.github.com/en/actions/learn-github-actions/contexts
- name: Start TestRail Run 🏃🏻♂️
id: testRail
run: |
commitSubject="${{ github.event.commits[0].message }}"
runName="Testing on GitHub Actions: ${commitSubject}"
runDescription="Cypress tests for commit ${GITHUB_SHA} ${GITHUB_REF}"
echo ${commitSubject}
echo ${runName}
echo ${runDescription}
node ./bin/testrail-start-run.js --set-gha-output "${runName}" "${runDescription}"
env:
DEBUG: cypress-testrail-simple
- name: Cypress tests 🧪
uses: cypress-io/github-action@v5
with:
install-command: echo "Already installed"
record: true
group: GitHub Actions
env:
TESTRAIL_RUN_ID: ${{ steps.testRail.outputs.testRailRunId }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# DEBUG: cypress-testrail-simple
- name: Print TestRail run results 📋
if: ${{ always() }}
run: |
node ./bin/testrail-run-results.js --run ${{ steps.testRail.outputs.testRailRunId }}
- name: Close TestRail Run 🏁
# always close the test run, even if the previous steps have failed
if: ${{ always() }}
run: |
node ./bin/testrail-close-run.js ${{ steps.testRail.outputs.testRailRunId }}
- name: Semantic Release 🚀
uses: cycjimmy/semantic-release-action@v3
if: github.ref == 'refs/heads/main'
env:
# github token is automatically created by the GH Action workflow
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# created using semantic-release
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}