This repository provides examples of how to analyze TypeScript code and Java artifacts using a fully automated GitHub Workflows pipeline with the code-graph-analysis-pipeline.
The process involves three steps:
-
Extract: Upload TypeScript source code and/or Java artifacts, optionally including their git history, using actions/upload-artifact.
-
Analyze: Use the shared workflow JohT/code-graph-analysis-pipeline/.github/workflows/public-analyze-code-graph.yml to analyze the code and artifacts, then upload the results.
-
Use: Download the analysis results with actions/download-artifact and utilize them as needed.
- Table of Contents
- π TypeScript Code Pipeline
- β Java Artifacts Pipeline
- π CSV Report Reference
- π Jupyter Notebook Report Reference
- πΌοΈ Image Reference
- β»οΈ Update Analysis Workflow with Renovate
- π License
- π Analysis Results
- External Dependencies of Java Packages
- Dependencies Graph of Java Artifacts
- Longest Paths of Java Artifacts
- All Pairs Shortest Paths of Java Packages per Artifact
- Object-Oriented Design Metrics for Java Packages
- Effective Line Count of Java Methods
- Cyclomatic Complexity Distribution for Java Methods
- Visibility of Java Types
- Communities and Node Embeddings of Java Packages
- Word Cloud of Git Authors
This example demonstrates how to analyze TypeScript code in a GitHub Workflows pipeline.
-
The first job, prepare-code-to-analyze, in the GitHub Actions Workflow typescript-code-analysis.yml, shows how to extract TypeScript code from a repository and upload it for analysis.
-
The second job, analyze-code-graph, calls the shared analysis workflows using the uploaded artifacts' names as parameters. Here is a simple example:
name: Analyze Code Graph
needs: [prepare-code-to-analyze]
uses: JohT/code-graph-analysis-pipeline/.github/workflows/public-analyze-code-graph.yml
with:
analysis-name: ${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
sources-upload-name: ${{ needs.prepare-code-to-analyze.outputs.sources-upload-name }}
- The third job, analyze-code-graph, demonstrates how to download the analysis results and commit them back to the repository.
Java artifacts are analyzed similarly to TypeScript code. The main difference is that Java artifacts are downloaded from a Maven repository instead of being part of the repository.
To include the git history in the analysis, checkout the corresponding source repository and upload it as the source artifact, similar to the TypeScript example. The Java source code isn't used for the analysis, so a bare git clone is sufficient.
The first job, prepare-code-to-analyze, in the GitHub Actions Workflow java-code-analysis.yml, shows how to prepare the Java artifacts and git history for analysis.
The second and third jobs are the same as for the TypeScript example.
CSV_REPORTS.md lists all CSV Cypher query result reports inside the results directory. It can be generated as described in Generate CSV Report Reference.
JUPYTER_REPORTS.md lists all Jupyter Notebook reports inside the results directory. It can be generated as described in Generate Jupyter Notebook Report Reference.
IMAGES.md lists all PNG images inside the results directory. It can be generated as described in Generate Image Reference.
This repository uses Renovate to automatically update the analysis workflow to the latest version. To enable this, add the following extension to your Renovate configuration:
"extends": [
"github>JohT/code-graph-analysis-pipeline//renovate-presets/code-graph-analysis-workflow-latest-digest.json5"
]
You can find the complete configuration in the renovate.json file.
This repository is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Here are ten examples from over a hundred reports generated by the analysis. These examples illustrate the results of analyzing AxonFramework, a Java framework for Evolutionary Message-Driven Microservices on the JVM. For the complete set of reports, visit the analysis-results directory.