diff --git a/.github/workflows/code.yaml b/.github/workflows/code.yaml new file mode 100644 index 0000000..9e4f7f7 --- /dev/null +++ b/.github/workflows/code.yaml @@ -0,0 +1,43 @@ +name: Java CI with Maven + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '17' + + - name: Set up Docker Compose + run: sudo apt-get install docker-compose + + - name: Start Docker Compose services + run: docker-compose up -d + + - name: Wait for services to be ready + run: | + echo "Waiting for services to be ready..." + while ! nc -z localhost 5432; do # Adapt this command depending on your DB or service port + sleep 2 + done + + - name: Build with Maven + run: mvn -B package --file pom.xml -DskipTests + + - name: Run Tests + run: mvn test -Dspring.profiles.active=ci diff --git a/src/main/resources/application-ci.yml b/src/main/resources/application-ci.yml new file mode 100644 index 0000000..8f7d8dd --- /dev/null +++ b/src/main/resources/application-ci.yml @@ -0,0 +1,9 @@ +# Jwt +JWT_SECRET: "SECRET JWT FOR CI DO NOT USE THIS IN PRODUCTION" +JWT_EXPIRATION_TIME: 1000 + +# Postgres +POSTGRES_DB: ideasmanager +POSTGRES_USER: ideasmanager +POSTGRES_PWD: ideasmanager +POSTGRES_HOST: localhost diff --git a/src/main/resources/application-local-template.yml b/src/main/resources/application-local-template.yml index df011d0..df84236 100644 --- a/src/main/resources/application-local-template.yml +++ b/src/main/resources/application-local-template.yml @@ -6,7 +6,7 @@ JWT_SECRET: SETME JWT_EXPIRATION_TIME: 300000 # Postgres -POSTRGES_DB: SETME +POSTGRES_DB: SETME POSTGRES_USER: SETME POSTGRES_PWD: SETME POSTGRES_HOST: SETME