-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (109 loc) · 3.29 KB
/
tests.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
name: tests
on:
push:
branches:
- main
- develop
workflow_call:
secrets:
MONGO_USER_TEST:
required: true
MONGO_SECRET_TEST:
required: true
MONGO_CLUSTER:
required: true
MONGO_DATABASE_TEST:
required: true
SONAR_TOKEN:
required: true
jobs:
backend:
name: backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Run Backend build
env:
MONGO_USER: ${{ secrets.MONGO_USER_TEST }}
MONGO_SECRET: ${{ secrets.MONGO_SECRET_TEST }}
MONGO_CLUSTER: ${{ secrets.MONGO_CLUSTER }}
MONGO_DATABASE: ${{ secrets.MONGO_DATABASE_TEST }}
GITHUB_TOKEN: "not_a_token"
run: |
./gradlew clean build --stacktrace --info
- name: Archive tests report
if: always()
uses: actions/upload-artifact@v3
with:
name: Tests report
path: build/reports
frontend:
name: frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/main/vue
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 7
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install typescript vue-tsc@1.2.0 vite -g && pnpm install --no-frozen-lockfile
- name: Run Frontend build
run: vue-tsc --noEmit && vite build
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: [backend, frontend]
steps:
- uses: actions/checkout@v4
- name: Download tests report
uses: actions/download-artifact@v3
with:
name: Tests report
path: build/reports
- name: List current directory
run: tree
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=pablolec
-Dsonar.projectKey=PabloLec_StarryLines
-Dsonar.coverage.jacoco.xmlReportPaths=./build/reports/jacoco/test/jacocoTestReport.xml
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.sources=./src/main/kotlin
-Dsonar.coverage.exclusions=**/Interface.kt,**/SupportedLanguage.kt