name: Continuous Integration on: push: paths: - 'src/*.cpp' - 'src/*.hpp' - '.clang-format' - 'Makefile' - '.github/**' workflow_dispatch: pull_request: paths: - 'src/*.cpp' - 'src/*.hpp' permissions: contents: write pull-requests: write jobs: linux: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork name: "Build (Linux)" runs-on: ubuntu-latest container: image: archlinux steps: - name: Checkout repository actions uses: actions/checkout@v4 with: sparse-checkout: .github/actions - name: Setup base uses: ./.github/actions/setup_base - 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 all - name: Upload Artifact if: success() uses: actions/upload-artifact@v4 with: name: chat-server-linux path: build/chat-server # macos: # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork # name: "Build (macOS)" # runs-on: macos-latest # steps: # - name: Install dependencies # run: | # brew update # brew install llvm@14 gcc@14 make ninja # - name: Install compiler # id: install_cc # uses: rlalik/setup-cpp-compiler@master # with: # compiler: gcc-14 # - name: Checkout repository # uses: actions/checkout@v4 # with: # ref: ${{ github.head_ref }} # fetch-depth: 0 # - name: Build project # env: # # CC: ${{ steps.install_cc.outputs.cc }} # # CXX: ${{ steps.install_cc.outputs.cxx }} # # above don't work cuz for some reason it's using g++ from /usr/local/bin :/ # CC: /opt/homebrew/bin/g++-14 # CXX: /opt/homebrew/bin/g++-14 # run: make all # - name: Upload Artifact # if: success() # uses: actions/upload-artifact@v4 # with: # name: chat-server-macos # path: build/chat-server clang-linux: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork name: "Build with Clang (Linux)" runs-on: ubuntu-latest container: image: archlinux steps: - name: Checkout repository actions uses: actions/checkout@v4 with: sparse-checkout: .github/actions - name: Setup base uses: ./.github/actions/setup_base - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} ssh-key: ${{ secrets.DEPLOY_KEY }} fetch-depth: 0 - name: Build project run: | CXX=clang++ CC=clang++ make all clang-format: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork name: "Code Style (Arch)" runs-on: ubuntu-latest container: image: archlinux steps: - name: Install dependencies run: | pacman -Syu --noconfirm pacman -S --noconfirm make clang git - 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: make clang-format - name: Configure Git run: git config --global --add safe.directory '*' - 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] " clang-tidy: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork name: "Static Analysis (Arch)" runs-on: ubuntu-latest container: image: archlinux steps: - name: Install dependencies run: | pacman -Syu --noconfirm pacman -S --noconfirm make clang git - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} ssh-key: ${{ secrets.DEPLOY_KEY }} fetch-depth: 0 - name: Run clang-tidy run: make clang-tidy || true - name: Configure Git run: git config --global --add safe.directory '*' - name: Push changes uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "style: clang-tidy" commit_user_name: "github-actions[bot]" commit_user_email: "github-actions[bot]@users.noreply.github.com" commit_author: "github-actions[bot] "