diff --git a/.github/workflows/building-jar-cache.yml b/.github/workflows/building-jar-cache.yml new file mode 100644 index 000000000..75f395588 --- /dev/null +++ b/.github/workflows/building-jar-cache.yml @@ -0,0 +1,26 @@ +name: Building JAR cache + +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: "21" + distribution: "corretto" + - name: Clean install + run: ./mvnw --no-transfer-progress clean install -DskipTests -Ddependency-check.skip -Dcyclonedx.skip=true -Dexec.skip + - name: Cache JAR file + id: cache-jar + uses: actions/cache@v3 + with: + path: ./target/wrongsecrets-1.7.0-SNAPSHOT.jar + key: JarCache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + JarCache-${{ runner.os }}- diff --git a/.github/workflows/dast-zap-test.yml b/.github/workflows/dast-zap-test.yml index 605a6a68f..f3de6f4a2 100644 --- a/.github/workflows/dast-zap-test.yml +++ b/.github/workflows/dast-zap-test.yml @@ -13,14 +13,16 @@ jobs: name: DAST test with ZAP runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: "21" - distribution: "corretto" - - name: Clean install - run: ./mvnw --no-transfer-progress clean install -DskipTests -Ddependency-check.skip -Dcyclonedx.skip=true -Dexec.skip + - name: Checkout code + uses: actions/checkout@v4 + - name: Trigger Building JAR cache with Git CLI + if: steps.cache.outputs.cache-hit != 'true' + run: | + curl -X POST \ + -H "Authorization: ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://github.com/puneeth072003/wrongsecrets/blob/chal/.github/workflows/building-jar-cache.yml + -d '{"ref":"main"}' - name: Start wrongsecrets run: nohup ./mvnw spring-boot:run -Dspring-boot.run.profiles=without-vault & - name: ZAP Scan diff --git a/.github/workflows/java_swagger_doc.yml b/.github/workflows/java_swagger_doc.yml index 5d48a810c..25b3cdff5 100644 --- a/.github/workflows/java_swagger_doc.yml +++ b/.github/workflows/java_swagger_doc.yml @@ -14,12 +14,23 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Check the cache + uses: actions/cache/restore@v3 + id: cache + with: + path: ./target + key: JarCache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} + - name: Check cache hit + id: cache-hit-check + run: echo "cache-hit=${{ steps.cache.outputs.cache-hit }}" >> $GITHUB_ENV - name: Set up JDK 21 + if: steps.cache.outputs.cache-hit != 'true' uses: actions/setup-java@v3 with: java-version: "21" distribution: "corretto" - name: Clean install + if: steps.cache.outputs.cache-hit != 'true' run: ./mvnw --no-transfer-progress clean install -DskipTests -Ddependency-check.skip -Dcyclonedx.skip=true -Dexec.skip - name: Compile javadoc run: ./mvnw --no-transfer-progress compile javadoc:javadoc