From c0411110cb086a9e78d9acd4435ae07472f11994 Mon Sep 17 00:00:00 2001 From: Meltie2013 Date: Fri, 5 Mar 2021 16:50:24 -0600 Subject: [PATCH] GitHub Actions Refactor (#143) * Split Linux and Windows into their own jobs * Implement Codestyling Check Script * It checks for whitespaces (tabs). * Fix some alignments. --- .github/workflows/core_build.yml | 29 +-------------------- .github/workflows/core_codestyle.yml | 17 +++++++++++++ .github/workflows/core_windows_build.yml | 32 ++++++++++++++++++++++++ apps/ci/ci-codestyle.sh | 25 ++++++++++++++++++ 4 files changed, 75 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/core_codestyle.yml create mode 100644 .github/workflows/core_windows_build.yml create mode 100644 apps/ci/ci-codestyle.sh diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index e5b99475..b3d5a00a 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -1,4 +1,4 @@ -name: core-build +name: Linux Build on: push: branches: [ master ] @@ -43,30 +43,3 @@ jobs: - name: Build Mangos Project run: source ./apps/ci/ci-compile.sh - - windows-build: - strategy: - fail-fast: false - - runs-on: windows-2019 - name: Windows Server 2019 - - steps: - - uses: actions/checkout@v2 - - - name: Configure Windows - run: choco install --no-progress openssl - - - name: Checkout Submodules - shell: bash - run: | - git submodule init && git submodule update - - - name: Build - shell: bash - run: | - mkdir -p build && cd build - cmake .. -DBUILD_TOOLS:BOOL=1 -DBUILD_MANGOSD:BOOL=1 -DBUILD_REALMD:BOOL=1 -DSOAP:BOOL=1 -DSCRIPT_LIB_ELUNA:BOOL=1 -DSCRIPT_LIB_SD3:BOOL=1 -DPLAYERBOTS:BOOL=1 -DUSE_STORMLIB:BOOL=1 - cmake --build . --config Release --parallel 4 - - diff --git a/.github/workflows/core_codestyle.yml b/.github/workflows/core_codestyle.yml new file mode 100644 index 00000000..9408cca3 --- /dev/null +++ b/.github/workflows/core_codestyle.yml @@ -0,0 +1,17 @@ +name: Codestyle Checks +on: + push: + pull_request: + +jobs: + check-codestyle: + strategy: + fail-fast: false + + runs-on: ubuntu-20.04 + name: Check Codestyling + steps: + - uses: actions/checkout@v2 + + - name: Check Codestyling + run: source ./apps/ci/ci-codestyle.sh diff --git a/.github/workflows/core_windows_build.yml b/.github/workflows/core_windows_build.yml new file mode 100644 index 00000000..7f4c9601 --- /dev/null +++ b/.github/workflows/core_windows_build.yml @@ -0,0 +1,32 @@ +name: Windows Build +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + strategy: + fail-fast: false + + runs-on: windows-2019 + name: Windows Server 2019 + + steps: + - uses: actions/checkout@v2 + + - name: Configure Windows + run: choco install --no-progress openssl + + - name: Checkout Submodules + shell: bash + run: | + git submodule init && git submodule update + + - name: Build Project + shell: bash + run: | + mkdir -p build && cd build + cmake .. -DBUILD_TOOLS:BOOL=1 -DBUILD_MANGOSD:BOOL=1 -DBUILD_REALMD:BOOL=1 -DSOAP:BOOL=1 -DSCRIPT_LIB_ELUNA:BOOL=1 -DSCRIPT_LIB_SD3:BOOL=1 -DPLAYERBOTS:BOOL=1 -DUSE_STORMLIB:BOOL=1 + cmake --build . --config Release --parallel 4 diff --git a/apps/ci/ci-codestyle.sh b/apps/ci/ci-codestyle.sh new file mode 100644 index 00000000..b5ac505d --- /dev/null +++ b/apps/ci/ci-codestyle.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +echo "Starting Codestyling Script:" +echo "Checking for whitespaces:" +echo + +declare -A singleLineRegexChecks=( + ["[[:blank:]]$"]="Remove whitespace at the end of the lines above" + ["\t"]="Replace tabs with 4 spaces in the lines above" +) + +for check in ${!singleLineRegexChecks[@]}; do + echo " Checking RegEx: '${check}'" + + if grep -P -r -I -n ${check} src; then + echo + echo "${singleLineRegexChecks[$check]}" + exit 1 + fi +done + +echo +echo "Awesome! No issues..."