Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version = 1

[[analyzers]]
name = "java"
enabled = true

[analyzers.meta]
runtime_version = "21"

[[analyzers]]
name = "test-coverage"
enabled = false

[[analyzers]]
name = "secrets"
enabled = true

[[analyzers]]
name = "shell"
enabled = true
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Build & Deploy Spring app
name: Build & Deploy QuizHub Docker Image

on:
workflow_dispatch:

jobs:
build-deploy:
name: Build and Deploy Spring boot for beginner
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK 17
uses: actions/setup-java@v3
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 17
java-version: 21

- name: Unit Tests
run: mvn -B test --file pom.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
name: Build & Deploy QuizHub to Docker Hub
run-name: Deploying QuizHub to Docker Hub
concurrency: docker-build
on:
workflow_dispatch:
jobs:
build-deploy:
name: Build and Deploy Spring boot for beginner
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
- name: Unit Tests
run: mvn -B test --file pom.xml
- name: Build the application
run: |
mvn clean
mvn -B package --file pom.xml
- name: Build Docker Image
uses: docker/build-push-action@v2
with:
context: .
dockerfile: Dockerfile
push: false
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/quizhub:latest
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
dockerfile: Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/quizhub:latest
name: Build & Deploy QuizHub-staging Docker Image

on:
workflow_dispatch:
push:
branches:
- staging

jobs:
build-deploy:
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21

# - name: Unit Tests
# run: mvn -B test --file pom.xml
#
- name: Build the application
run: |
mvn clean
mvn -B package --file pom.xml

- name: Build Docker Image
uses: docker/build-push-action@v2
with:
context: .
dockerfile: Dockerfile
push: false
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/quizhub:staging

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
dockerfile: Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/quizhub:staging
37 changes: 37 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Continuous Integration
run-name: CI Pipeline
concurrency: CI-${{ github.repository }}-${{ github.ref }}

on:
pull_request:
branches:
- staging
- dev

jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21

- name: Unit Tests
run: mvn -B test --file pom.xml

- name: Build the application
run: |
mvn clean
mvn -B package --file pom.xml

- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: target/
31 changes: 2 additions & 29 deletions src/main/java/org/wa55death405/quizhub/QuizHubApplication.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
package org.wa55death405.quizhub;

import jakarta.persistence.EntityManager;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.wa55death405.quizhub.repositories.QuestionRepository;
import org.wa55death405.quizhub.repositories.QuizRepository;


@SpringBootApplication
@RequiredArgsConstructor
public class QuizHubApplication implements CommandLineRunner{
private final QuestionRepository questionRepository;
private final EntityManager entityManger;
private final QuizRepository quizRepository;
public class QuizHubApplication{

public static void main(String[] args) {
SpringApplication.run(QuizHubApplication.class, args);
}

@Override
@Transactional
public void run(String... args) throws Exception {
// QuizCreationDTO quizCreationDTO = new QuizCreationDTO();
// FakeDataGenerator.fill(quizCreationDTO);
// Quiz quiz = quizCreationDTO.toEntity(null);
// quizRepository.save(quiz);
//// entityManger.flush();
//
// QuizAttempt quizAttempt = new QuizAttempt();
// quizAttempt.setQuiz(quiz);
// entityManger.persist(quizAttempt);
//
// var s = FakeDataUtils.getPerfectScoreQuestionAttemptSubmissionDTOsForQuiz(quiz);
// for (var qas : s) {
// QuestionAttempt qa = qas.toEntity(null);
// qa.setQuizAttempt(quizAttempt);
// entityManger.persist(qa);
// }
}
}