1+ name : Java Code Structure Graph Analysis
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ # Ignore changes in documentation, general configuration and reports for push events
8+ paths-ignore :
9+ - ' results/**'
10+ - ' **/*.md'
11+ - ' **/*.txt'
12+ - ' **/*.css'
13+ - ' **/*.html'
14+ - ' **/*.js'
15+ - ' .gitignore'
16+ - ' .gitattributes'
17+ - ' renovate.json'
18+ - ' changelogTemplate.mustache'
19+ - ' **.code-workspace'
20+ - ' .github/workflows/typescript-code-analysis.yml'
21+ - ' .github/workflows/*documentation.yml'
22+ pull_request :
23+ branches :
24+ - main
25+ # Ignore changes in documentation, general configuration and reports for pull request events
26+ paths-ignore :
27+ - ' results/**'
28+ - ' **/*.md'
29+ - ' **/*.txt'
30+ - ' **/*.css'
31+ - ' **/*.html'
32+ - ' **/*.js'
33+ - ' .gitignore'
34+ - ' .gitattributes'
35+ - ' renovate.json'
36+ - ' changelogTemplate.mustache'
37+ - ' **.code-workspace'
38+ - ' .github/workflows/typescript-code-analysis.yml'
39+ - ' .github/workflows/*documentation.yml'
40+
41+ # Requires the secret NEO4J_INITIAL_PASSWORD to be configured
42+ jobs :
43+ prepare-code-to-analyze :
44+ runs-on : ubuntu-latest
45+ outputs :
46+ analysis-name : ${{ steps.set-analysis-name.outputs.analysis-name }}
47+ sources-upload-name : ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
48+ artifacts-upload-name : ${{ steps.set-artifacts-upload-name.outputs.artifacts-upload-name }}
49+
50+ env :
51+ PROJECT_NAME : AxonFramework
52+ # Version variable names matches renovate.json configuration entry
53+ AXON_FRAMEWORK_VERSION : 4.10.3
54+
55+ steps :
56+ - name : Checkout GIT Repository
57+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
58+
59+ - name : Set Set output variable 'analysis-name'
60+ id : set-analysis-name
61+ run : echo "analysis-name=${{ env.PROJECT_NAME }}-${{ env.AXON_FRAMEWORK_VERSION }}" >> "$GITHUB_OUTPUT"
62+
63+ - name : Setup temp directory if missing
64+ run : mkdir -p ./temp
65+
66+ - name : Download ${{ steps.set-analysis-name.outputs.analysis-name }}
67+ working-directory : temp
68+ run : |
69+ mkdir -p ${{ steps.set-analysis-name.outputs.analysis-name }}
70+ cd ${{ steps.set-analysis-name.outputs.analysis-name }}
71+ echo "Working directory: $( pwd -P )"
72+ ./../../scripts/downloader/downloadAxonFramework.sh ${{ env.AXON_FRAMEWORK_VERSION }}
73+
74+ - name : Debug folder structure in temp directory
75+ if : runner.debug == '1'
76+ working-directory : temp
77+ run : |
78+ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
79+
80+ - name : (Prepare Code to Analyze) Generate ARTIFACT_UPLOAD_ID
81+ run : echo "ARTIFACT_UPLOAD_ID=$(LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 10)" >> $GITHUB_ENV
82+
83+ - name : (Prepare Code to Analyze) Set sources-upload-name
84+ id : set-sources-upload-name
85+ run : echo "sources-upload-name=${{ steps.set-analysis-name.outputs.analysis-name }}-analysis-sources_input-${{ env.ARTIFACT_UPLOAD_ID }}" >> "$GITHUB_OUTPUT"
86+
87+ - name : (Prepare Code to Analyze) Set output variable 'artifacts-upload-name'
88+ id : set-artifacts-upload-name
89+ run : echo "artifacts-upload-name=${{ steps.set-analysis-name.outputs.analysis-name }}-analysis-artifacts-input-${{ env.ARTIFACT_UPLOAD_ID }}" >> "$GITHUB_OUTPUT"
90+
91+ - name : (Prepare Code to Analyze) Upload sources to analyze
92+ if : success()
93+ uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
94+ with :
95+ name : ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
96+ path : ./temp/${{ steps.set-analysis-name.outputs.analysis-name }}/source
97+ include-hidden-files : true
98+ if-no-files-found : error
99+ retention-days : 1
100+
101+ - name : (Prepare Code to Analyze) Upload artifacts to analyze
102+ if : success()
103+ uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
104+ with :
105+ name : ${{ steps.set-artifacts-upload-name.outputs.artifacts-upload-name }}
106+ path : ./temp/${{ steps.set-analysis-name.outputs.analysis-name }}/artifacts
107+ if-no-files-found : error
108+ retention-days : 1
109+
110+
111+
112+ analyze-code-graph :
113+ needs : [prepare-code-to-analyze]
114+ uses : ./.github/workflows/public-analyze-code-graph.yml
115+ with :
116+ analysis-name : ${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
117+ artifacts-upload-name : ${{ needs.prepare-code-to-analyze.outputs.artifacts-upload-name }}
118+ sources-upload-name : ${{ needs.prepare-code-to-analyze.outputs.sources-upload-name }}
119+
120+
121+
122+ commit-analysis-results :
123+ if : github.event_name == 'push'
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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
139+ with :
140+ name : ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
141+ path : ./results/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
142+
143+ - name : Commit "results" directory containing the reports
144+ # Only run when a pull request gets merged or a commit is pushed to the main branch
145+ # git add parameters need to match paths-ignore parameters above
146+ # Git pull before add/commit/push to reduce race conditions on parallel builds
147+ run : |
148+ git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
149+ git config --global user.email "[email protected] " 150+ git config --local http.postBuffer 524288000
151+ git fetch origin
152+ git status
153+ git add results
154+ git status
155+ git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
156+ git status
157+ git rebase --strategy-option=theirs origin/main --verbose
158+ git status
159+ git push --verbose
0 commit comments