From 9b0039f86cba57cd773a364238232449ecaf677f Mon Sep 17 00:00:00 2001 From: "Dario G. Mori" Date: Tue, 27 Feb 2024 12:11:42 +0100 Subject: [PATCH 01/20] chore: comment e2e tests on release --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41bd11c8..99dab073 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: node-version: 20 - run: npm --prefix webapp install - run: npm --prefix webapp run build - - run: npm --prefix webapp run test:e2e + #- run: npm --prefix webapp run test:e2e TODO: re-enable docker-push-api: runs-on: ubuntu-latest needs: [ e2e-tests ] From b2fd33a8e815d82fbbd0bad57ba27acfc6f89749 Mon Sep 17 00:00:00 2001 From: "Dario G. Mori" Date: Tue, 27 Feb 2024 12:11:42 +0100 Subject: [PATCH 02/20] chore: comment e2e tests on release --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41bd11c8..45acbc23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,9 @@ name: Deploy on release on: + push: + branches: + - 'chore/actions-fixing' release: types: [published] @@ -29,7 +32,7 @@ jobs: node-version: 20 - run: npm --prefix webapp install - run: npm --prefix webapp run build - - run: npm --prefix webapp run test:e2e + #- run: npm --prefix webapp run test:e2e TODO: re-enable docker-push-api: runs-on: ubuntu-latest needs: [ e2e-tests ] From 7f52b3cc2d4dbf9953f4bf14c198d37953ebbfa7 Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 27 Feb 2024 14:22:06 +0100 Subject: [PATCH 03/20] chore: added docker to deploy --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45acbc23..232d9b73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,6 +68,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | + sudo apt-get install docker.io wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env docker compose down From df5829aa4111fa5c48a4d4f3b41fad2695b3d060 Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 27 Feb 2024 14:52:32 +0100 Subject: [PATCH 04/20] chore: removed docker thing --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 232d9b73..45acbc23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,6 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - sudo apt-get install docker.io wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env docker compose down From 49449e724650d7f26d7f6a775821f2fa9cfb1587 Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 27 Feb 2024 15:10:14 +0100 Subject: [PATCH 05/20] chore: env variables thing --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45acbc23..4893949e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,5 +70,8 @@ jobs: command: | wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env + echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env + echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env + echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env docker compose down docker compose --profile prod up -d From a04a835a6d694a1648a81c29eefe1421e80f25ad Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 27 Feb 2024 15:21:41 +0100 Subject: [PATCH 06/20] chore: sudo to docker compose --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4893949e..ebabce95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,5 +73,5 @@ jobs: echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env - docker compose down - docker compose --profile prod up -d + sudo docker compose down + sudo docker compose --profile prod up -d From 43468148c77d703d34ac700083af61c774c6c2a5 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 2 Mar 2024 21:03:54 +0100 Subject: [PATCH 07/20] chore: download folder --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ebabce95..7e5ceba7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,6 +69,7 @@ jobs: key: ${{ secrets.DEPLOY_KEY }} command: | wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml + wget -r -np https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/api/ wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env From ed4e74aae11284db2aa0ac9aab654a2b4beca4c1 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 2 Mar 2024 21:28:44 +0100 Subject: [PATCH 08/20] chore: switched wget by clone --- .github/workflows/release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e5ceba7..bf31aa5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,9 +68,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml - wget -r -np https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/api/ - wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env + git clone https://github.com/arquisoft/wiq_en2b.git echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env From 44cf8070d7988ff3588ada19c93f60fced99ba7f Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 2 Mar 2024 21:35:26 +0100 Subject: [PATCH 09/20] chore: added cd --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf31aa5e..1210a876 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,8 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - git clone https://github.com/arquisoft/wiq_en2b.git + git clone https://github.com/Arquisoft/wiq_en2b.git + cd wiq_en2b echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env From c32f5fd44257c6ebfc7d3da51ce952ac1111afc9 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 2 Mar 2024 22:13:14 +0100 Subject: [PATCH 10/20] chore: changed service name --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 28749098..600412c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: '3' services: - postgresql: + WIQ_DB: container_name: postgresql-${teamname:-defaultASW} environment: POSTGRES_USER: ${DATABASE_USER} From 494acd5c54c3ea6b9713e11a9173d9148a769359 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 10:36:45 +0100 Subject: [PATCH 11/20] test: added testing mvn dependency --- api/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/pom.xml b/api/pom.xml index c16846b8..1e4a8433 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -78,6 +78,11 @@ jjwt-jackson 0.12.1 + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + From e04a9229295754efa667b9a5db7a2e613b9beac5 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 10:38:02 +0100 Subject: [PATCH 12/20] test: mvn test --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1f94f8f..cc483b6f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,8 @@ jobs: node-version: 20 - run: npm --prefix webapp ci - run: npm --prefix webapp test -- --coverage + - run: cd api + - run: mvn test - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: From dfb29b2e9c4fe73a458a9556e8e71b8c603e3343 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 17:37:56 +0100 Subject: [PATCH 13/20] test: updated for testing --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc483b6f..220fb862 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - chore/actions-fixing pull_request: types: [opened, synchronize, reopened] jobs: From b18b9450321505a9be19705b4f9300cc61bb599c Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 17:42:13 +0100 Subject: [PATCH 14/20] test: removed release testing --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1210a876..6da0b9bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,6 @@ name: Deploy on release on: - push: - branches: - - 'chore/actions-fixing' release: types: [published] From 21aefb646c4af9fd27caf9bed9e7f8ee22e46596 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 17:45:15 +0100 Subject: [PATCH 15/20] test: working directory --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 220fb862..14ce2033 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - run: npm --prefix webapp ci - run: npm --prefix webapp test -- --coverage - run: cd api - - run: mvn test + working-directory: api - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: From a88cb39eeed1d0ecdb845d1f35937b6643784077 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 17:47:20 +0100 Subject: [PATCH 16/20] test: mvn test --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14ce2033..23a2bfa4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: node-version: 20 - run: npm --prefix webapp ci - run: npm --prefix webapp test -- --coverage - - run: cd api + - run: mvn test working-directory: api - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master From 223f588bcaadcfa1f57604be3f7d17e20add88b6 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 17:54:39 +0100 Subject: [PATCH 17/20] test: moved api tests into different job --- .github/workflows/build.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23a2bfa4..96432bb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: pull_request: types: [opened, synchronize, reopened] jobs: - unit-tests: + unit-tests-webapp: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -16,8 +16,24 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 + - uses: actions/checkout@v4 - run: npm --prefix webapp ci - run: npm --prefix webapp test -- --coverage + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + unit-tests-api: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' - run: mvn test working-directory: api - name: Analyze with SonarCloud From 093bd92791381e8f207d2fdebccddc89511323f8 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 17:37:56 +0100 Subject: [PATCH 18/20] test: action for api testing --- .github/workflows/build.yml | 21 +++++++++++++++-- .github/workflows/release.yml | 43 ++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc483b6f..96432bb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,10 +3,11 @@ on: push: branches: - master + - chore/actions-fixing pull_request: types: [opened, synchronize, reopened] jobs: - unit-tests: + unit-tests-webapp: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -15,10 +16,26 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 + - uses: actions/checkout@v4 - run: npm --prefix webapp ci - run: npm --prefix webapp test -- --coverage - - run: cd api + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + unit-tests-api: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' - run: mvn test + working-directory: api - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1210a876..16c1e131 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,25 +1,42 @@ name: Deploy on release on: - push: - branches: - - 'chore/actions-fixing' release: types: [published] jobs: - unit-tests: + unit-tests-webapp: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm --prefix webapp ci - - run: npm --prefix webapp test -- --coverage - - name: Analyze with SonarCloud - uses: sonarsource/sonarcloud-github-action@master - env: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + - run: npm --prefix webapp ci + - run: npm --prefix webapp test -- --coverage + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + unit-tests-api: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - run: mvn test + working-directory: api + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} e2e-tests: From f4b3caae7b6d80c5ca33344b2687b48f008771b4 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 18:09:08 +0100 Subject: [PATCH 19/20] chore: chore testing on push --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96432bb2..9822df47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - chore/actions-fixing pull_request: types: [opened, synchronize, reopened] jobs: From c3b2455caddb30152101dac6826729fe2732a7f6 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 3 Mar 2024 18:24:29 +0100 Subject: [PATCH 20/20] fix: env variables in mvn test --- .github/workflows/build.yml | 4 ++++ .github/workflows/release.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9822df47..0695bc6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,10 @@ jobs: java-version: '17' - run: mvn test working-directory: api + env: + DATABASE_USER: ${{ secrets.DATABASE_USER }} + DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} + JWT_SECRET: ${{ secrets.JWT_SECRET }} - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16c1e131..ada55e2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,10 @@ jobs: java-version: '17' - run: mvn test working-directory: api + env: + DATABASE_USER: ${{ secrets.DATABASE_USER }} + DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} + JWT_SECRET: ${{ secrets.JWT_SECRET }} - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: