1- name : AxonFramework Java Code Structure Graph Analysis
1+ name : AxonFramework Code Graph Analysis (Java)
22
33on :
44 push :
@@ -36,105 +36,117 @@ on:
3636 - ' .github/workflows/typescript-code-analysis.yml'
3737 - ' .github/workflows/*documentation.yml'
3838
39- # Requires the secret NEO4J_INITIAL_PASSWORD to be configured
4039jobs :
41- analysis-results :
40+ prepare-code-to-analyze :
4241 runs-on : ubuntu-latest
43- strategy :
44- matrix :
45- include :
46- - os : ubuntu-latest
47- java : 17
48- python : 3.11
49- miniforge : 24.9.0-0
42+ outputs :
43+ analysis-name : ${{ steps.set-analysis-name.outputs.analysis-name }}
44+ sources-upload-name : ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
45+ artifacts-upload-name : ${{ steps.set-artifacts-upload-name.outputs.artifacts-upload-name }}
5046
5147 env :
52- CI_COMMIT_MESSAGE : Automated code structure analysis analysis-results (CI)
53- CI_COMMIT_AUTHOR : ${{ github.event.repository.name }} Continuous Integration
5448 PROJECT_NAME : AxonFramework
55- # Version variable name matches renovate.json configuration entry
49+ # Version variable names matches renovate.json configuration entry
5650 AXON_FRAMEWORK_VERSION : 4.10.3
51+ # Java is in this example only used to download JARs for analysis using Maven
52+ JAVA_VERSION : 21
5753
5854 steps :
59- - name : Checkout GIT Repository
55+ - name : (Prepare Code to Analyze) Checkout AxonFramework repository
6056 uses : actions/checkout@v4
6157 with :
62- token : ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
58+ repository : AxonFramework/AxonFramework
59+ ref : axon-${{ env.AXON_FRAMEWORK_VERSION }}
60+ path : ./source
6361
64- - name : (Code Analysis Setup) Set ANALYSIS_NAME
65- run : echo "ANALYSIS_NAME=${{ env.PROJECT_NAME }}-${{ env.AXON_FRAMEWORK_VERSION }}" >> $GITHUB_ENV
66-
67- - name : Setup Code Analysis
68- uses : ./.github/actions/setup-code-analysis
62+ - name : (Prepare Code to Analyze) Setup Java Development Kit for Maven JARs downloading (JDK) ${{ env.JAVA_VERSION}}
63+ uses : actions/setup-java@v4
6964 with :
70- java-version : ${{ matrix.java }}
71- python-version : ${{ matrix.python }}
72- miniforge-version : ${{ matrix.miniforge }}
73- analysis-name : ${{ env.ANALYSIS_NAME }}
74- neo4j-password : ${{ secrets.NEO4J_INITIAL_PASSWORD }}
75-
76- - name : (Code Analysis) Download ${{ env.ANALYSIS_NAME }}
77- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}
78- run : |
79- ./../../scripts/downloader/downloadAxonFramework.sh ${{ env.AXON_FRAMEWORK_VERSION }}
80-
81- - name : (Code Analysis) Analyze ${{ env.ANALYSIS_NAME }}
82- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}
83- # Shell type can be skipped if jupyter notebook analysis-results (and therefore conda) aren't needed
84- shell : bash -el {0}
85- env :
86- NEO4J_INITIAL_PASSWORD : ${{ secrets.NEO4J_INITIAL_PASSWORD }}
87- ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION : " true"
88- IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT : " " # Options: "none", "aggregated", "full". default = "plugin" or ""
89- run : |
90- ./../../scripts/analysis/analyze.sh --profile Neo4jv5-low-memory
91-
92- - name : (Code Analysis) Collect analysis results
93- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}
65+ distribution : " temurin"
66+ java-version : ${{ env.JAVA_VERSION}}
67+
68+ - name : (Prepare Code to Analyze) Download AxonFramework JARs for analysis
9469 run : |
95- mkdir -p ./../../../analysis-results/${{ env.ANALYSIS_NAME }}
96- cp -Rp reports ./../../../analysis-results/${{ env.ANALYSIS_NAME }}
97-
98- # Upload logs and unfinished analysis-results in case of an error for troubleshooting
99- - name : Archive failed run with logs and unfinished analysis-results
100- if : failure()
70+ mvn dependency:copy -Dartifact=org.axonframework:axon-configuration:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
71+ mvn dependency:copy -Dartifact=org.axonframework:axon-disruptor:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
72+ mvn dependency:copy -Dartifact=org.axonframework:axon-eventsourcing:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
73+ mvn dependency:copy -Dartifact=org.axonframework:axon-messaging:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
74+ mvn dependency:copy -Dartifact=org.axonframework:axon-modelling:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
75+ mvn dependency:copy -Dartifact=org.axonframework:axon-test:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
76+ mvn dependency:copy -Dartifact=org.axonframework:axon-server-connector:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
77+ mvn dependency:copy -Dartifact=org.axonframework:axon-spring-boot-autoconfigure:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
78+ mvn dependency:copy -Dartifact=org.axonframework:axon-tracing-opentelemetry:${{ env.AXON_FRAMEWORK_VERSION }} -DoutputDirectory=./artifacts
79+
80+ - name : (Prepare Code to Analyze) Set analysis-name
81+ id : set-analysis-name
82+ run : echo "analysis-name=${{ env.PROJECT_NAME }}-${{ env.AXON_FRAMEWORK_VERSION }}" >> "$GITHUB_OUTPUT"
83+
84+ - name : (Prepare Code to Analyze) Generate ARTIFACT_UPLOAD_ID
85+ run : echo "ARTIFACT_UPLOAD_ID=$(LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 10)" >> $GITHUB_ENV
86+
87+ - name : (Prepare Code to Analyze) Set sources-upload-name
88+ id : set-sources-upload-name
89+ run : echo "sources-upload-name=${{ steps.set-analysis-name.outputs.analysis-name }}-analysis-sources_input-${{ env.ARTIFACT_UPLOAD_ID }}" >> "$GITHUB_OUTPUT"
90+
91+ - name : (Prepare Code to Analyze) Assemble ARTIFACTS_UPLOAD_NAME
92+ id : set-artifacts-upload-name
93+ run : echo "artifacts-upload-name=${{ steps.set-analysis-name.outputs.analysis-name }}-analysis-artifacts-input-${{ env.ARTIFACT_UPLOAD_ID }}" >> "$GITHUB_OUTPUT"
94+
95+ - name : (Prepare Code to Analyze) Upload sources to analyze
96+ if : success()
10197 uses : actions/upload-artifact@v4
10298 with :
103- name : java-code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
104- path : |
105- ./code-graph-analysis-pipeline/temp/**/runtime/*
106- ./code-graph-analysis-pipeline/temp/**/reports/*
99+ name : ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
100+ path : ./source
101+ if-no-files-found : error
107102 retention-days : 5
108103
109- # Upload successful analysis-results in case they are needed for troubleshooting
110- - name : Archive successful analysis-results
104+ - name : (Prepare Code to Analyze) Upload artifacts to analyze
111105 if : success()
112106 uses : actions/upload-artifact@v4
113107 with :
114- name : java-code-analysis-analysis-results-java- ${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
115- path : ./analysis-results/${{ env.ANALYSIS_NAME }}/*
108+ name : ${{ steps.set-artifacts-upload-name.outputs.artifacts-upload-name }}
109+ path : ./artifacts
116110 if-no-files-found : error
117111 retention-days : 5
118112
119- # Upload Database Export
120- # Only possible after an export with "./../../scripts/analysis/analyze.sh --report DatabaseCsvExport"
121- # Won't be done here because of performance and security concerns
122- # - name: Archive exported database
123- # uses: actions/upload-artifact@v3
124- # with:
125- # name: java-code-analysis-database-export-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
126- # path: ./code-graph-analysis-pipeline/temp/**/import
127- # if-no-files-found: error
128- # retention-days: 5
113+
114+ analyze-code-graph :
115+ needs : [prepare-code-to-analyze]
116+ uses : ./.github/workflows/analyze-code-graph.yml
117+ with :
118+ analysis-name : ${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
119+ artifacts-upload-name : ${{ needs.prepare-code-to-analyze.outputs.artifacts-upload-name }}
120+ sources-upload-name : ${{ needs.prepare-code-to-analyze.outputs.sources-upload-name }}
121+
122+
123+ analysis-results :
124+ needs : [prepare-code-to-analyze, analyze-code-graph]
125+ runs-on : ubuntu-latest
126+
127+ env :
128+ CI_COMMIT_MESSAGE : Automated code structure analysis analysis-results (CI)
129+ CI_COMMIT_AUTHOR : ${{ github.event.repository.name }} Continuous Integration
130+
131+ steps :
132+ - name : Checkout GIT Repository
133+ uses : actions/checkout@v4
134+ with :
135+ token : ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
136+
137+ - name : (Code Analysis Setup) Download source code and artifacts for analysis
138+ uses : actions/download-artifact@v4
139+ with :
140+ name : ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
141+ path : analysis-results/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
129142
130143 # Commit and push the native image agent analysis-results
131144 - name : Display environment variable "github.event_name"
132145 run : echo "github.event_name=${{ github.event_name }}"
133- - name : Commit changes in the "analysis-results" directory
146+ - name : Display changes in the "analysis-results" directory and prepare commit
134147 # Only run when a pull request gets merged or a commit is pushed to the main branch
135148 # git add parameters need to match paths-ignore parameters above
136149 # Git pull before add/commit/push to reduce race conditions on parallel builds
137- if : github.event_name == 'push'
138150 run : |
139151 git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
140152 git config --global user.email "[email protected] " @@ -143,6 +155,12 @@ jobs:
143155 git status
144156 git add analysis-results
145157 git status
158+ - name : Commit and push changes in the "analysis-results" directory
159+ # Only run when a pull request gets merged or a commit is pushed to the main branch
160+ # git add parameters need to match paths-ignore parameters above
161+ # Git pull before add/commit/push to reduce race conditions on parallel builds
162+ if : github.event_name == 'push'
163+ run : |
146164 git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
147165 git status
148166 git rebase --strategy-option=theirs origin/main --verbose
0 commit comments