Skip to content

Commit

Permalink
download pre-compiled jar in action when available
Browse files Browse the repository at this point in the history
  • Loading branch information
Timbals committed Jan 11, 2024
1 parent af4c688 commit bc2655b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3
- name: Run CogniCrypt
uses: Timbals/CryptoAnalysis@a4032930f0a7b3bdb761130eae8d2229c9534b0a
uses: Timbals/CryptoAnalysis@be1b88d536592c3ab08af5969808d075b8c59d82
with:
rulesDir: "$(pwd)/JCA-CrySL-rules"
appPath: "$(pwd)/CryptoAnalysisTargets/CogniCryptDemoExample/Examples.jar"
Expand Down
26 changes: 16 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,32 @@ runs:
with:
path: CryptoAnalysisBuild_98e04be6/CryptoAnalysis.jar
key: ${{ steps.cache-key.outputs.cache-key }}
env:
# workaround for https://github.com/actions/runner/issues/2473
GH_ACTION_REPOSITORY: ${{ github.action_repository }}
GH_ACTION_REF: ${{ github.action_ref }}

# TODO download pre-compiled jar instead (when available)
- name: Set up Maven
if: steps.cache.outputs.cache-hit != 'true'
uses: stCarolas/[email protected]
with:
maven-version: 3.6.3
- name: Compile CryptoAnalysis

# Fetch pre-compiled JAR from the maven repository
- name: Download pre-compiled JAR
id: download
if: steps.cache.outputs.cache-hit != 'true'
continue-on-error: true
shell: bash
run: mvn dependency:copy -Dartifact=de.fraunhofer.iem:CryptoAnalysis:${{ env.GH_ACTION_REF }}:jar:jar-with-dependencies -DoutputDirectory=CryptoAnalysis/build
working-directory: CryptoAnalysisBuild_98e04be6
env:
GH_ACTION_REF: ${{ github.action_ref }}
# Compile from source when no pre-compiled JAR is available.
# This also makes the action work for non-releases,
# meaning any ref that can be resolved by https://github.com/actions/checkout.
- name: Compile CryptoAnalysis
if: steps.cache.outputs.cache-hit != 'true' && steps.download.outcome != 'success'
shell: bash
run: mvn package -DskipTests=true
working-directory: CryptoAnalysisBuild_98e04be6

- name: Copy JAR to convenient path
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
Expand All @@ -86,10 +96,6 @@ runs:
with:
path: CryptoAnalysisBuild_98e04be6/CryptoAnalysis.jar
key: ${{ steps.cache-key.outputs.cache-key }}
env:
# workaround for https://github.com/actions/runner/issues/2473
GH_ACTION_REPOSITORY: ${{ github.action_repository }}
GH_ACTION_REF: ${{ github.action_ref }}

- run: |
java -cp CryptoAnalysisBuild_98e04be6/CryptoAnalysis.jar crypto.HeadlessCryptoScanner \
Expand Down

0 comments on commit bc2655b

Please sign in to comment.