1- name : react-router Typescript Code Structure Graph Analysis
1+ name : react-router Code Graph Analysis (TypeScript)
22
33on :
44 push :
3737 - ' .github/workflows/*documentation.yml'
3838
3939jobs :
40- analysis-results :
40+ prepare-code-to-analyze :
4141 runs-on : ubuntu-latest
42- strategy :
43- matrix :
44- include :
45- - os : ubuntu-latest
46- java : 17
47- python : 3.11
48- miniforge : 24.9.0-0
42+ outputs :
43+ analysis-name : ${{ steps.set-analysis-name.outputs.analysis-name }}
44+ uploaded-artifact-name : ${{ steps.set-uploaded-artifact-name.outputs.uploaded-artifact-name }}
4945
5046 env :
51- CI_COMMIT_MESSAGE : Automated code structure analysis analysis-results (CI)
52- CI_COMMIT_AUTHOR : ${{ github.event.repository.name }} Continuous Integration
5347 PROJECT_NAME : react-router
5448 # Version variable name matches renovate.json configuration entry
5549 REACT_ROUTER_VERSION : 6.28.1
5650
5751 steps :
58- - name : Checkout GIT Repository
52+ - name : (Prepare Code to Analyze) Checkout react-router repository
5953 uses : actions/checkout@v4
6054 with :
61- token : ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
62-
63- - name : (Code Analysis Setup) Set ANALYSIS_NAME
64- run : echo "ANALYSIS_NAME=${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}" >> $GITHUB_ENV
65-
66- - name : (Code Analysis Setup) Generate Neo4j Initial Password
67- id : generate_neo4j_initial_password
68- shell : bash
69- run : |
70- generated_password=$( LC_ALL=C tr -dc '[:graph:]' </dev/urandom | head -c 12; echo )
71- echo "::add-mask::$generated_password"
72- echo "neo4j_initial_password=$generated_password" >> "$GITHUB_OUTPUT"
73-
74- - name : Setup Code Analysis
75- uses : ./.github/actions/setup-code-analysis
76- with :
77- java-version : ${{ matrix.java }}
78- python-version : ${{ matrix.python }}
79- miniforge-version : ${{ matrix.miniforge }}
80- analysis-name : ${{ env.ANALYSIS_NAME }}
81- neo4j-password : ${{ steps.generate_neo4j_initial_password.outputs.neo4j_initial_password }}
82-
83- - name : (Code Analysis Setup) Download ${{ env.ANALYSIS_NAME }}
84- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}
85- run : |
86- ./../../scripts/downloader/downloadReactRouter.sh ${{ env.REACT_ROUTER_VERSION }}
87-
88- - name : (Code Analysis Setup) Setup pnpm for react-router
55+ repository : remix-run/react-router
56+ ref : react-router@${{ env.REACT_ROUTER_VERSION }}
57+
58+ - name : (Prepare Code to Analyze) Setup pnpm for react-router
895990- with :
91- package_json_file : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}/source/${{ env.ANALYSIS_NAME }}/package.json
9260
93- - name : (Code Analysis Setup) Install dependencies with pnpm
94- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}/source/${{ env.ANALYSIS_NAME }}
95- run : |
96- pnpm install --frozen-lockfile --strict-peer-dependencies
61+ - name : (Prepare Code to Analyze) Install dependencies with pnpm
62+ run : pnpm install --frozen-lockfile --strict-peer-dependencies
9763
98- - name : Analyze ${{ env.ANALYSIS_NAME }}
99- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}
100- # Shell type can be skipped if jupyter notebook analysis-results (and therefore conda) aren't needed
101- shell : bash -el {0}
102- env :
103- NEO4J_INITIAL_PASSWORD : ${{ steps.generate_neo4j_initial_password.outputs.neo4j_initial_password }}
104- ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION : " true"
105- IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT : " " # Options: "none", "aggregated", "full". default = "plugin" or ""
106- run : |
107- ./../../scripts/analysis/analyze.sh --profile Neo4jv5-low-memory
108-
109- - name : (Code Analysis) Collect analysis results
110- working-directory : code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }}
111- run : |
112- mkdir -p ./../../../analysis-results/${{ env.ANALYSIS_NAME }}
113- cp -Rp reports ./../../../analysis-results/${{ env.ANALYSIS_NAME }}
114-
115- # Upload logs and unfinished analysis-results in case of an error for troubleshooting
116- - name : Archive failed run with logs and unfinished analysis-results
117- if : failure()
118- uses : actions/upload-artifact@v4
119- with :
120- name : typescript-code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
121- path : |
122- ./code-graph-analysis-pipeline/temp/**/runtime/*
123- ./code-graph-analysis-pipeline/temp/**/results/*
124- retention-days : 5
64+ - name : (Prepare Code to Analyze) Assemble ANALYSIS_NAME
65+ run : echo "ANALYSIS_NAME=${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}" >> $GITHUB_ENV
66+
67+ - name : (Prepare Code to Analyze) Generate ARTIFACT_UPLOAD_ID
68+ shell : bash
69+ run : echo "ARTIFACT_UPLOAD_ID=$(LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 10)" >> $GITHUB_ENV
70+
71+ - name : (Prepare Code to Analyze) Assemble ARTIFACT_NAME
72+ shell : bash
73+ run : echo "ARTIFACT_NAME=${{ env.ANALYSIS_NAME }}-analysis-input-${{ env.ARTIFACT_UPLOAD_ID }}" >> $GITHUB_ENV
12574
126- # Upload successful analysis-results in case they are needed for troubleshooting
127- - name : Archive successful analysis-results
75+ - name : (Prepare Code to Analyze) Upload code to analyze
12876 if : success()
12977 uses : actions/upload-artifact@v4
13078 with :
131- name : typescript-code-analysis-analysis-results-java- ${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
132- path : ./analysis-results/${{ env.ANALYSIS_NAME }}/*
79+ name : ${{ env.ARTIFACT_NAME }}
80+ path : .
13381 if-no-files-found : error
13482 retention-days : 5
83+
84+ - name : (Prepare Code to Analyze) Set output variable analysis-name
85+ id : set-analysis-name
86+ run : echo "analysis-name=${{ env.ANALYSIS_NAME }}" >> "$GITHUB_OUTPUT"
87+
88+ - name : (Prepare Code to Analyze) Set output variable uploaded-artifact-name
89+ id : set-uploaded-artifact-name
90+ run : echo "uploaded-artifact-name=${{ env.ARTIFACT_NAME }}" >> "$GITHUB_OUTPUT"
91+
92+
93+ analyze-code-graph :
94+ needs : [prepare-code-to-analyze]
95+ uses : ./.github/workflows/analyze-code-graph.yml
96+ with :
97+ analysis-name : ${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
98+ uploaded-artifact-name : ${{ needs.prepare-code-to-analyze.outputs.uploaded-artifact-name }}
13599
136- # Upload Database Export
137- # Only possible after an export with "./../../scripts/analysis/analyze.sh --report DatabaseCsvExport"
138- # Won't be done here because of performance and security concerns
139- # - name: Archive exported database
140- # uses: actions/upload-artifact@v3
141- # with:
142- # name: typescript-code-analysis-database-export-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
143- # path: ./code-graph-analysis-pipeline/temp/**/import
144- # if-no-files-found: error
145- # retention-days: 5
100+
101+ analysis-results :
102+ needs : [prepare-code-to-analyze, analyze-code-graph]
103+ runs-on : ubuntu-latest
104+
105+ env :
106+ CI_COMMIT_MESSAGE : Automated code structure analysis analysis-results (CI)
107+ CI_COMMIT_AUTHOR : ${{ github.event.repository.name }} Continuous Integration
108+
109+ steps :
110+ - name : Checkout GIT Repository
111+ uses : actions/checkout@v4
112+ with :
113+ token : ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
114+
115+ - name : (Code Analysis Setup) Download source code and artifacts for analysis
116+ uses : actions/download-artifact@v4
117+ with :
118+ name : ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
119+ path : analysis-results/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
146120
147121 # Commit and push the native image agent analysis-results
148122 - name : Display environment variable "github.event_name"
149123 run : echo "github.event_name=${{ github.event_name }}"
150- - name : Commit changes in the "analysis-results" directory
124+ - name : Display changes in the "analysis-results" directory and prepare commit
151125 # Only run when a pull request gets merged or a commit is pushed to the main branch
152126 # git add parameters need to match paths-ignore parameters above
153127 # Git pull before add/commit/push to reduce race conditions on parallel builds
154- if : github.event_name == 'push'
155128 run : |
156129 git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
157130 git config --global user.email "[email protected] " @@ -160,6 +133,12 @@ jobs:
160133 git status
161134 git add analysis-results
162135 git status
136+ - name : Commit and push changes in the "analysis-results" directory
137+ # Only run when a pull request gets merged or a commit is pushed to the main branch
138+ # git add parameters need to match paths-ignore parameters above
139+ # Git pull before add/commit/push to reduce race conditions on parallel builds
140+ if : github.event_name == 'push'
141+ run : |
163142 git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
164143 git status
165144 git rebase --strategy-option=theirs origin/main --verbose
0 commit comments