Skip to content
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

Checkpoint dev #1

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
70 changes: 40 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,58 +21,68 @@ jobs:
key: "${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ runner.os }}-maven3-

# Configure java to version 17
- name: Configure Java
uses: actions/[email protected]
with:
java-version: "17"
distribution: temurin

- name: Cache SonarQube dependencies
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
- name: "Run Maven"
shell: bash
run: mvn clean install --batch-mode -PintegrationTests
# Run SunarQube Scanner
- name: Run SonarQube Scanner
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
SONAR_URL: https://sonarcloud.io
run: |
mvn clean verify sonar:sonar -Dsonar.organization=victorit -Dsonar.projectKey=victorit_my_training -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.exclusions=target/**,bin/**,**/*.class -Dsonar.report.export.path=/home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/codeql-results.sarif
ls -al .
ls -al /home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/
ls -al /home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/
# Download the SARIF file if it's an artifact from a previous job or step
#- name: Download SARIF file
# uses: actions/download-artifact@v3
# with:
# name: sarif-file # The artifact name you want to download
# path: /home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar

# Upload the SARIF results to GitHub CodeQL
#- name: Upload SARIF results
# uses: github/codeql-action/upload-sarif@v3
# with:
# sarif_file: '/home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/*.sarif'
mvn clean verify sonar:sonar -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_URL -Dsonar.token=$SONAR_TOKEN -Dsonar.exclusions=target/**,bin/**,**/*.class

# Upload SonarQube to GitHub Insight
- name: Upload SonarQube results to GitHub Insights
uses: sonarsource/sonarcloud-github-action@v2
with:
entryPoint: "/entrypoint.sh"
args: |
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.java.binaries=frontend-maven-plugin/target/classes
-Dsonar.exclusions=target/**,bin/**,**/*.class
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}


# Build project
- name: "Run Maven"
shell: bash
run: mvn clean install --batch-mode -PintegrationTests


# Create project
- name: Package
run: mvn -B clean package -DskipTests

# Set up JFrog CLI
- name: Install JFrog CLI
run: |
curl -fL https://getcli.jfrog.io | sh
sudo mv jfrog /usr/local/bin/

- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v2
with:
version: 2.72.2
# JFrog Xray Scan
- name: JFrog CLI
env:
JFROG_URL: ${{ secrets.ARTIFACTORY_URL }}
JFROG_URL: https://trialkl8y5h.jfrog.io/artifactory
JFROG_USER: ${{ secrets.ARTIFACTORY_USER }}
JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: |
#jfrog config add exam-server --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --interactive=false
#jfrog config add exam-server --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --interactive=false
#jfrog config show
jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD"
jfrog rt bp "my-build" "1" --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD"
jfrog rt bs "my-build" "1" --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail
jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD"
jfrog rt bp "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD"
jfrog rt bs "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail