Skip to content

fix(product): remove starship credentials #167

fix(product): remove starship credentials

fix(product): remove starship credentials #167

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [main, sonar]
pull_request:
branches: [main, sonar]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Step 1 - Checkout branch
uses: actions/checkout@v3
- name: Step 2 - Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: maven
- name: Step 3 - Build with Maven
run: mvn -B package -Pdev -DskipTests
test:
needs: build
runs-on: ubuntu-latest
env:
DB_STARSHIP_SERVICE: starship_service
DB_ORDER_SERVICE: order_service
DB_INVENTORY_SERVICE: inventory_service
DB_CART_SERVICE: cart_service
DB_IMAGE_SERVICE: image_service
DB_PRODUCT_SERVICE: product_service
DB_USER: root
DB_PASSWORD: root
steps:
- name: Step 1 - Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Step 2 - Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: maven
- name: Step 3 - Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Step 4 - Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# MySQL 5.7 is pre-installed on Ubuntu 18.04 containers (and MySQL 8 on 20 and latest) No Service section is needed
# Github official announcement: https://github.blog/changelog/2020-02-21-github-actions-breaking-change-ubuntu-virtual-environments-will-no-longer-start-the-mysql-service-automatically/
- name: Step 5 - Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.DB_STARSHIP_SERVICE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
mysql -e 'CREATE DATABASE ${{ env.DB_ORDER_SERVICE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
mysql -e 'CREATE DATABASE ${{ env.DB_INVENTORY_SERVICE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
mysql -e 'CREATE DATABASE ${{ env.DB_PRODUCT_SERVICE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
mysql -e 'CREATE DATABASE ${{ env.DB_CART_SERVICE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
mysql -e 'CREATE DATABASE ${{ env.DB_IMAGE_SERVICE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
- name: Step 6 - Run config-server in background
run: |
cd config-server
mvn spring-boot:run &
- name: Step 7 - Wait for config-server to be up and running
run: until curl http://localhost:9101/product-service.yml; do sleep 5; done
- name: Step 8 - Run a Zipkin container
run: docker run --name zipkin -d -p 9411:9411 openzipkin/zipkin:latest
- name: Step 9 - Run a PostgreSQL container
run: docker run --name postgresql -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root -e POSTGRES_DB=bitnami_keycloak -p 5432:5432 -d postgres:latest
- name: Step 10 - Run Keycloak container
run: docker run -d --name keycloak -e KEYCLOAK_ADMIN_USER=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -e KEYCLOAK_DATABASE_USER=root -e KEYCLOAK_DATABASE_PASSWORD=root -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -e KC_HEALTH_ENABLED=true -p 8181:8080 --link postgresql -v ${{ github.workspace }}/realms:/opt/keycloak/data/import quay.io/keycloak/keycloak:latest start-dev --import-realm
- name: Step 11 - Wait for Keycloak to be up and running
run: until curl http://localhost:8181; do sleep 5; done
- name: Step 12 - Run tests with Maven and analyze with sonarcloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=skrollu_StarshipShop