Initial Setup #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AxonFramework Java Code Structure Graph Analysis | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Ignore changes in documentation, general configuration and analysis-results for push events | |
| paths-ignore: | |
| - 'analysis-results/**' | |
| - '**/*.md' | |
| - '**/*.txt' | |
| - '**/*.css' | |
| - '**/*.html' | |
| - '**/*.js' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - 'renovate.json' | |
| - '**.code-workspace' | |
| - '.github/workflows/typescript-code-analysis.yml' | |
| - '.github/workflows/*documentation.yml' | |
| pull_request: | |
| branches: | |
| - main | |
| # Ignore changes in documentation, general configuration and analysis-results for pull request events | |
| paths-ignore: | |
| - 'analysis-results/**' | |
| - '**/*.md' | |
| - '**/*.txt' | |
| - '**/*.css' | |
| - '**/*.html' | |
| - '**/*.js' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - 'renovate.json' | |
| - '**.code-workspace' | |
| - '.github/workflows/typescript-code-analysis.yml' | |
| - '.github/workflows/*documentation.yml' | |
| # Requires the secret NEO4J_INITIAL_PASSWORD to be configured | |
| jobs: | |
| analysis-results: | |
| 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 analysis-results (CI) | |
| CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration | |
| PROJECT_NAME: AxonFramework | |
| # Version variable name matches renovate.json configuration entry | |
| AXON_FRAMEWORK_VERSION: 4.10.3 | |
| steps: | |
| - name: Checkout GIT Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }} | |
| - name: Checkout code-graph-analysis-pipeline | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: JohT/code-graph-analysis-pipeline | |
| ref: 41f3e22b5bd65351474dd23effeee91fab849a12 | |
| path: code-graph-analysis-pipeline | |
| persist-credentials: false | |
| - name: (Java Setup) Use Java Development Kit (JDK) ${{ matrix.java }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'adopt' | |
| java-version: ${{ matrix.java }} | |
| # "Setup Python" can be skipped if jupyter notebook analysis-results aren't needed | |
| - name: (Python Setup) 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') }} | |
| - name: (Python Setup) Use version ${{ 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: ./code-graph-analysis-pipeline/jupyter/environment.yml | |
| auto-activate-base: false | |
| use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
| - name: (Python Setup) Conda environment info | |
| shell: bash -el {0} | |
| run: conda info | |
| - name: (Code Analysis Setup) Add code-graph-analysis-pipeline temporarily to .gitignore | |
| run: | | |
| echo "" >> .gitignore | |
| echo "# Code Graph Analysis Pipeline" >> .gitignore | |
| echo "code-graph-analysis-pipeline/" >> .gitignore | |
| - name: (Code Analysis Setup) Set ANALYSIS_NAME | |
| run: echo "ANALYSIS_NAME=${{ env.PROJECT_NAME }}-${{ env.AXON_FRAMEWORK_VERSION }}" >> $GITHUB_ENV | |
| - name: (Code Analysis Setup) Generate NEO4J_INITIAL_PASSWORD | |
| run: echo "NEO4J_INITIAL_PASSWORD=$(LC_ALL=C tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 10)" >> $GITHUB_ENV | |
| - name: (Code Analysis Setup) Setup Cache Analysis Downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./code-graph-analysis-pipeline/temp/downloads | |
| key: | |
| ${{ runner.os }}-${{ hashFiles('**/*.sh') }} | |
| - name: (Code Analysis) Initialize Analysis | |
| working-directory: code-graph-analysis-pipeline | |
| env: | |
| NEO4J_INITIAL_PASSWORD: ${{ env.NEO4J_INITIAL_PASSWORD }} | |
| run: ./init.sh ${{ env.ANALYSIS_NAME }} | |
| - name: (Code Analysis) Download ${{ env.ANALYSIS_NAME }} | |
| working-directory: code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }} | |
| run: | | |
| ./../../scripts/downloader/downloadAxonFramework.sh ${{ env.AXON_FRAMEWORK_VERSION }} | |
| - name: (Code Analysis) Analyze ${{ env.ANALYSIS_NAME }} | |
| working-directory: code-graph-analysis-pipeline/temp/${{ env.ANALYSIS_NAME }} | |
| # Shell type can be skipped if jupyter notebook analysis-results (and therefore conda) aren't needed | |
| shell: bash -el {0} | |
| env: | |
| NEO4J_INITIAL_PASSWORD: ${{ env.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 --profile Neo4jv5-low-memory | |
| - name: (Code Analysis) Collect analysis results | |
| working-directory: code-graph-analysis-pipeline/temp | |
| run: | | |
| mkdir -p ./../../analysis-results/${{ env.PROJECT_NAME }}-${{ env.AXON_FRAMEWORK_VERSION }} | |
| cp -Rp reports ./../../analysis-results/${{ env.PROJECT_NAME }}-${{ env.AXON_FRAMEWORK_VERSION }} | |
| # Upload logs and unfinished analysis-results in case of an error for troubleshooting | |
| - name: Archive failed run with logs and unfinished analysis-results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: java-code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }} | |
| path: | | |
| ./code-graph-analysis-pipeline/temp/**/runtime/* | |
| ./code-graph-analysis-pipeline/temp/**/reports/* | |
| retention-days: 5 | |
| # Upload successful analysis-results in case they are needed for troubleshooting | |
| - name: Archive successful analysis-results | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: java-code-analysis-analysis-results-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }} | |
| path: ./code-graph-analysis-pipeline/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: java-code-analysis-database-export-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }} | |
| # path: ./code-graph-analysis-pipeline/temp/**/import | |
| # if-no-files-found: error | |
| # retention-days: 5 | |
| # Commit and push the native image agent analysis-results | |
| - name: Display environment variable "github.event_name" | |
| run: echo "github.event_name=${{ github.event_name }}" | |
| - name: Commit "analysis-results" directory containing the analysis-results | |
| # 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 analysis-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 |