Skip to content

Merge pull request #279 from PabloLec/dependabot/npm_and_yarn/src/mai… #438

Merge pull request #279 from PabloLec/dependabot/npm_and_yarn/src/mai…

Merge pull request #279 from PabloLec/dependabot/npm_and_yarn/src/mai… #438

Workflow file for this run

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@v4
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