From 9a54702b65c4247befb0f2d1e32753cdf329235a Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Fri, 15 Apr 2022 13:47:56 -0700 Subject: Making changes to the CI/CD pipeline and adding release automation for PR merges into main. --- .github/workflows/on_prem_windows.yml | 134 ---------------------------------- .github/workflows/self_host_build.yml | 134 ++++++++++++++++++++++++++++++++++ .github/workflows/update_release.yml | 124 +++++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/on_prem_windows.yml create mode 100644 .github/workflows/self_host_build.yml create mode 100644 .github/workflows/update_release.yml (limited to '.github') diff --git a/.github/workflows/on_prem_windows.yml b/.github/workflows/on_prem_windows.yml deleted file mode 100644 index 04036c38c..000000000 --- a/.github/workflows/on_prem_windows.yml +++ /dev/null @@ -1,134 +0,0 @@ -name: Validate - -on: - push: - branches: - - main - pull_request: - branches: [ main ] - -jobs: - clang-format: - name: Check clang-format - runs-on: [self-hosted, linux, x64] - strategy: - matrix: - path: - - 'zen' - - 'zencore' - - 'zencore-test' - - 'zenhttp' - - 'zenserver-test' - - 'zenstore' - - 'zenstore-test' - - 'zentest-appstub' - - 'zenutil' - - 'zenserver' - steps: - - uses: actions/checkout@v2 - - name: clang-format ${{ matrix.path }} - uses: jidicula/clang-format-action@v4.6.2 - with: - clang-format-version: '13' - check-path: ${{ matrix.path }} - - windows-build: - name: Build Windows - runs-on: [self-hosted, windows, x64] - strategy: - matrix: - config: - - 'debug' - - 'release' - arch: - - 'x64' - env: - VCPKG_VERSION: 2022.03.10 - - steps: - - 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: 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: - name: Build Linux - runs-on: [self-hosted, linux, x64] - strategy: - matrix: - config: - - 'debug' - - 'release' - arch: - - 'x86_64' - env: - VCPKG_VERSION: 2022.03.10 - - steps: - - 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: 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 diff --git a/.github/workflows/self_host_build.yml b/.github/workflows/self_host_build.yml new file mode 100644 index 000000000..2645f9738 --- /dev/null +++ b/.github/workflows/self_host_build.yml @@ -0,0 +1,134 @@ +name: Validate Build + +on: + pull_request: + types: [opened, reopened] + branches: [ main ] + +jobs: + clang-format: + name: Check clang-format + runs-on: [self-hosted, linux, x64] + strategy: + matrix: + path: + - 'zen' + - 'zencore' + - 'zencore-test' + - 'zenhttp' + - 'zenserver-test' + - 'zenstore' + - 'zenstore-test' + - 'zentest-appstub' + - 'zenutil' + - 'zenserver' + steps: + - uses: actions/checkout@v2 + - name: clang-format ${{ matrix.path }} + uses: jidicula/clang-format-action@v4.6.2 + with: + clang-format-version: '13' + check-path: ${{ matrix.path }} + + windows-build: + name: Build Windows + needs: clang-format + runs-on: [self-hosted, windows, x64] + strategy: + matrix: + config: + - 'debug' + - 'release' + arch: + - 'x64' + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - 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: 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: + name: Build Linux + needs: clang-format + runs-on: [self-hosted, linux, x64] + strategy: + matrix: + config: + - 'debug' + - 'release' + arch: + - 'x86_64' + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - 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: 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 diff --git a/.github/workflows/update_release.yml b/.github/workflows/update_release.yml new file mode 100644 index 000000000..62568d1c0 --- /dev/null +++ b/.github/workflows/update_release.yml @@ -0,0 +1,124 @@ +name: Build release + +on: + # push + pull_request: + types: [closed] + branches: [ main ] + +jobs: + windows-build: + # if: github.event.pull_request.merged == true + name: Build Windows + runs-on: [self-hosted, windows, x64] + strategy: + matrix: + config: + - 'release' + arch: + - 'x64' + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - 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: Config + run: | + xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Build + run: | + xmake build -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + # - name: Create Archive + # run: | + # cd .\build\windows\${{ matrix.arch }}\${{ matrix.config }} + # C:\'Program Files'\7-Zip\7z.exe a -r ..\..\..\..\windows-${{ matrix.arch }}-${{ matrix.config }}.zip * + # cd ..\..\..\.. + + - name: Create Archive + run: | + cd .\build\windows\${{ matrix.arch }}\${{ matrix.config }} + C:\'Program Files'\7-Zip\7z.exe a -r ..\..\..\..\zenserver-win64.zip zenserver.exe + cd ..\..\..\.. + + - name: Get current release version info + run: | + $repo = "EpicGames/zen" + $releases = "https://api.github.com/repos/$repo/releases/latest" + Write-Host Determining latest release + $latest = (Invoke-WebRequest -Headers @{"Accept"="application/vnd.github.v3+json";"Authorization"="token ${{ secrets.GITHUB_TOKEN }}"} $releases | ConvertFrom-Json)[0] + $current_version_tag = [version]$latest.tag_name.replace('v','') + echo "Current version" $current_version_tag + $new_version_tag = [version]::New($current_version_tag.Major,$current_version_tag.Minor,$current_version_tag.Build,$current_version_tag.Revision+1).toString() + echo $new_version_tag + echo "new_version_tag=$new_version_tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ env.new_version_tag }} + release_name: Release + draft: false + prerelease: false + + # - name: Create Release + # id: create_release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.ref_name }} + # release_name: Release ${{ github.head_ref }} + # draft: false + # prerelease: false + + # - name: Upload Release Asset + # id: upload-release-asset + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + # asset_path: .\windows-${{ matrix.arch }}-${{ matrix.config }}.zip + # asset_name: windows-${{ matrix.arch }}-${{ matrix.config }} + # asset_content_type: application/zip + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .\zenserver-win64.zip + asset_name: zenserver-win64.zip + asset_content_type: application/zip + -- cgit v1.2.3