-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (98 loc) · 3.41 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
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
102
103
104
105
106
name: test-all
on:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the commit
tags-ignore:
- 'v*' #avoids rerun existing commit on release
pull_request:
branches:
- 'main'
jobs:
test-java:
runs-on: ubuntu-latest
defaults:
run:
working-directory: java
#if: ${{ false }} # disable for now
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v4
- name: Select Java Version
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Build and test
run: mvn test -Dmaven.test.failure.ignore=true -U --no-transfer-progress
- name: Publish test report
if: always()
uses: mikepenz/[email protected]
with:
check_name: test-report-java
report_paths: '**/target/surefire-reports/TEST-*.xml'
fail_on_failure: 'true'
- if: always()
name: Publish test reports
uses: actions/upload-artifact@v4
with:
name: test-report-java-files
#working-directory does not work here
path: |
java/target/site
java/target/*.html
java/target/tmp*/*.html
test-net:
runs-on: ubuntu-latest
defaults:
run:
working-directory: net
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
dotnet-version: '8.0.x'
- name: Run test
run: dotnet test --logger "trx;LogFileName=../../reports/visual-assert-report.trx" TestVisualAssert/TestVisualAssert.csproj
#Shows message in case of some failure (as test report checks are not always produced)
- name: Failure message if needed
if: failure()
run: echo "::error ::There was a build error or test failure, see the log and diff files in the test report artifacts"
#prevents execute on pr or dependabot that fails with "Resource not accessible by integration" due to permissions
- name: Publish test report
if: ${{ always() && github.actor=='javiertuya' }}
uses: dorny/test-reporter@v1
with:
name: test-report-net
#working-directory does not work here
path: net/reports/visual-assert-report.trx
reporter: dotnet-trx
fail-on-error: 'true'
- if: always()
name: Publish test reports files
uses: actions/upload-artifact@v4
with:
name: test-report-net-files
#working-directory does not work here
path: net/reports
publish-java-snapshot:
#if: ${{ false }} # disable for now
#avoid publishing PRs and dependabot branches
if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/dashgit/combined/') }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
defaults:
run:
working-directory: java
steps:
- uses: javiertuya/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: java
java-version: '8'
mvn-deploy-args: '-P publish-github -DskipTests=true -Dmaven.test.failure.ignore=false -U --no-transfer-progress'
delete-old-snapshots: true
min-snapshots-to-keep: 4