-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (152 loc) · 4.52 KB
/
main.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Main CI
on:
push:
branches:
- main
env:
CI: true
GITHUB_BRANCH: ${{ github.ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_COMMIT: ${{ github.sha }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ '17' ]
fail-fast: false
name: ${{ matrix.os }} JDK ${{ matrix.java }}
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3.11.0
with:
distribution: 'corretto'
cache: 'gradle'
java-version: ${{ matrix.java }}
- name: Echo JAVA_HOME
run: echo $JAVA_HOME
- name: Echo JAVA version
run: java --version
- name: Cache SonarCloud packages
uses: actions/cache@v3.3.1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Verify Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Echo Gradle version
uses: gradle/gradle-build-action@v2
with:
arguments: --version
- name: Execute clean
uses: gradle/gradle-build-action@v2
with:
arguments: --info --stacktrace clean
- name: Execute check
uses: gradle/gradle-build-action@v2
with:
arguments: --info --stacktrace check
- name: Execute build
uses: gradle/gradle-build-action@v2
with:
arguments: --info --stacktrace build
- name: Sonarcube analyze
uses: gradle/gradle-build-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
arguments: --info --stacktrace sonarqube
- name: Upload reports as an artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: reports-jdk${{ matrix.java }}-${{ matrix.os }}
path: build/reports
retention-days: 2
- name: Upload test results as an artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: junit-results
path: build/test-results
retention-days: 1
- name: Prepare spock reports artifact
run: |
mkdir -p build/gh-pages
cp build/reports/spock/* build/gh-pages
cp docs/gh-pages/* build/gh-pages
- name: Upload spock reports as an artifact
uses: actions/upload-artifact@v3
with:
name: gh-pages
path: build/gh-pages
retention-days: 1
publish-spock-reports:
runs-on: ubuntu-latest
name: Publish Spock Reports
needs: build
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: gh-pages
path: gh-pages-artifact
- name: Get cached gems
uses: actions/cache@v3.3.1
with:
path: gh-pages-artifact
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-
- name: Copy docs
run: |
ls -lha .
ls -lha gh-pages-artifact
sudo apt update
sudo apt install bundler
cd gh-pages-artifact
bundle update
bundle exec github-pages build
touch _site/.nojekyll
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: gh-pages-artifact/_site
enable_jekyll: false
publish-test-results:
runs-on: ubuntu-latest
name: Publish Unit Tests Results
needs: build
if: always()
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: junit-results
path: junit-artifact
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
with:
files: junit-artifact/**/*.xml