name: Validate on: pull_request: types: [opened, reopened, synchronize] branches: [ main ] paths-ignore: - 'VERSION.txt' - 'CHANGELOG.md' push: branches: [ main ] paths-ignore: - 'VERSION.txt' - 'CHANGELOG.md' - '.github/workflows/create_release.yml' 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/cancel-workflow-action@0.11.0 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@v3 - name: clang-format uses: jidicula/clang-format-action@v4.9.0 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: 15 strategy: matrix: config: - 'debug' - 'release' arch: - 'x64' env: VCPKG_VERSION: 2022.08.15 steps: - name: Checkout uses: actions/checkout@v3 - name: Setup xmake uses: xmake-io/github-action-setup-xmake@v1 with: xmake-version: 2.6.4 - name: Installing vcpkg run: | # Remove-Item -Recurse .vcpkg 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 }}-validate-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v1 - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Build & Test if: ${{ matrix.config == 'debug' }} run: | xmake test -v -y env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Bundle if: ${{ 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 linux-build: needs: cancel-old-build name: Build & Test Linux runs-on: [self-hosted, linux, x64] timeout-minutes: 15 strategy: matrix: config: - 'debug' - 'release' arch: - 'x86_64' env: VCPKG_VERSION: 2022.08.15 steps: - name: Checkout uses: actions/checkout@v3 - 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: | # rm -rf .vcpkg 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 }}-validate-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v1 - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Build & Test if: ${{ matrix.config == 'debug' }} run: | xmake test -v -y env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Bundle if: ${{ 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 macos-build: needs: cancel-old-build name: Build & Test MacOS runs-on: [self-hosted, macos, x64] timeout-minutes: 15 strategy: matrix: config: - 'debug' - 'release' arch: - 'x86_64' env: VCPKG_VERSION: 2022.08.15 steps: - name: Checkout uses: actions/checkout@v3 - name: Setup xmake uses: xmake-io/github-action-setup-xmake@v1 with: xmake-version: 2.6.4 - name: Installing vcpkg run: | # rm -rf .vcpkg 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 }}-validate-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v1 - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Build & Test if: ${{ matrix.config == 'debug' }} run: | xmake test -v -y env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Bundle if: ${{ matrix.config == 'release' }} run: | xmake bundle -v -y env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Upload zenserver-macos if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} uses: actions/upload-artifact@v3 with: name: zenserver-macos path: build/zenserver-macos.zip