├── .gitignore ├── LICENSE ├── README.md ├── action.yml └── images └── codeatlas-kubernetes-diagram.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Lukas Weidenholzer & individual contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Codeatlas codebase-visualizer-action 2 | 3 | > Codeatlas visualizes codebases. 4 | 5 | ![Codebase visualization for k8s](images/codeatlas-kubernetes-diagram.png) 6 | 7 | The codebase-visualizer-action creates a visualization of your codebase and makes it available at `https://codeatlas.dev/github///`. 8 | 9 | Explore sample visualizations of well-known open-source projects in our [gallery](https://codeatlas.dev/gallery)! 10 | 11 | >**Note**: The codebase-visualizer-action is **currently in beta**. If visualization for your repo fails for some reason, please consider opening an issue with a link to your workflow run so we can fix the problem! 12 | ## Usage 13 | To add Codeatlas to your Actions pipeline, specify the name of this repo with a tag (currently only `@v1-beta` is available) as a step in the `workflow.yml` file. 14 | 15 | `Settings - Actions - General - Allow GitHub Actions to create and approve pull requests` needs to be activated! If your repo is part of a GitHub organisation, this needs to be enabled in the organisation settings. 16 | 17 | Also note that at the moment this action assumes your GitHub runner's UID/GID pairing to be `1001:121` (the standard GitHub config). Self-hosted runners might not work for that reason! 18 | 19 | Add to `workflow.yml` like this: 20 | 21 | ``` 22 | steps: 23 | - uses: actions/checkout@v3 24 | - uses: codeatlasHQ/codebase-visualizer-action@v1-beta 25 | with: 26 | sub_directory: src/example/ # optional 27 | ``` 28 | 29 | >**Note**: Don't forget to add the `actions/checkout@v3` action step to checkout your repo on the GitHub Action runner before! 30 | 31 | The action will then run the main Codeatlas Docker image (maintained in the [codebase-tessellator](https://github.com/codeatlasHQ/codebase-tessellator) project) to create a snapshot of the repo. 32 | 33 | Upon a successful run, `codeatlas-bot` will create a branch named `codeatlas-preview` and add the data necessary for the visualization to the `.codeatlas` directory. It will then raise a PR to add this visualization snapshot data to your default branch. The bot will keep updating and overwriting the same PR everytime the action runs. After merging this PR, the interactive visualization will become available at `https://codeatlas.dev/github///`. 34 | 35 | **How often to trigger?** 36 | 37 | In our experience it's overkill to visualize a project with every push-event. In order to be mindful of CI minutes, we'd recommend using either: 38 | 1) the `on: [tag]` workflow trigger to update the visualization on each release or 39 | 2) the `on: [workflow_dispatch]` trigger to run the action manually and update the visualization whenever you want. 40 | 41 | See [this repo](https://github.com/codeatlasHQ/flask) for a working setup. 42 | 43 | ## Private Repositories 44 | This action does not yet support private repositories! The action should run through, but you will not be able to access your visualizations through codeatlas.dev. 45 | 46 | ## Arguments 47 | 48 | | Input | Description | Default | 49 | | :---: | :---: | :---: | 50 | | `sub_directory` | (Optional) Specify the root directory of your codebase. No leading slash allowed. | `""` | 51 | 52 | ## Roadmap 53 | Up next: 54 | - [x] Heatmap overlay 55 | - [x] Color legend for heatmap 56 | - [x] Programming language overlay 57 | - [x] Fixes to make mobile usable 58 | - [ ] Support for private repositories 59 | - [ ] Upload visualization results to codeatlas hosted storage instead of storing in git repo 60 | 61 | Longer term: 62 | - [ ] Functions and variables as atomic units instead of files 63 | - [ ] Test coverage overlay (Possible codecov.io integration?) 64 | - [ ] Dead code overlay 65 | - [ ] Support for viewing READMEs and Docstrings in frontend 66 | - [ ] Annotations for the graph 67 | - [ ] Slideshow through the graph 68 | 69 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | # action.yml 2 | name: 'Codeatlas - Codebase Visualization' 3 | description: "Visualize your codebase during CI." 4 | inputs: 5 | sub_directory: 6 | description: 'Sub-directory to start visualisation from.' 7 | required: false 8 | default: '' 9 | runs: 10 | using: "composite" 11 | steps: 12 | - name: pull 13 | shell: bash 14 | run: docker pull ghcr.io/codeatlashq/codebase-tessellator:0.1.2 15 | 16 | - name: 'Codeatlas - Codebase Visualisation' 17 | shell: bash 18 | run: docker run --mount type=bind,source="$GITHUB_WORKSPACE",target=$GITHUB_WORKSPACE ghcr.io/codeatlashq/codebase-tessellator:0.1.2 tessellate-from-path --repo_path $GITHUB_WORKSPACE/${{ inputs.sub_directory }} --output_path $GITHUB_WORKSPACE/.codeatlas --repo_owner $GITHUB_REPOSITORY_OWNER 19 | 20 | - uses: peter-evans/create-pull-request@v4 21 | with: 22 | add-paths: ".codeatlas/" 23 | commit-message: "codeatlas: update repo visualization to ${{ github.sha }}." 24 | committer: "codeatlas-bot " 25 | author: "codeatlas-bot " 26 | branch: "codeatlas-preview" 27 | delete-branch: true 28 | title: "Codeatlas: Update repo visualisation." 29 | body: | 30 | Adds data for codebase visualization at codeatlas.dev. 31 | Preview diagram here: https://codeatlas.dev/github/${{ github.repository }}/codeatlas-preview 32 | 33 | After merging, this diagram will become permanently available at https://codeatlas.dev/github/${{ github.repository }}/${{ github.event.repository.default_branch }} 34 | 35 | You can use the following badge to embed this link in your README: 36 | `![](https://img.shields.io/badge/Codeatlas-Codebase_visualized-323b4f?link=https://codeatlas.dev/github/${{ github.repository }}/${{ github.event.repository.default_branch }}` 37 | 38 | ![](https://img.shields.io/badge/Codeatlas-Codebase_visualized-323b4f?link=https://codeatlas.dev/github/${{ github.repository }}/${{ github.event.repository.default_branch }}) 39 | 40 | (Auto-generated by [codebase-visualizer-action](https://github.com/codeatlasHQ/codebase-visualizer-action)) 41 | branding: 42 | color: gray-dark 43 | icon: map -------------------------------------------------------------------------------- /images/codeatlas-kubernetes-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeatlasHQ/codebase-visualizer-action/2a538e5e51a8b4a6398791295f25c85e04073e66/images/codeatlas-kubernetes-diagram.png --------------------------------------------------------------------------------