Skip to content

Commit 9bb150d

Browse files
authored
Merge pull request #22 from JohT/feature/refactoring
Auto-generate reference documentation and some refactoring
2 parents 006591f + 4c39c5c commit 9bb150d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+510
-127
lines changed

.github/workflows/code-reports.yml renamed to .github/workflows/code-structure-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code Structure Analysis Reports
1+
name: Code Structure Analysis
22

33
on:
44
push:
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate cypher reference documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.cypher' # Only run when cypher files changed
9+
- '.github/workflows/cypher-reference-documentation.yml' # or when this file was changed
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**/*.cypher' # Only run when cypher files changed
15+
- '.github/workflows/cypher-reference-documentation.yml' # or when this file was changed
16+
17+
jobs:
18+
reports:
19+
runs-on: ubuntu-latest
20+
env:
21+
CI_COMMIT_MESSAGE: Automated cypher reference document generation (CI)
22+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
23+
24+
steps:
25+
- name: Checkout git repository
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29+
30+
- name: Generate cypher reference document
31+
working-directory: cypher
32+
run: |
33+
./../scripts/documentation/generateCypherReference.sh
34+
35+
- name: Archive generated cypher reference document
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: cypher-reference-document
39+
path: ./cypher/CYPHER.md
40+
if-no-files-found: error
41+
retention-days: 5
42+
43+
- name: Use git to detect changes in the regenerated document and set generated_document_changed
44+
run: git diff-index --quiet HEAD || echo "generated_document_changed=true" >> $GITHUB_ENV
45+
46+
- name: Display generated_document_changed
47+
run: echo "generated_document_changed=${{ env.generated_document_changed}}"
48+
49+
- name: Commit generated cypher reference document if there were changes
50+
# Only run when a pull request gets merged or a commit is pushed to the main branch.
51+
# And only run when the generated document changed to avoid an empty commit or an error while committing.
52+
if: github.event_name == 'push' && env.generated_document_changed
53+
run: |
54+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
55+
git config --global user.email '[email protected]'
56+
git add ./cypher/CYPHER.md
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
58+
git push
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate environment variables reference documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.sh' # Only run when script files changed
9+
- '.github/workflows/environment-variables-reference-documentation.yml' # or when this file was changed
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**/*.sh' # Only run when script files changed
15+
- '.github/workflows/environment-variables-reference-documentation.yml' # or when this file was changed
16+
17+
jobs:
18+
reports:
19+
runs-on: ubuntu-latest
20+
env:
21+
CI_COMMIT_MESSAGE: Automated environment variables documentation generation (CI)
22+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
23+
24+
steps:
25+
- name: Checkout git repository
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29+
30+
- name: Generate environment variables reference document
31+
working-directory: scripts
32+
run: |
33+
./documentation/generateEnvironmentVariablesReference.sh
34+
35+
- name: Archive generated environment variables reference document
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: environment-variables-reference-document
39+
path: ./scripts/ENVIRONMENT_VARIABLES.md
40+
if-no-files-found: error
41+
retention-days: 5
42+
43+
- name: Use git to detect changes in the regenerated document and set generated_document_changed
44+
run: git diff-index --quiet HEAD || echo "generated_document_changed=true" >> $GITHUB_ENV
45+
46+
- name: Display generated_document_changed
47+
run: echo "generated_document_changed=${{ env.generated_document_changed}}"
48+
49+
- name: Commit generated environment variables reference document if there were changes
50+
# Only run when a pull request gets merged or a commit is pushed to the main branch.
51+
# And only run when the generated document changed to avoid an empty commit or an error while committing.
52+
if: github.event_name == 'push' && env.generated_document_changed
53+
run: |
54+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
55+
git config --global user.email '[email protected]'
56+
git add ./scripts/ENVIRONMENT_VARIABLES.md
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
58+
git push
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate scripts reference documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.sh' # Only run when script files changed
9+
- '.github/workflows/scripts-reference-documentation.yml' # or when this file was changed
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**/*.sh' # Only run when script files changed
15+
- '.github/workflows/scripts-reference-documentation.yml' # or when this file was changed
16+
17+
jobs:
18+
reports:
19+
runs-on: ubuntu-latest
20+
env:
21+
CI_COMMIT_MESSAGE: Automated scripts reference document generation (CI)
22+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
23+
24+
steps:
25+
- name: Checkout git repository
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29+
30+
- name: Generate scripts reference document
31+
working-directory: scripts
32+
run: |
33+
./documentation/generateScriptReference.sh
34+
35+
- name: Archive generated scripts reference document
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: scripts-reference-document
39+
path: ./scripts/SCRIPTS.md
40+
if-no-files-found: error
41+
retention-days: 5
42+
43+
- name: Use git to detect changes in the regenerated document and set generated_document_changed
44+
run: git diff-index --quiet HEAD || echo "generated_document_changed=true" >> $GITHUB_ENV
45+
46+
- name: Display generated_document_changed
47+
run: echo "generated_document_changed=${{ env.generated_document_changed}}"
48+
49+
- name: Commit generated scripts reference document if there were changes
50+
# Only run when a pull request gets merged or a commit is pushed to the main branch.
51+
# And only run when the generated document changed to avoid an empty commit or an error while committing.
52+
if: github.event_name == 'push' && env.generated_document_changed
53+
run: |
54+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
55+
git config --global user.email '[email protected]'
56+
git add ./scripts/SCRIPTS.md
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
58+
git push

COMMANDS.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
```
4646

4747
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps.
48-
👉 See [code-reports Pipeline](./.github/workflows/code-reports.yml) on how to do this within a GitHub Actions Workflow.
48+
👉 See [Code Structure Analysis Pipeline](./.github/workflows/code-structure-analysis.yml) on how to do this within a GitHub Actions Workflow.
4949

5050
### Command Line Options
5151

@@ -102,32 +102,50 @@ without report generation use this command:
102102
103103
## Generate Markdown References
104104
105-
### Update Cypher Reference
105+
### Generate Cypher Reference
106106
107-
Change into the [cypher](./cypher/) directory e.g. with `cd cypher` and then execute the script [generateCypherReference.sh](./scripts/generateCypherReference.sh) with the following command:
107+
Change into the [cypher](./cypher/) directory e.g. with `cd cypher` and then execute the script [generateCypherReference.sh](./scripts/documentation/generateCypherReference.sh) with the following command:
108108
109109
```script
110-
./../scripts/generateCypherReference.sh
110+
./../scripts/documentation/generateCypherReference.sh
111111
```
112112
113-
### Update Script Reference
113+
### Generate Script Reference
114114
115-
Change into the [scripts](./scripts/) directory e.g. with `cd scripts` and then execute the script [generateScriptReference.sh](./scripts/generateScriptReference.sh) with the following command:
115+
Change into the [scripts](./scripts/) directory e.g. with `cd scripts` and then execute the script [generateScriptReference.sh](./scripts/documentation/generateScriptReference.sh) with the following command:
116116
117117
```script
118-
./../scripts/generateScriptReference.sh
118+
./documentation/generateScriptReference.sh
119119
```
120120
121-
### Update Markdown Reference
121+
### Generate CSV Cypher Query Report Reference
122122
123-
Change into the [results](./results/) directory e.g. with `cd results` and then execute the script [generateMarkdownReference.sh](./scripts/generateMarkdownReference.sh) with the following command:
123+
Change into the [results](./results/) directory e.g. with `cd results` and then execute the script [generateCsvReportReference.sh](./scripts/documentation/generateCsvReportReference.sh) with the following command:
124124
125125
👉**Note:** This script is automatically triggered at the end of [copyReportsIntoResults.sh](./scripts/copyReportsIntoResults.sh)
126-
which is included in the pipeline [code-reports.yml](.github/workflows/code-reports.yml) and doesn't need to be executed manually normally.
126+
which is included in the pipeline [code-structure-analysis.yml](.github/workflows/code-structure-analysis.yml) and doesn't need to be executed manually normally.
127127

128+
```script
129+
./../scripts/documentation/generateCsvReportReference.sh
130+
```
131+
132+
### Generate Jupyter Notebook Report Reference
133+
134+
Change into the [results](./results/) directory e.g. with `cd results` and then execute the script [generateJupyterReportsReference.sh](./scripts/documentation/generateJupyterReportsReference.sh) with the following command:
135+
136+
👉**Note:** This script is automatically triggered at the end of [copyReportsIntoResults.sh](./scripts/copyReportsIntoResults.sh)
137+
which is included in the pipeline [code-structure-analysis.yml](.github/workflows/code-structure-analysis.yml) and doesn't need to be executed manually normally.
138+
139+
```script
140+
./../scripts/documentation/generateJupyterReportsReference.sh
141+
```
142+
143+
### Generate Environment Variable Reference
144+
145+
Change into the [scripts](./scripts/) directory e.g. with `cd scripts` and then execute the script [generateEnvironmentVariablesReference.sh](./scripts/documentation/generateEnvironmentVariablesReference.sh) with the following command:
128146
129147
```script
130-
./../scripts/generateScriptReference.sh
148+
./documentation/generateEnvironmentVariablesReference.sh
131149
```
132150
133151
## Manual Setup

0 commit comments

Comments
 (0)