From 4817b008434e2122679568d1223af4c656f0d2fd Mon Sep 17 00:00:00 2001 From: SachinVin <26602104+SachinVin@users.noreply.github.com> Date: Mon, 6 Sep 2021 21:27:36 +0530 Subject: [PATCH] CI: Decouple clang-format from the linux build matrix (#5838) --- .ci/linux-clang-format/script.sh | 4 ++-- .github/workflows/ci.yml | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.ci/linux-clang-format/script.sh b/.ci/linux-clang-format/script.sh index 969ab637c..0dc428bc0 100755 --- a/.ci/linux-clang-format/script.sh +++ b/.ci/linux-clang-format/script.sh @@ -10,9 +10,9 @@ fi CLANG_FORMAT=clang-format-10 $CLANG_FORMAT --version -if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then +if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then # Get list of every file modified in this pull request - files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)" + files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)" else # Check everything for branch pushes files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd7321a13..bd0f4f0ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,22 @@ on: branches: [ master ] jobs: + clang-format: + runs-on: ubuntu-latest + container: citraemu/build-environments:linux-clang-format + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build + env: + COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + run: ./.ci/linux-clang-format/docker.sh build: runs-on: ubuntu-latest strategy: matrix: - image: ["linux-clang-format", "linux-fresh", "linux-frozen", "linux-mingw"] + image: ["linux-fresh", "linux-frozen", "linux-mingw"] container: citraemu/build-environments:${{ matrix.image }} steps: - uses: actions/checkout@v2 @@ -34,12 +45,12 @@ jobs: ENABLE_COMPATIBILITY_REPORTING: "ON" - name: Pack run: ./.ci/${{ matrix.image }}/upload.sh - if: ${{ matrix.image != 'linux-frozen' && matrix.image != 'linux-clang-format' }} + if: ${{ matrix.image != 'linux-frozen' }} env: NAME: ${{ matrix.image }} - name: Upload uses: actions/upload-artifact@v2 - if: ${{ matrix.image != 'linux-frozen' && matrix.image != 'linux-clang-format' }} + if: ${{ matrix.image != 'linux-frozen' }} with: name: ${{ matrix.image }} path: artifacts/