-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (177 loc) · 7.35 KB
/
typescript-code-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Typescript Code Structure Graph Analysis
on:
push:
branches:
- main
# Ignore changes in documentation, general configuration and reports for push events
paths-ignore:
- 'results/**'
- '**/*.md'
- '**/*.txt'
- '**/*.css'
- '**/*.html'
- '**/*.js'
- '.gitignore'
- '.gitattributes'
- 'renovate.json'
- 'changelogTemplate.mustache'
- '**.code-workspace'
- '.github/workflows/java-code-analysis.yml'
- '.github/workflows/*documentation.yml'
pull_request:
branches:
- main
# Ignore changes in documentation, general configuration and reports for pull request events
paths-ignore:
- 'results/**'
- '**/*.md'
- '**/*.txt'
- '**/*.css'
- '**/*.html'
- '**/*.js'
- '.gitignore'
- '.gitattributes'
- 'renovate.json'
- 'changelogTemplate.mustache'
- '**.code-workspace'
- '.github/workflows/java-code-analysis.yml'
- '.github/workflows/*documentation.yml'
# Requires the secret NEO4J_INITIAL_PASSWORD to be configured
jobs:
reports:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-latest
java: 17
python: 3.11
miniforge: 24.9.0-0
env:
CI_COMMIT_MESSAGE: Automated code structure analysis reports (CI)
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
PROJECT_NAME: react-router
# Version variable name matches renovate.json configuration entry
REACT_ROUTER_VERSION: 6.28.1
steps:
- name: Checkout GIT Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
- name: Setup Java JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Setup Cache for Conda package manager Miniforge
uses: actions/cache@v4
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
# Reference: https://github.com/conda-incubator/setup-miniconda#caching
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-environments-${{hashFiles('**/environment.yml', '.github/workflows/*.yml') }}
# "Setup Python" can be skipped if jupyter notebook reports aren't needed
- name: Setup Python ${{ matrix.python }} with Conda package manager Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python }}
miniforge-version: ${{ matrix.miniforge }}
activate-environment: codegraph
environment-file: ./jupyter/environment.yml
auto-activate-base: false
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Conda environment info
shell: bash -el {0}
run: conda info
- name: Conda environment list updates
shell: bash -el {0}
run: conda update --all --dry-run | grep -Fe '-->'
- name: Setup temp directory if missing
run: mkdir -p ./temp
- name: Setup Cache for "temp/downloads" folder
uses: actions/cache@v4
with:
path: ./temp/downloads
key:
${{ runner.os }}-${{ hashFiles('**/*.sh') }}
- name: Download ${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}
working-directory: temp
run: |
mkdir -p ${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}
cd ${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}
echo "Working directory: $( pwd -P )"
./../../scripts/downloader/downloadReactRouter.sh ${{ env.REACT_ROUTER_VERSION }}
- name: Setup pnpm for react-router
uses: pnpm/action-setup@v4.0.0
with:
package_json_file: temp/${{env.PROJECT_NAME}}-${{env.REACT_ROUTER_VERSION}}/source/${{env.PROJECT_NAME}}-${{env.REACT_ROUTER_VERSION}}/package.json
- name: Install dependencies with pnpm
working-directory: temp/${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}/source/${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}
run: |
pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Analyze ${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}
working-directory: temp/${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}
# Shell type can be skipped if jupyter notebook reports (and therefore conda) aren't needed
shell: bash -el {0}
env:
NEO4J_INITIAL_PASSWORD: ${{ secrets.NEO4J_INITIAL_PASSWORD }}
ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION: "true"
IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT: "" # Options: "none", "aggregated", "full". default = "plugin" or ""
run: |
./../../scripts/analysis/analyze.sh
- name: Move reports from the temp to the results directory preserving their surrounding directory
working-directory: temp
run: ./../scripts/copyReportsIntoResults.sh
# Upload logs and unfinished reports in case of an error for troubleshooting
- name: Archive failed run with logs and unfinished results
if: failure()
uses: actions/upload-artifact@v4
with:
name: typescript-code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
path: |
./temp/**/runtime/*
./temp/**/reports/*
retention-days: 5
# Upload successful results in case they are needed for troubleshooting
- name: Archive successful results
if: success()
uses: actions/upload-artifact@v4
with:
name: typescript-code-analysis-results-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
path: ./temp/**/reports/*
if-no-files-found: error
retention-days: 5
# Upload Database Export
# Only possible after an export with "./../../scripts/analysis/analyze.sh --report DatabaseCsvExport"
# Won't be done here because of performance and security concerns
#- name: Archive exported database
# uses: actions/upload-artifact@v3
# with:
# name: typescript-code-analysis-database-export-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
# path: ./temp/**/import
# if-no-files-found: error
# retention-days: 5
# Commit and push the native image agent results
- name: Display environment variable "github.event_name"
run: echo "github.event_name=${{ github.event_name }}"
- name: Commit "results" directory containing the reports
# Only run when a pull request gets merged or a commit is pushed to the main branch
# git add parameters need to match paths-ignore parameters above
# Git pull before add/commit/push to reduce race conditions on parallel builds
if: github.event_name == 'push'
run: |
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
git config --global user.email "7671054+JohT@users.noreply.github.com"
git config --local http.postBuffer 524288000
git fetch origin
git status
git add results
git status
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git status
git rebase --strategy-option=theirs origin/main --verbose
git status
git push --verbose