From 4e49729773de7b86ff780f689298b1c31313b847 Mon Sep 17 00:00:00 2001 From: Gordon MacPherson Date: Thu, 18 Apr 2024 20:53:39 +0100 Subject: [PATCH 1/2] CI/CD - Add self hosted support Added: - vscode files so we can work on any machine with ease. - add self hosted optional runners --- .github/workflows/bump-version.yml | 2 +- .github/workflows/client-build-tool.yml | 2 +- .github/workflows/deployment-pr.yml | 6 +++--- .github/workflows/deployment.yml | 7 ++++--- .github/workflows/engine.yml | 9 ++++++--- .vscode/extensions.json | 13 +++++++++++++ .vscode/settings.json | 19 +++++++++++++++++++ 7 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index fc30f815..82e8f327 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest environment: dev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.GH_SECRET_WRITE_TOKEN }} diff --git a/.github/workflows/client-build-tool.yml b/.github/workflows/client-build-tool.yml index 0e31f31a..5d7a9fc1 100644 --- a/.github/workflows/client-build-tool.yml +++ b/.github/workflows/client-build-tool.yml @@ -111,7 +111,7 @@ on: value: ${{ jobs.client-build-tool.outputs.version }} secrets: gcp-secret: - required: false + required: true cicd-token-github: required: true ITCH_IO_CICD: diff --git a/.github/workflows/deployment-pr.yml b/.github/workflows/deployment-pr.yml index 4e57738f..4d5777de 100644 --- a/.github/workflows/deployment-pr.yml +++ b/.github/workflows/deployment-pr.yml @@ -36,7 +36,7 @@ jobs: game-export-preset: Windows game-binary-name: The Mirror Dev.exe bucket-name: no-bucket - os: "windows-latest" + os: ${{ github.event.repository.name != 'the-mirror' && fromJSON('[ "self-hosted", "Windows"]') || 'windows-latest' }} # TODO: This will be dynamic in future and we can't do that immediately as we have to focus on the deployment side. editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/4309e8e8/MirrorGodotEditorWindows.exe template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/4309e8e8/windows_release_x86_64.exe @@ -65,7 +65,7 @@ jobs: game-export-preset: MacOS-themirror-dev game-binary-name: The Mirror Dev.app bucket-name: no-bucket - os: "macos-latest" + os: ${{ github.event.repository.name != 'the-mirror' && fromJSON('[ "self-hosted", "MacOS"]') || 'macos-latest' }} # TODO: This will be dynamic in future and we can't do that immediately as we have to focus on the deployment side. editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/4309e8e8/MirrorGodotEditorMac.app.zip template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/4309e8e8/macos_template.app.zip @@ -92,7 +92,7 @@ jobs: game-export-preset: Linux game-binary-name: The Mirror Dev.x86_64 bucket-name: no-bucket - os: "ubuntu-20.04" + os: ${{ github.event.repository.name != 'the-mirror' && fromJSON('[ "self-hosted", "Linux"]') || 'ubuntu-20.04' }} # TODO: This will be dynamic in future and we can't do that immediately as we have to focus on the deployment side. editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/4309e8e8/MirrorGodotEditorLinux.x86_64 template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/4309e8e8/linux_release.x86_64 \ No newline at end of file diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index d94603a2..36402712 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -18,6 +18,7 @@ jobs: GCP_BUCKET_UPLOAD: ${{ secrets.GCP_BUCKET_UPLOAD }} with: environment: "dev" + self-hosted-runner: ${{ github.event.repository.name != 'the-mirror' }} build-windows-client: name: 🏁 Build Windows Dev PR @@ -43,7 +44,7 @@ jobs: game-export-preset: Windows game-binary-name: The Mirror Dev.exe bucket-name: no-bucket - os: "windows-latest" + os: ${{ github.event.repository.name != 'the-mirror' && fromJSON('[ "self-hosted", "Windows"]') || 'windows-latest' }} editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/MirrorGodotEditorWindows.exe template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/windows_release_x86_64.exe build-macos-client: @@ -72,7 +73,7 @@ jobs: game-export-preset: MacOS-themirror-dev game-binary-name: The Mirror Dev.app bucket-name: no-bucket - os: "macos-latest" + os: ${{ github.event.repository.name != 'the-mirror' && fromJSON('[ "self-hosted", "MacOS"]') || 'macos-latest' }} editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/MirrorGodotEditorMac.app.zip template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/macos_template.app.zip build-linux-client: @@ -99,6 +100,6 @@ jobs: game-export-preset: Linux game-binary-name: The Mirror Dev.x86_64 bucket-name: no-bucket - os: "ubuntu-20.04" + os: ${{ github.event.repository.name != 'the-mirror' && fromJSON('[ "self-hosted", "Linux"]') || 'ubuntu-20.04' }} editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/MirrorGodotEditorLinux.x86_64 template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/linux_release.x86_64 \ No newline at end of file diff --git a/.github/workflows/engine.yml b/.github/workflows/engine.yml index e96905bd..f3c006fd 100644 --- a/.github/workflows/engine.yml +++ b/.github/workflows/engine.yml @@ -5,6 +5,9 @@ on: environment: required: true type: string + self-hosted-runner: + required: true + type: boolean secrets: GCP_BUCKET_UPLOAD: required: true @@ -33,7 +36,7 @@ concurrency: jobs: build-windows: - runs-on: "windows-latest" + runs-on: ${{ inputs.self-hosted-runner && fromJSON('[ "self-hosted", "Windows"]') || 'windows-latest' }} name: ${{ matrix.name }} environment: ${{ inputs.environment }} strategy: @@ -134,7 +137,7 @@ jobs: path: ./godot-engine/bin/${{ matrix.artifact-name }}.exe destination: ${{ matrix.bucket-name }}/${{steps.vars.outputs.sha_short}}/ build-macos: - runs-on: "macos-latest" + runs-on: ${{ inputs.self-hosted-runner && fromJSON('[ "self-hosted", "MacOS"]') || 'macos-latest' }} name: ${{ matrix.name }} environment: ${{ inputs.environment }} strategy: @@ -275,7 +278,7 @@ jobs: path: ./godot-engine/bin/${{ matrix.artifact-name }}.zip destination: ${{ matrix.bucket-name }}/${{steps.vars.outputs.sha_short}}/ build-linux: - runs-on: "ubuntu-20.04" # MUST run on the old version for GLIBC compatibility + runs-on: ${{ inputs.self-hosted-runner && fromJSON('[ "self-hosted", "Linux"]') || 'ubuntu-20.04' }} name: ${{ matrix.name }} environment: ${{ inputs.environment }} strategy: diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..aeed37c1 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + "recommendations": [ + "streetsidesoftware.code-spell-checker", + "ms-vscode.cpptools", + "ms-vscode.cpptools-themes", + "ms-vscode.cpptools-extension-pack", + "geequlim.godot-tools", + "esbenp.prettier-vscode", + "ms-python.python", + "ms-python.debugpy", + "ms-python.vscode-pylance" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..bd10938c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + // Ensure that copy pasting in .vscode always works with YML files + // This means you can copy paste properly in VSCode with YML files. Like GitHub actions. + // It improves the situation with whitespace centric tooling. + "editor.autoIndent": "keep", + // Use the US English standard dictionary for the project. + // For cSpell + "cSpell.language": "en,en-US", + "cSpell.enableFiletypes": [ + "bat", + "dockercompose", + "dockerfile", + "gdscript", + "gdshader", + "github-actions-workflow", + "makefile", + "shellscript" + ] +} From ae2cb4a3f802654c41a3a1116a31722449558dda Mon Sep 17 00:00:00 2001 From: Gordon MacPherson Date: Thu, 18 Apr 2024 22:17:05 +0100 Subject: [PATCH 2/2] Update .vscode/settings.json Co-authored-by: Jared McCluskey --- .vscode/settings.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index bd10938c..6fbf0361 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,5 @@ { - // Ensure that copy pasting in .vscode always works with YML files - // This means you can copy paste properly in VSCode with YML files. Like GitHub actions. - // It improves the situation with whitespace centric tooling. "editor.autoIndent": "keep", - // Use the US English standard dictionary for the project. - // For cSpell "cSpell.language": "en,en-US", "cSpell.enableFiletypes": [ "bat", @@ -14,6 +9,9 @@ "gdshader", "github-actions-workflow", "makefile", + "markdown", + "typescript", + "typescriptreact", "shellscript" ] }