name: continuous integration on: push: paths: - 'src/*.cpp' - '.clang-format' - 'Makefile' - '.github/**' workflow_dispatch: pull_request: paths: - 'src/*.cpp' - 'include/*.hpp' permissions: contents: write pull-requests: write jobs: clang-format: runs-on: ubuntu-latest steps: - name: Install dependencies(clang-format) run: sudo apt update && sudo apt install -y clang-format - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} ssh-key: ${{ secrets.DEPLOY_KEY }} fetch-depth: 0 - name: Run clang-format run: clang-format -i src/*.cpp src/*.hpp - name: Push changes uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "style: clang-format" commit_user_name: "github-actions[bot]" commit_user_email: "github-actions[bot]@users.noreply.github.com" commit_author: "github-actions[bot] " # commit_branch: ${{ github.head_ref }} build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} ssh-key: ${{ secrets.DEPLOY_KEY }} fetch-depth: 0 - name: Build project run: | make - name: Revert bad commit if: ${{ failure() && format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git revert HEAD --no-edit git push --force - name: Upload Artifact if: success() uses: actions/upload-artifact@v4 with: name: Artifact path: bin/ doxygen: runs-on: ubuntu-latest if: ${{ github.event_name == 'push' && format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} steps: - name: Install dependencies(doxygen, graphviz) run: sudo apt update && sudo apt install -y doxygen graphviz - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} ssh-key: ${{ secrets.DEPLOY_KEY }} fetch-depth: 0 - name: Generate Doxygen documentation run: doxygen - name: Push changes uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "bump: doxygen" commit_user_name: "github-actions[bot]" commit_user_email: "github-actions[bot]@users.noreply.github.com" commit_author: "github-actions[bot] " # commit_branch: ${{ github.head_ref }} - name: Deploy to Github Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: Doxygen path: docs/