Skip to content

Commit

Permalink
Port the CI/CD for the game-client to the FOSS repository
Browse files Browse the repository at this point in the history
Main focus on this PR is to ensure we can deploy the game, run it and test it in PRs.

Why?
- We want to get a new stable release out ASAP.
- We need to run our unit tests on the app.
- We would like to have a client build per change to the app or engine side for testing in PRs.
- It will let a dev try out changes in PRs easily.
- We had to refactor to use the mono repository as swapping was non trivial due to structure changes.
- Engine binary is properly locked to the submodule commit version - meaning we can update the engine in the repo, and try it out before we make it live.

Changes:
- Updated GUT.
- Refactored the way we ingest engine builds since we don't want to make many edits to the godot fork with our CICD.
- We now build engine binaries for each client version if there is an engine change in the source code or if the app code changes.
- We pull our engine binary from GH artefacts but they won't be expired on us during the build process so this prevents issues with GH retention or hitting size constraints.
- We can run our unit tests again, with an asterisk, that some had to be disabled due to missing assets that we didn't have a public redistribution license for, this can be re-enabled once tests fixed.
- We will use this layout for deployment as it should be more efficient.
-Swapped to GH composite actions so we can execute another workflow file and ensure the engine build is in a good state before starting the builds.
- Fixed various double zipping bugs.
-Renamed client binary to windows-client, macos-client, and linux-client.
  • Loading branch information
RevoluPowered committed Apr 8, 2024
1 parent c24b552 commit 534d4df
Show file tree
Hide file tree
Showing 31 changed files with 585 additions and 711 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: 📈 Bump Version
name: 📈 Bump Version (mirror-godot-app)

on:
push:
branches:
- 'dev'
- 'dev'
paths:
- mirror-godot-app/**

jobs:
bump-version:
Expand All @@ -28,7 +30,8 @@ jobs:
# # defaults to a patch bump.
rc-wording: 'rc'
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN_GITHUB }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: ./mirror-godot-app

- name: cat package.json
run: cat ./package.json
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/bump-version-mirror-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 📈 Bump Version (mirror-web-server)

on:
push:
branches:
- 'dev'
paths:
- mirror-web-server/**

jobs:
bump-version:
name: 'Upgrade version'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: 'cat package.json'
run: cat ./package.json

- name: Automated Version Bump
id: version_bump
uses: 'phips28/gh-action-bump-version@master'
with:
tag-prefix: 'v'
major-wording: 'release-major'
minor-wording: 'release-minor'
# # defaults to a patch bump.
rc-wording: 'rc'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: ./mirror-web-server

- name: cat package.json
run: cat ./package.json

- name: Output Step
env:
NEW_TAG: ${{ steps.version_bump.outputs.newTag }}
run: echo "new tag $NEW_TAG"
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,35 @@ env:
defaults:
run:
shell: bash
# working-directory: ./mirror-godot-app


# what branch this file will deploy using
jobs:
client-build-tool:
name: Build
runs-on: ["self-hosted", "${{ inputs.os }}"]
timeout-minutes: 45
runs-on: ${{ inputs.os }}
timeout-minutes: 65
outputs:
url: ${{ steps.output-url.outputs.url }}
file-name: ${{ steps.output-file-name.outputs.file-name }}
version: ${{ steps.output-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
# we'll be cloning the mirror-godot-app folder directly into the builder root so that we don't need to modify paths
sparse-checkout: mirror-godot-app
sparse-checkout-cone-mode: false

- name: Installing coreutils (for gtimeout)
if: ${{ inputs.should-install-timeout-macos }}
run: brew install coreutils

- name: Fix working directory
run: |
ls -lah
shopt -s dotglob # includes all hidden files
mv mirror-godot-app/* .
ls -lah
- name: Use custom project file (required for custom splash screen)
if: ${{ inputs.custom-project-file }}
run: |
Expand All @@ -153,10 +163,8 @@ jobs:
with:
github_token: ${{ secrets.cicd-token-github }}
workflow: ${{ inputs.editor-binary-workflow }}
workflow_conclusion: success
workflow_conclusion: "in_progress"
name: ${{ inputs.editor-binary-download }}
branch: ${{ inputs.editor-binary-branch }}
repo: the-mirror-megaverse/godot-soft-fork

- name: Unzip editor binary
if: ${{ inputs.should-unzip-editor }}
Expand All @@ -168,10 +176,8 @@ jobs:
with:
github_token: ${{ secrets.cicd-token-github }}
workflow: ${{ inputs.template-binary-workflow }}
workflow_conclusion: success
workflow_conclusion: "in_progress" # must be in_progress otherwise we can't find them for our current job
name: ${{ inputs.template-binary-name }}
branch: ${{ inputs.template-binary-branch }}
repo: the-mirror-megaverse/godot-soft-fork

- name: Set up template in system-wide editor data
run: |
Expand All @@ -181,6 +187,7 @@ jobs:
- name: Copy environment configuration to override.cfg
run: |
ls -R .
rm -Rf override.cfg
cp ./addons/mirror_internal/env_configs/${{ inputs.game-environment-cfg-name }}.cfg override.cfg
# must be removed before booting the app otherwise we overwrite the override.cfg
Expand Down Expand Up @@ -235,12 +242,26 @@ jobs:
echo "app_ver=${ver}" >> $GITHUB_ENV
echo "app_platform=${platform}" >> $GITHUB_ENV
- name: Zip for client download (Mac and Linux)
if: ${{ inputs.should-deploy }}
- uses: msys2/setup-msys2@v2
if: ${{ inputs.os == 'windows-latest' }}
with:
update: true
install: >-
zip
- name: Zip for client download
if: ${{ inputs.os != 'windows-latest' }}
run: |
cd build/
ls ./
zip -r ${{env.app_platform}}.zip "${{ inputs.game-binary-name }}" *.pck
- name: Zip for client download
if: ${{ inputs.os == 'windows-latest' }}
shell: msys2 {0}
run: |
cd build/
ls ./
# make sure you have 7z installed with zip on windows.
zip -r ${{env.app_platform}}.zip "${{ inputs.game-binary-name }}" *.pck
- name: Google Cloud Platform authentication
Expand Down Expand Up @@ -283,21 +304,23 @@ jobs:
with:
path: build/${{ inputs.game-binary-name }}
destination: ${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/

- id: output-url
run: |
echo "url=${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/${{ env.app_platform }}${{ inputs.platform-file-extension }}" >> $GITHUB_OUTPUT
- id: output-file-name
run: |
echo "file-name=${{ env.app_platform }}${{ inputs.platform-file-extension }}" >> $GITHUB_OUTPUT
- id: output-version
run: |
echo "version=${{ env.app_ver }}" >> $GITHUB_OUTPUT
- name: Notify slack fail
if: ${{ failure() && inputs.should-notify-on-failure }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
channel: eng-important-system-alerts
status: FAILED
color: danger
path: |
build/${{ inputs.game-binary-name }}
build/*.pck
name: ${{ env.app_platform }}-client
Loading

0 comments on commit 534d4df

Please sign in to comment.