Skip to content

Commit

Permalink
Reintroduce cache, don't hardcode variables (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrongestNumber9 authored Dec 9, 2024
1 parent 7bec74d commit d7a4ff4
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,24 @@ jobs:
MARIADB_PORT: ${{ job.services.mariadb.ports[3306] }}
GITHUB_TOKEN: ${{ github.token }}

- name: Cache Coverity
id: cache_coverity
uses: actions/cache@v4
with:
path: ${{ env.COVERITY }}
key: coverity

- name: Download Coverity
if: steps.cache_coverity.outputs.cache-hit != 'true'
run: |
wget --quiet https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=pth_06" -O ${{ env.COVERITY }}.tgz
wget --quiet https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=${{ vars.COVERITY_PROJECT_URL_NAME }}" -O ${{ env.COVERITY }}.tgz
mkdir -p ${{ env.COVERITY }}
tar zxvf ${{ env.COVERITY }}.tgz -C ${{ env.COVERITY }} --strip-components 1
- name: Compile Coverity
run: |
${{ env.COVERITY }}/bin/cov-build --dir cov-int mvn -Pbuild-nogenerate -B -Drevision=${{ env.RELEASE_VERSION }} -Dsha1= -Dchangelist= clean compile
tar czvf pth_06.tgz cov-int
tar czvf ${{ vars.COVERITY_PROJECT_URL_NAME }} cov-int
- name: Install jq
run: |
Expand All @@ -96,19 +104,25 @@ jobs:
-d description="automated upload" \
-d email=${{ secrets.COVERITY_EMAIL }} \
-d token=${{ secrets.COVERITY_TOKEN }} \
-d file_name="pth_06.tgz" \
https://scan.coverity.com/projects/30661/builds/init \
-d file_name="${{ vars.COVERITY_PROJECT_URL_NAME }}.tgz" \
https://scan.coverity.com/projects/${{ vars.COVERITY_PROJECT_URL_ID }}/builds/init \
| tee response
- name: Prepare response url
run: echo "RESPONSE_URL=$(jq -r '.url' response)" >> $GITHUB_ENV

- name: Upload to Coverity
run: |
curl -X PUT \
--header 'Content-Type: application/json' \
--upload-file pth_06.tgz \
"$(jq -r '.url' response)"
--upload-file ${{ vars.COVERITY_PROJECT_URL_NAME }}.tgz \
"${{ env.RESPONSE_URL }}"
- name: Prepare build id
run: echo "BUILD_ID=$(jq -r '.build_id' response)" >> $GITHUB_ENV

- name: Trigger Coverity build
run: |
curl -X PUT \
-d token${{ secrets.COVERITY_TOKEN }} \
"https://scan.coverity.com/projects/30661/builds/$(jq -r '.build_id' response)/enqueue"
"https://scan.coverity.com/projects/${{ vars.COVERITY_PROJECT_URL_ID }}/builds/${{ env.BUILD_ID }}/enqueue"

0 comments on commit d7a4ff4

Please sign in to comment.