Initial Setup #4
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: Typescript 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' | |
| - '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 analysis-results for pull request events | |
| paths-ignore: | |
| - 'analysis-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: | |
| analysis-results: | |
| # This workflow is disabled for now and will be enabled as soon as the everything is set up correctly | |
| if: false | |
| 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: 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 analysis-results 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 analysis-results (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 analysis-results from the temp to the analysis-results directory preserving their surrounding directory | |
| working-directory: temp | |
| run: ./../scripts/copyReportsIntoResults.sh | |
| # 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: typescript-code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }} | |
| path: | | |
| ./temp/**/runtime/* | |
| ./temp/**/analysis-results/* | |
| 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: typescript-code-analysis-analysis-results-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }} | |
| path: ./temp/**/analysis-results/* | |
| 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 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 |