Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: created actions for deployment and unit testing of Spring Boot API #75

Merged
merged 23 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9b0039f
chore: comment e2e tests on release
Toto-hitori Feb 27, 2024
b2fd33a
chore: comment e2e tests on release
Toto-hitori Feb 27, 2024
23041b8
Merge remote-tracking branch 'origin/chore/actions-fixing' into chore…
Toto-hitori Feb 27, 2024
7f52b3c
chore: added docker to deploy
Toto-hitori Feb 27, 2024
df5829a
chore: removed docker thing
Toto-hitori Feb 27, 2024
49449e7
chore: env variables thing
Toto-hitori Feb 27, 2024
a04a835
chore: sudo to docker compose
Toto-hitori Feb 27, 2024
4346814
chore: download folder
Toto-hitori Mar 2, 2024
ed4e74a
chore: switched wget by clone
Toto-hitori Mar 2, 2024
44cf807
chore: added cd
Toto-hitori Mar 2, 2024
c32f5fd
chore: changed service name
Toto-hitori Mar 2, 2024
494acd5
test: added testing mvn dependency
Toto-hitori Mar 3, 2024
e04a922
test: mvn test
Toto-hitori Mar 3, 2024
dfb29b2
test: updated for testing
Toto-hitori Mar 3, 2024
b18b945
test: removed release testing
Toto-hitori Mar 3, 2024
21aefb6
test: working directory
Toto-hitori Mar 3, 2024
a88cb39
test: mvn test
Toto-hitori Mar 3, 2024
223f588
test: moved api tests into different job
Toto-hitori Mar 3, 2024
093bd92
test: action for api testing
Toto-hitori Mar 3, 2024
2dad7c1
Merge remote-tracking branch 'origin/chore/actions-fixing' into chore…
Toto-hitori Mar 3, 2024
f4b3caa
chore: chore testing on push
Toto-hitori Mar 3, 2024
c3b2455
fix: env variables in mvn test
Toto-hitori Mar 3, 2024
4265a1c
Merge remote-tracking branch 'origin/develop' into chore/actions-fixing
Toto-hitori Mar 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
unit-tests:
unit-tests-webapp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -15,8 +15,30 @@ 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
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:
Expand Down
57 changes: 42 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,42 @@ on:
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
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
e2e-tests:
Expand All @@ -29,7 +53,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 ]
Expand Down Expand Up @@ -65,7 +89,10 @@ 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 https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env
docker compose down
docker compose --profile prod up -d
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
sudo docker compose down
sudo docker compose --profile prod up -d
5 changes: 5 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
<artifactId>jjwt-jackson</artifactId>
<version>0.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '3'
services:
postgresql:
WIQ_DB:
container_name: postgresql-${teamname:-defaultASW}
environment:
POSTGRES_USER: ${DATABASE_USER}
Expand Down