From 7cd03f14293257def99920741ac7e1c66f996eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Borz=C3=AC?= Date: Sun, 7 Nov 2021 10:11:13 +0100 Subject: [PATCH] feat(CI): skip matrix builds for non-C++ changes (#9008) --- .github/labeler.yml | 4 ++ .github/workflows/core_build.yml | 16 +----- .github/workflows/core_matrix_build.yml | 62 ++++++++++++++++++++++++ .github/workflows/core_modules_build.yml | 2 +- .github/workflows/cpp20.yml | 2 +- 5 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/core_matrix_build.yml diff --git a/.github/labeler.yml b/.github/labeler.yml index 6d2c5659c..cb814c5fc 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,7 @@ +file-cpp: + - ./*.cpp + - ./*.h + DB: - data/**/*.sql diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 586f673f4..c277548cd 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -1,4 +1,4 @@ -name: core-build +name: main on: push: branches: @@ -17,20 +17,6 @@ jobs: # the result of the matrix will be the combination of all attributes, so we get os*compiler builds os: [ubuntu-20.04] compiler: [clang] - # we can include specific combinations here - include: - - os: ubuntu-20.04 - compiler: clang12 - - os: ubuntu-20.04 - compiler: clang11 - - os: ubuntu-18.04 - compiler: clang10 - - os: ubuntu-18.04 - compiler: gcc8 - - os: ubuntu-20.04 - compiler: gcc # default in 20.04 is gcc 9 - - os: ubuntu-20.04 - compiler: gcc10 runs-on: ${{ matrix.os }} name: ${{ matrix.os }}-${{ matrix.compiler }} env: diff --git a/.github/workflows/core_matrix_build.yml b/.github/workflows/core_matrix_build.yml new file mode 100644 index 000000000..8ce384aa6 --- /dev/null +++ b/.github/workflows/core_matrix_build.yml @@ -0,0 +1,62 @@ +name: core +on: + push: + branches: + - 'master' + pull_request: + types: ['labeled'] + +concurrency: + group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }}) + cancel-in-progress: true + +jobs: + build: + strategy: + fail-fast: false + matrix: + # the result of the matrix will be the combination of all attributes, so we get os*compiler builds + include: + - os: ubuntu-20.04 + compiler: clang12 + - os: ubuntu-20.04 + compiler: clang11 + - os: ubuntu-18.04 + compiler: clang10 + - os: ubuntu-18.04 + compiler: gcc8 + - os: ubuntu-20.04 + compiler: gcc # default in 20.04 is gcc 9 + - os: ubuntu-20.04 + compiler: gcc10 + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }}-${{ matrix.compiler }} + env: + COMPILER: ${{ matrix.compiler }} + if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.event.label.name == 'run-build' || github.event.label.name == 'file-cpp' || github.ref == 'refs/heads/master') + steps: + - uses: actions/checkout@v2 + - name: Cache + uses: actions/cache@v2 + with: + path: var/ccache + key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }} + ccache:${{ matrix.os }}:${{ matrix.compiler }} + - name: Configure OS + run: source ./acore.sh install-deps + env: + CONTINUOUS_INTEGRATION: true + - name: Create conf/config.sh + run: source ./apps/ci/ci-conf.sh + - name: Import db + run: source ./apps/ci/ci-import-db.sh + - name: Build + run: source ./apps/ci/ci-compile.sh + - name: Dry run + run: source ./apps/ci/ci-worldserver-dry-run.sh + - name: Check startup errors + run: source ./apps/ci/ci-error-check.sh + - name: Run unit tests + run: source ./apps/ci/ci-run-unit-tests.sh diff --git a/.github/workflows/core_modules_build.yml b/.github/workflows/core_modules_build.yml index 3ead0f82f..cb5e6fcf8 100644 --- a/.github/workflows/core_modules_build.yml +++ b/.github/workflows/core_modules_build.yml @@ -22,7 +22,7 @@ jobs: name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.modules }}-modules env: COMPILER: ${{ matrix.compiler }} - if: github.repository == 'azerothcore/azerothcore-wotlk' + if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.event.label.name == 'file-cpp' || github.event.label.name == 'run-build' || github.ref == 'refs/heads/master') steps: - uses: actions/checkout@v2 - name: Checkout modules diff --git a/.github/workflows/cpp20.yml b/.github/workflows/cpp20.yml index e112f086a..34b1256d7 100644 --- a/.github/workflows/cpp20.yml +++ b/.github/workflows/cpp20.yml @@ -16,7 +16,7 @@ jobs: env: COMPILER: clang ENABLE_CPP_20: 1 - if: github.repository == 'azerothcore/azerothcore-wotlk' + if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.event.label.name == 'file-cpp' || github.event.label.name == 'run-build' || github.ref == 'refs/heads/master') steps: - uses: actions/checkout@v2 - name: Cache