diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..08c3248 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: CI +on: + pull_request: + push: + +jobs: + jpo-security-svcs: + runs-on: ubuntu-latest + container: + image: openjdk:17-jdk-slim-buster + options: --user root + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v3 + - name: Set up Maven + uses: stCarolas/setup-maven@v4.5 + with: + maven-version: 3.8.2 + - uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + - name: Build + run: | + cd $GITHUB_WORKSPACE + ls -ls && pwd + mvn -e -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package + mvn -e -X clean org.jacoco:jacoco-maven-plugin:report package + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: jpo-security-svcs + path: /__w/jpo-security-svcs/jpo-security-svcs/target + if-no-files-found: error + tmca-tester: + runs-on: ubuntu-latest + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v3 + - name: build tmca-tester + uses: actions/setup-node@v3 + with: + node-version: '18.x' + - run: | + cd $GITHUB_WORKSPACE/tmca-tester + npm install --force + node ./tmca-tester.js + sonar: + needs: [jpo-security-svcs, tmca-tester] + runs-on: ubuntu-latest + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Download code coverage results + uses: actions/download-artifact@v3 + with: + name: jpo-security-svcs + path: home/runner/work/jpo-security-svcs/jpo-security-svcs/target + - name: Find jacoco.xml + shell: bash + run: | + find "$GITHUB_WORKSPACE" -name "jacoco.xml" + - name: Setup SonarScanner + uses: warchant/setup-sonar-scanner@v4 + with: + version: 4.8.0.2856 + - name: Generate sonar properties file + run: | + cat < /tmp/sonar-scanner.properties + sonar.host.url=https://sonarcloud.io + sonar.coverage.jacoco.xmlReportPaths=$GITHUB_WORKSPACE/tmca-tester/target/site/jacoco/jacoco.xml + sonar.java.binaries=home/runner/work/jpo-security-svcs/jpo-security-svcs/target + sonar.projectBaseDir=$GITHUB_WORKSPACE + sonar.projectKey=usdot-jpo-ode_jpo-security-svcs + sonar.organization=usdot-jpo-ode-1 + jpo-security-svcs.sonar.projectBaseDir = home/runner/work/jpo-security-svcs/jpo-security-svcs + jpo-security-svcs.sonar.sources = src + tmca-tester.sonar.projectBaseDir=$GITHUB_WORKSPACE /tmca-tester + tmca-tester.sonar.sources=. + EOF + - name: Run SonarScanner + uses: usdot-fhwa-stol/actions/sonar-scanner@main + with: + sonar-properties-path: /tmp/sonar-scanner.properties + sonar-token: ${{ secrets.SONAR_TOKEN }} + working-dir: $GITHUB_WORKSPACE diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..6eb81d8 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,21 @@ +name: Docker build + +on: + push: + branches-ignore: + - "develop" + - "master" + - "release/*" + pull_request: + +jobs: + jpo-security-svcs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - run: ls -la && pwd + - name: Build + uses: docker/build-push-action@v3 \ No newline at end of file diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml new file mode 100644 index 0000000..06e0d52 --- /dev/null +++ b/.github/workflows/dockerhub.yml @@ -0,0 +1,27 @@ +name: "DockerHub Build and Push" + +on: + push: + branches: + - "develop" + - "master" + - "release/*" + +jobs: + dockerhub-jpo-ode: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build + uses: docker/build-push-action@v3 + with: + push: true + tags: usdotjpoode/jpo-security-svcs:${{ github.ref_name }} diff --git a/.gitignore b/.gitignore index 2e1966c..8c95254 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ **.jks **.pem .env -**.crt \ No newline at end of file +**.crt +.sonar/ +dependency-reduced-pom.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml index 0111e90..efeac6e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 @@ -18,6 +16,20 @@ jar jpo-security-svcs JPO ODE Cryptography Module + + 1.8 + 1.49 + -javaagent:${user.home}/.m2/repository/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar + usdot-jpo-ode-1 + https://sonarcloud.io + + 0.8.8 + jacoco + reuseReports + ${project.basedir}/target/site/jacoco/jacoco.xml + java + + @@ -64,21 +76,63 @@ javax.xml.bind jaxb-api 2.3.1 - + + + org.jmockit + jmockit + ${jmockit.version} + test + + + junit + junit + 4.13.2 + test + + + org.apache.kafka + kafka_2.11 + 2.4.1 + + + org.springframework.boot + spring-boot-starter-mail + + + org.projectreactor + reactor-spring + 1.0.1.RELEASE + - - 1.8 - - - ${project.artifactId} - - org.springframework.boot - spring-boot-maven-plugin - + + org.springframework.boot + spring-boot-maven-plugin + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + jacoco-initialize + + prepare-agent + + + + jacoco-site + package + + report + + + +