From b7ca47699c204381e8c41d4f3d2cfb9122dc5f61 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 7 Nov 2021 09:23:06 +0100 Subject: [PATCH 1/6] Add build scripts --- .github/workflows/build.yml | 119 ++++++++++++++++++++++++ .github/workflows/draft-new-release.yml | 48 ++++++++++ .github/workflows/release.yml | 83 +++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/draft-new-release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..88f0aa8c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,119 @@ +name: Build + +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + types: [opened, synchronize, reopened] + +jobs: + build: + name: Build binaries + runs-on: windows-latest + strategy: + matrix: + configuration: + - Debug + - Release + steps: + - name: Wait for previous workflows + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: softprops/turnstyle@v1 + with: + poll-interval-seconds: 10 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check out files + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + # NOTE - If LFS ever starts getting used during builds, switch this to true! + lfs: false + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Generate project files + #run: tools/premake5 vs2019 --ci-build + run: tools/premake5 vs2019 --ac-disable + + - name: Set up problem matching + uses: ammaraskar/msvc-problem-matcher@master + + - name: Build ${{matrix.configuration}} binaries + run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} build/iw4x.sln + + - name: Upload ${{matrix.configuration}} binaries + uses: actions/upload-artifact@v2 + with: + name: ${{matrix.configuration}} binaries + path: | + build/bin/x64/${{matrix.configuration}}/iw4x.dll + build/bin/x64/${{matrix.configuration}}/iw4x.pdb + +# - name: Upload ${{matrix.configuration}} data artifacts +# uses: actions/upload-artifact@v2 +# with: +# name: ${{matrix.configuration}} data artifacts +# path: | +# data/* + + + deploy: + name: Deploy artifacts + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') + steps: + - name: Setup main environment + if: github.ref == 'refs/heads/master' + run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH }}" >> $GITHUB_ENV + + - name: Setup develop environment + if: github.ref == 'refs/heads/develop' + run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH_DEV }}" >> $GITHUB_ENV + + - name: Download Release binaries + uses: actions/download-artifact@v2 + with: + name: Release binaries + + - name: Download Release data artifacts + uses: actions/download-artifact@v2 + with: + name: Release data artifacts + path: data + + # Set up committer info and GPG key + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.XLABS_MASTER_SSH_PRIVATE_KEY }} + known_hosts: 'just-a-placeholder-so-we-dont-get-errors' + + - name: Add known hosts + run: ssh-keyscan -H ${{ secrets.XLABS_MASTER_SSH_ADDRESS }} >> ~/.ssh/known_hosts + + - name: Wait for previous workflows + uses: softprops/turnstyle@v1 + with: + poll-interval-seconds: 10 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# - name: Remove old data files +# run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} rm -rf ${{ env.XLABS_MASTER_PATH }}/iw4x/data/* + + - name: Upload iw4x binary + run: rsync -avz iw4x.dll ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw4x/ + +# - name: Upload data files +# run: rsync -avz ./data/ ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw4x/data/ + + - name: Publish changes + run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }} \ No newline at end of file diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml new file mode 100644 index 00000000..35f0f8cc --- /dev/null +++ b/.github/workflows/draft-new-release.yml @@ -0,0 +1,48 @@ +name: "Draft new release" + +on: + workflow_dispatch: + inputs: + version: + description: "The version you want to release." + required: true + +jobs: + draft-new-release: + name: "Draft a new release" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Normalize version + id: normalize_version + run: | + version="${{ github.event.inputs.version }}" + version="v${version#v}" + echo "::set-output name=version::$version" + + # Set up committer info and GPG key + - name: Import GPG key + id: import_gpg + uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516 + with: + git-commit-gpgsign: true + git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}" + git-committer-name: "${{ secrets.XLABS_CI_NAME }}" + # git-push-gpgsign: true + git-tag-gpgsign: true + git-user-signingkey: true + gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }} + + - name: Create Pull Request + uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} + source_branch: "develop" + destination_branch: "master" + pr_allow_empty: true + pr_body: | + This Pull Request is for the release of IW4x ${{ steps.normalize_version.outputs.version }} and was [automatically created by a workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) triggered by @${{ github.actor }}. + pr_title: Release ${{ steps.normalize_version.outputs.version }} + pr_label: release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..70fbf24c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Release + +on: + pull_request: + branches: + - "master" + types: [closed] +jobs: + merge: + runs-on: ubuntu-latest + name: Merge Release + steps: + - name: Check out files + if: github.event.pull_request.merged + uses: actions/checkout@v2 + with: + submodules: false + lfs: false + + # Set up committer info and GPG key + - name: Import GPG key + if: github.event.pull_request.merged + id: import_gpg + uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516 + with: + git-commit-gpgsign: true + git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}" + git-committer-name: "${{ secrets.XLABS_CI_NAME }}" + git-push-gpgsign: false + git-tag-gpgsign: true + git-user-signingkey: true + gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }} + + - name: Extract version from pull request + if: github.event.pull_request.merged + id: extract_version + run: | + title="${{ github.event.pull_request.title }}" + version="${title#Release }" + echo "::set-output name=version::$version" + + - name: Create annotated tag + if: github.event.pull_request.merged + run: | + git tag -a -m "${{ github.event.pull_request.title }}" \ + "${{ steps.extract_version.outputs.version }}" \ + "${{ github.event.pull_request.merge_commit_sha }}" + git push origin --tags + + - name: Create Pull Request + if: github.event.pull_request.merged + uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} + source_branch: "master" + destination_branch: "develop" + pr_allow_empty: true + pr_body: | + This Pull Request merges the release of IW4x ${{ steps.extract_version.outputs.version }} and was [automatically created by a workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) triggered by @${{ github.actor }}. + pr_title: Merge release ${{ steps.extract_version.outputs.version }} + pr_label: release + + + notify: + name: Notify Discord + runs-on: ubuntu-latest + if: | + github.repository_owner == 'XLabsProject' && ( + ( + github.event.pull_request.merged + ) || ( + github.event.push.ref == 'refs/heads/master' || + github.event.push.ref == 'refs/heads/develop' + ) + ) + steps: + - name: Post CI status notification to Discord + uses: sarisia/actions-status-discord@v1.7.1 + if: always() + with: + webhook: ${{ secrets.DISCORD_CI_BOT_WEBHOOK }} + title: "Build" From 93443050dd7bbce7e858cbe429a7ddfe147cbdd6 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 7 Nov 2021 09:27:01 +0100 Subject: [PATCH 2/6] Disable warning --- src/Components/Modules/Maps.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 012b1d41..97ec8f61 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -752,6 +752,7 @@ namespace Components int16 Maps::CM_TriggerModelBounds(int modelPointer, Game::Bounds* bounds) { #ifdef DEBUG Game::MapEnts* ents = *reinterpret_cast(0x1AA651C); // Use me for debugging + (void)ents; #endif return Utils::Hook::Call(0x4416C0)(modelPointer, bounds); } From 3fe218b22a2b214e566fb6f93a5b042de983e462 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 7 Nov 2021 09:28:04 +0100 Subject: [PATCH 3/6] Add data files later --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88f0aa8c..e08f2dc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,11 +83,11 @@ jobs: with: name: Release binaries - - name: Download Release data artifacts - uses: actions/download-artifact@v2 - with: - name: Release data artifacts - path: data +# - name: Download Release data artifacts +# uses: actions/download-artifact@v2 +# with: +# name: Release data artifacts +# path: data # Set up committer info and GPG key - name: Install SSH key From e1ad2e1c29688e2638db557373a76e9e9248b1c3 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 7 Nov 2021 09:32:32 +0100 Subject: [PATCH 4/6] Fix artifact uploading --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e08f2dc7..e962961e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,8 +53,8 @@ jobs: with: name: ${{matrix.configuration}} binaries path: | - build/bin/x64/${{matrix.configuration}}/iw4x.dll - build/bin/x64/${{matrix.configuration}}/iw4x.pdb + build/bin/${{matrix.configuration}}/iw4x.dll + build/bin/${{matrix.configuration}}/iw4x.pdb # - name: Upload ${{matrix.configuration}} data artifacts # uses: actions/upload-artifact@v2 From 5ce4457aa6585a90ecf7f5f691a8f54999bb022e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Nov 2021 08:41:01 +0000 Subject: [PATCH 5/6] Bump deps/pdcurses from `4bc97e2` to `2e15c90` Bumps [deps/pdcurses](https://github.com/wmcbrine/PDCurses) from `4bc97e2` to `2e15c90`. - [Release notes](https://github.com/wmcbrine/PDCurses/releases) - [Commits](https://github.com/wmcbrine/PDCurses/compare/4bc97e287be5d8927405614c193fd0a039df027a...2e15c90f122fef329b83a4c3c011f192d97ec516) --- updated-dependencies: - dependency-name: deps/pdcurses dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- deps/pdcurses | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/pdcurses b/deps/pdcurses index 4bc97e28..2e15c90f 160000 --- a/deps/pdcurses +++ b/deps/pdcurses @@ -1 +1 @@ -Subproject commit 4bc97e287be5d8927405614c193fd0a039df027a +Subproject commit 2e15c90f122fef329b83a4c3c011f192d97ec516 From b0e702f33c888f866d5e0869397cd6918caca222 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 7 Nov 2021 09:50:36 +0100 Subject: [PATCH 6/6] Update README.md --- README.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/README.md b/README.md index fe82b30b..f04e11dc 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,13 @@ ![forks](https://img.shields.io/github/forks/IW4x/iw4x-client.svg) ![stars](https://img.shields.io/github/stars/IW4x/iw4x-client.svg) ![issues](https://img.shields.io/github/issues/IW4x/iw4x-client.svg) +[![build](https://github.com/XLabsProject/iw4x-client/workflows/Build/badge.svg)](https://github.com/XLabsProject/iw4x-client/actions) [![build status](https://ci.appveyor.com/api/projects/status/rvljq0ooxen0oexm/branch/develop?svg=true)](https://ci.appveyor.com/project/iw4x/iw4x-client/branch/develop) [![discord](https://img.shields.io/endpoint?url=https://momo5502.com/iw4x/members-badge.php)](https://discord.gg/sKeVmR3) [![patreon](https://img.shields.io/badge/patreon-support-blue.svg?logo=patreon)](https://www.patreon.com/xlabsproject) # IW4x: Client -## Commit message style - -``` -[Module] Imperative summary - -- points or text - -[ci skip] -``` - -`[ci skip]` is optional. - ## How to compile - Run `premake5 vs2019` or use the delivered `generate.bat`.