@@ -2,13 +2,33 @@ name: Build and test the project
22
33on :
44 workflow_call :
5+ inputs :
6+ upload_artifact :
7+ type : boolean
8+ required : false
9+ default : false
10+ outputs :
11+ cache_key :
12+ description : " Cache key used for Maven repository"
13+ value : ${{ jobs.build.outputs.cache_key }}
514 secrets :
615 SONAR_TOKEN :
716 required : true
817
918jobs :
19+
20+ build :
21+ uses : opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop
22+ with :
23+ needs_hadoop_preparation : false
24+ maven_opts : -Dcheckstyle.skip
25+ upload_artifact : ${{ inputs.upload_artifact }}
26+ dependency_repos : " java-common-libs,biodata"
27+ secrets : inherit
28+
1029 test :
1130 name : Test and push Sonar analysis
31+ needs : build
1232 runs-on : ${{ vars.UBUNTU_VERSION }}
1333 steps :
1434 - uses : actions/checkout@v4
@@ -26,14 +46,13 @@ jobs:
2646 chmod +x ./kubectl
2747 echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf
2848 ./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27017:27017 --kubeconfig ./admin.conf &
29- - name : Install dependencies branches
30- run : |
31- if [ -f "./.github/workflows/scripts/get_same_branch.sh" ]; then
32- chmod +x ./.github/workflows/scripts/get_same_branch.sh
33- ./.github/workflows/scripts/get_same_branch.sh ${{ github.ref_name }}
34- else
35- echo "./.github/workflows/scripts/get_same_branch.sh does not exist."
36- fi
49+ - name : Cache local Maven repository
50+ uses : actions/cache/restore@v4
51+ with :
52+ path : ~/.m2/repository
53+ key : ${{ needs.build.outputs.cache_key }}
54+ # # Force cache hit to avoid testing with incomplete dependencies
55+ fail-on-cache-miss : true
3756 - name : Test and Analyze
3857 env :
3958 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
0 commit comments