-
Notifications
You must be signed in to change notification settings - Fork 8
101 lines (85 loc) · 2.85 KB
/
karate_be1-go.yaml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Integration - Go
on:
schedule:
# Run the ci on the latest commit of master every day at 4:00 am
- cron: '00 04 * * *'
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Use go >= 1.21
uses: actions/setup-go@v3
with:
go-version: ">=1.21"
- name: Setup repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
working-directory: ./be1-go
run: |
make build
- name: Run Karate tests
id: tests
continue-on-error: true
working-directory: ./tests/karate
run: mvn test -DargLine=-Dkarate.env=go -Dtest=BackEndTest#fullTest
- name: Publish Cucumber Report
uses: actions/upload-artifact@v3
with:
name: Cucumber Report
path: ./tests/karate/target/go/cucumber-html-reports
- name: Publish HTML Report
uses: actions/upload-artifact@v3
with:
name: HTML Report
path: ./tests/karate/target/karate-reports
- name: Publish Server logs
uses: actions/upload-artifact@v3
with:
name: Go Server Logs
path: ./tests/karate/go.log
# The next actions are pushing the new report to the defined branch
- name: Checkout report branch
uses: actions/checkout@v3
with:
ref: report-karate-be1-go
path: report-repo
- name: Update report
if: ${{ always() }} # execute even if previous steps failed
run: |
rm -rf report-repo/*
mkdir -p report-repo/go
cp -a ./tests/karate/target/go/cucumber-html-reports/. ./report-repo/go/
- name: Get current date
if: ${{ always() }} # execute even if previous steps failed
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Commit files
working-directory: ./report-repo
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git commit -m "Report from ${{ steps.date.outputs.date }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: report-karate-be1-go
directory: report-repo
- name: Fail job if tests were not successful
if: steps.tests.outcome == 'failure'
run: exit 1