diff options
Diffstat (limited to '.github/workflows/validate.yml')
| -rw-r--r-- | .github/workflows/validate.yml | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 000000000..3988a9dfb --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,170 @@ +name: Validate + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: [ main ] + push: + branches: [ main ] + +jobs: + cancel-old-build: + name: Cancel previous builds + runs-on: [self-hosted, linux, x64] + + steps: + - name: Cancel Previous Runs + if: ${{ github.ref_name != 'main'}} + uses: styfle/[email protected] + with: + access_token: ${{ github.token }} + + clang-format: + needs: cancel-old-build + name: Check clang-format + runs-on: [self-hosted, linux, x64] + + steps: + - uses: actions/checkout@v2 + + - name: clang-format + uses: jidicula/[email protected] + with: + clang-format-version: '13' + check-path: '.' + exclude-regex: (.*thirdparty.*) + + windows-build: + needs: cancel-old-build + name: Build & Test Windows + runs-on: [self-hosted, windows, x64] + timeout-minutes: 10 + strategy: + matrix: + config: + - 'debug' + - 'release' + arch: + - 'x64' + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: 2.6.4 + + - name: Installing vcpkg + run: | + git clone -b ${{env.VCPKG_VERSION}} --single-branch https://github.com/Microsoft/vcpkg.git .vcpkg + cd .vcpkg + .\bootstrap-vcpkg.bat + .\vcpkg.exe integrate install + cd .. + + - name: Cache vcpkg + uses: actions/cache@v2 + with: + path: | + ${{ github.workspace }}\.vcpkg\installed + key: ${{ runner.os }}-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v5 + + - name: Bundle + if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} + run: | + xmake bundle -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Upload zenserver-win64 + if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} + uses: actions/upload-artifact@v3 + with: + name: zenserver-win64 + path: build/zenserver-win64.zip + + - name: Config + run: | + xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Build & Test + run: | + xmake test -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + linux-build: + needs: cancel-old-build + name: Build & Test Linux + runs-on: [self-hosted, linux, x64] + timeout-minutes: 10 + strategy: + matrix: + config: + - 'debug' + - 'release' + arch: + - 'x86_64' + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up GCC 11 + uses: egor-tensin/setup-gcc@v1 + with: + version: 11 + platform: x64 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: 2.6.4 + + - name: Installing vcpkg + run: | + git clone -b ${{env.VCPKG_VERSION}} --single-branch https://github.com/Microsoft/vcpkg.git .vcpkg + cd .vcpkg + ./bootstrap-vcpkg.sh + cd .. + + - name: Cache vcpkg + uses: actions/cache@v2 + with: + path: | + ${{ github.workspace }}/.vcpkg/installed + key: ${{ runner.os }}-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v5 + + - name: Bundle + if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} + run: | + xmake bundle -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Upload zenserver-linux + if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} + uses: actions/upload-artifact@v3 + with: + name: zenserver-linux + path: build/zenserver-linux.zip + + - name: Config + run: | + xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Build & Test + run: | + xmake test -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg |