-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (109 loc) · 3.21 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
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
name: CI
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
env:
JAVA_VERSION: 17
JAVA_DISTRIBUTION: temurin
GRADLE_VERSION: 7.5
jobs:
lint:
name: 'Lint'
runs-on: ubuntu-latest
steps:
- name: Fetch sources
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
- name: Run linter
run: ./gradlew ktlintCheck
- name: Upload ktlint report
uses: actions/upload-artifact@v3
with:
name: lint-reports
path: build/reports/ktlint
if: always()
test:
name: 'Test'
needs: lint
runs-on: ubuntu-latest
steps:
- name: Fetch sources
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
- name: Run test suite
run: ./gradlew test
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3
- name: Upload test reports
uses: actions/upload-artifact@v3
with:
name: test-reports
path: |
build/reports/tests/test
build/reports/jacoco/test
if: always()
docs:
name: 'Docs'
needs: test
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}
steps:
- name: Fetch sources
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
- name: Generate documentation
run: ./gradlew generateDocs
- name: Generate redoc file
run: npx redoc-cli build docs/openapi3.json -o docs/index.html
- name: Deploy to netlify (main)
if: github.ref == 'refs/heads/main'
run: |
npx netlify-cli deploy --dir=docs --prod
- name: Deploy to netlify (develop)
if: github.ref == 'refs/heads/develop'
run: |
npx netlify-cli deploy --dir=docs --alias develop
- name: Deploy to netlify (preview)
if: github.event_name == 'pull_request'
run: |
npx netlify-cli deploy --json --dir=docs > deployment_data
echo 'deploy_url='$(grep -oP '(?<="deploy_url": ")[^"]*' deployment_data) >> $GITHUB_ENV
- uses: mshick/add-pr-comment@v2
with:
message: |
Check the documentation preview: ${{ env.deploy_url }}
allow-repeats: true