Merge pull request #237 from PabloLec/dependabot/github_actions/devel… #408
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- 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@v3 | |
- 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@v3 | |
- 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 |