From 51264758990bf94039f154116412447016c0de9f Mon Sep 17 00:00:00 2001 From: StepanMoc Date: Thu, 9 May 2024 19:48:48 +0200 Subject: [PATCH] changed build-frontend.yml and build-backend.yml --- .github/workflows/build-backend.yml | 43 +++++++--------- .github/workflows/build-frontend.yml | 11 ++-- .github/workflows/deploy-app.yml | 5 +- .github/workflows/development.yml | 51 ------------------- .../src/main/resources/application-prod.yml | 2 +- backend/src/main/resources/application.yml | 2 +- 6 files changed, 29 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/development.yml diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index da5a35b..fb121b1 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -3,9 +3,9 @@ run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}" on: push: - branches: ["main"] + branches: [ "main" ] pull_request: - branches: ["main"] + branches: [ "main" ] jobs: backend: @@ -16,27 +16,22 @@ jobs: run: working-directory: backend steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up JDK 17 for backend - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin + - name: Build and test backend + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + cache-dependency-path: | + backend/*.gradle* + backend/**/gradle-wrapper.properties + - run: ./gradlew build --no-daemon - - name: setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - generate-job-summary: true - add-job-summary-as-pr-comment: on-failure - cache-disabled: true - - - name: Build backend and run tests with Gradle Wrapper - run: ./gradlew build - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: backend - file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: backend + file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml index 5488e81..b83cf82 100644 --- a/.github/workflows/build-frontend.yml +++ b/.github/workflows/build-frontend.yml @@ -3,9 +3,9 @@ run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}" on: push: - branches: ["main"] + branches: [ "main" ] pull_request: - branches: ["main"] + branches: [ "main" ] jobs: build: @@ -17,14 +17,13 @@ jobs: working-directory: frontend steps: - uses: actions/checkout@v3 - - name: Use Node.js 20.x + + - name: Install dependencies uses: actions/setup-node@v3 with: - node-version: 20.x + node-version: 20 cache: 'npm' cache-dependency-path: frontend/package-lock.json - - - name: Install dependencies run: npm install - name: Build diff --git a/.github/workflows/deploy-app.yml b/.github/workflows/deploy-app.yml index 5971e72..bf31b1a 100644 --- a/.github/workflows/deploy-app.yml +++ b/.github/workflows/deploy-app.yml @@ -3,6 +3,9 @@ run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}" on: workflow_dispatch: + pull_request: + branches: + - main jobs: deploy-backend: @@ -15,7 +18,6 @@ jobs: heroku_api_key: ${{secrets.HEROKU_API_KEY}} heroku_app_name: ${{ secrets.HEROKU_BACKEND_NAME }} heroku_email: ${{ secrets.HEROKU_EMAIL }} - branch: 'main' appdir: 'backend' procfile: 'web: java $JAVA_OPTS -Dserver.port=$PORT -jar build/libs/backend-1.0.0.jar --spring.profiles.active=prod' @@ -29,5 +31,4 @@ jobs: heroku_api_key: ${{secrets.HEROKU_API_KEY}} heroku_app_name: ${{ secrets.HEROKU_FRONTEND_NAME }} heroku_email: ${{ secrets.HEROKU_EMAIL }} - branch: 'main' appdir: 'frontend' diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml deleted file mode 100644 index 9105623..0000000 --- a/.github/workflows/development.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Development -run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}" - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -permissions: - contents: read - -jobs: - build-backend: - name: Build backend - runs-on: ubuntu-latest - defaults: - run: - working-directory: backend - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 17 for backend - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Cache Gradle packages - id: gradle-cache - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Build backend - run: ./gradlew build -x test - - - name: Run tests - run: ./gradlew jacocoTestReport - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: backend - file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml diff --git a/backend/src/main/resources/application-prod.yml b/backend/src/main/resources/application-prod.yml index da7c9d6..8871d5e 100644 --- a/backend/src/main/resources/application-prod.yml +++ b/backend/src/main/resources/application-prod.yml @@ -31,6 +31,6 @@ spring: password: ${SECURITY_PASSWORD} jwt: secure: true - sameSite: "none" + sameSite: "Strict" duration: 86400000 # 1 day secret: ${JWT_SECRET} diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 45cda93..42f967a 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -21,6 +21,6 @@ spring: default_schema: public jwt: secure: true - sameSite: "none" + sameSite: "Strict" duration: 86400000 # 1 day secret: "7A25432A462D4A614E645267556B58703272357538782F413F4428472B4B6250" # random string in base64, should be changed in production