0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C++のクラス図をGitHub Actionsで自動生成する

Posted at

はじめに

GitHub Actions から C++ のクラス図を自動で生成し、README などの Markdonw ドキュメントから参照できるようにする方法についてまとめます。

サンプル

後ほど解説をまとめます。

name: documentation

on:
  push:
    branches:
      - master
    paths-ignore:
      - "docs/**"
      - "**.md"

jobs:
  generate_plantuml:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: recursive
          ref: ${{ github.head_ref }}
          fetch-depth: 0
      - name: Setup Java
        uses: actions/setup-java@v1
        with:
          java-version: "11"
      - name: Setup Python 3.8
        uses: actions/setup-python@v4
        with:
          python-version: 3.8
      - name: Install dependencies
        run: |
          sudo apt install -y graphviz
          pip install hpp2plantuml
      - name: Generate PlantUML
        run: |
          mkdir -p docs/pu
          hpp2plantuml -i "./**/*.h*" -o docs/pu/class.pu
          java -jar ./tools/plantuml/plantuml.jar -svg ./docs/pu/class.pu -charset UTF-8
      - name: Count changes
        id: changes
        run: |
          git add -N .
          echo "::set-output name=count::$(git diff --name-only | wc -l)"
      - name: Commit files
        if: steps.changes.outputs.count > 0
        run: |
          git config user.name github-actions
          git config user.email github-actions@github.com
          git add ./docs/
          git commit -m "generated"
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          force_with_lease: true
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?