Skip to content

Issue 101 cicd #114

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

Merged
merged 24 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
001784a
[#101] Add docker build stage
panagiotisbellias May 15, 2024
a61be2a
[#101] Copy env.properties
panagiotisbellias May 15, 2024
9447dc6
[#101] Fix docker stage
panagiotisbellias May 15, 2024
882f9b4
[#101] Skip tests in non-test stages
panagiotisbellias May 15, 2024
3912a8e
[#101] Add automatic updates workflow
panagiotisbellias May 15, 2024
caababa
[#101] Add plugin updating
panagiotisbellias May 15, 2024
e4659f3
[#101] Add maven required version
panagiotisbellias May 15, 2024
de12c72
[#101] Fix maven updating
panagiotisbellias May 15, 2024
d2241b0
[#101] Add updates testing
panagiotisbellias May 15, 2024
4927a9c
Merge branch 'main' into issue-101-cicd
panagiotisbellias May 17, 2024
01a07e1
[#101] [#96] Configure automatic daily updates
panagiotisbellias May 17, 2024
150ca2a
[#101] Fix location of dependabot.yaml
panagiotisbellias May 17, 2024
fa9c46b
[#101] Remove schedule from dependabot
panagiotisbellias May 17, 2024
70c445d
[#101] Add docker login/push commands in github actions main
panagiotisbellias May 21, 2024
a4f6313
[#101] Fix docker push
panagiotisbellias May 21, 2024
db66456
[#101] Fix docker image tags
panagiotisbellias May 21, 2024
a3cdcb9
[#101] [#102] Fix owner name to original
panagiotisbellias May 21, 2024
798e7f5
[#101] Add sonarlint analysis
panagiotisbellias May 21, 2024
ee7a2a8
[#101] Fix sonarlint entrypoint
panagiotisbellias May 21, 2024
69eb6bb
[#101] Fix directory name
panagiotisbellias May 21, 2024
2cffd64
[#101] Debug
panagiotisbellias May 21, 2024
7259cfe
[#101] Fix SonarLint installation
panagiotisbellias May 21, 2024
5eb722f
[#101] Debug
panagiotisbellias May 21, 2024
1374bbc
[#101] Debug
panagiotisbellias May 21, 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
16 changes: 16 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

updates:
- package-ecosystem: "maven"
directory: "/" # Location of the pom.xml file
# schedule:
# interval: "daily" # Check for updates daily
open-pull-requests-limit: 5 # Limit the number of open PRs
target-branch: issue-101-cicd
# ignore:
# - dependency-name: "io.jsonwebtoken:jjwt-api"
# versions: ["*"]
# - dependency-name: "io.jsonwebtoken:jjwt-impl"
# versions: ["*"]
# - dependency-name: "io.jsonwebtoken:jjwt-jackson"
# versions: ["*"]
83 changes: 64 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI

on:
pull_request:
branches:
- main
- issue-101-cicd
push:
branches:
- main
Expand All @@ -22,7 +26,7 @@ jobs:
architecture: 'x64'

- name: Build with Maven
run: mvn -B package --file pom.xml
run: mvn -B package --file pom.xml -DskipTests

test:
runs-on: ubuntu-latest
Expand All @@ -43,21 +47,62 @@ jobs:
- name: Run tests
run: mvn test

# sonar:
# runs-on: ubuntu-latest
#
# needs: test
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Set up JDK 17
# uses: actions/setup-java@v2
# with:
# java-version: '17'
# distribution: 'adopt'
# architecture: 'x64'
#
# - name: SonarCloud Scan
# run: mvn sonar:sonar -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
docker:
runs-on: ubuntu-latest

needs: test

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
architecture: 'x64'

- name: Copy env.properties
run: cp env.properties.example env.properties

- name: Build with Maven
run: mvn -B package --file pom.xml -DskipTests

- name: Docker Build
run: docker build -t ghcr.io/jcilacad/aeroplanner-rest-api:latest -t ghcr.io/jcilacad/aeroplanner-rest-api:0.0.1-SNAPSHOT .

- name: Docker login
run: docker login ghcr.io -u jcilacad -p ${{ secrets.REGISTRY_TOKEN }}

- name: Docker push
run: docker push ghcr.io/jcilacad/aeroplanner-rest-api --all-tags

sonar:
runs-on: ubuntu-latest

needs: test

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
architecture: 'x64'

- name: Install SonarLint CLI
run: |
mkdir sonarlint-cli
cd sonarlint-cli
curl -L -o sonarlint-cli.zip https://binaries.sonarsource.com/Distribution/sonarlint-cli-1.0.zip
ls .
unzip sonarlint-cli.zip
chmod +x sonarlint-cli-1.0/bin/sonarlint

- name: Run SonarLint Analysis
run: |
./sonarlint-cli-1.0/bin/sonarlint -Dsonar.java.binaries=target/classes -Dsonar.sources=src/main/java
15 changes: 15 additions & 0 deletions env.properties.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DATABASE_NAME=aeroplanner_db
DATABASE_HOST=<DATABASE HOST AND PORT>
DATABASE_USERNAME=<DATABASE USERNAME>
DATABASE_PASSWORD=<DATABASE PASSWORD>

JWT_SECRET_KEY=<GENERATED SECRET KEY>
JWT_EXPIRATION_TIME=<TOKEN EXPIRATION TIME>

SUPER_ADMIN_NAME=<SUPER ADMIN NAME>
SUPER_ADMIN_EMAIL=<SUPER ADMIN EMAIL>
# Password must contain at least one uppercase letter, one lowercase letter, one digit, one special character and be at least 8 characters long.
SUPER_ADMIN_PASSWORD=<SUPER ADMIN PASSWORD>

GMAIL_USERNAME=<GOOGLE ACCOUNT EMAIL>
GMAIL_PASSWORD=<GENERATED APP PASSWORD>
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,26 @@
<artifactId>sonar-maven-plugin</artifactId>
<version>3.11.0.3922</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.3</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Loading