Skip to content

Commit

Permalink
Merge pull request #6 from pilksoc/ld-godot-cicd
Browse files Browse the repository at this point in the history
CICD: Added compliation and deployment for client
  • Loading branch information
ZanyLeonic authored Mar 2, 2024
2 parents f8de438 + 12081fc commit 7247116
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 17 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-game-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Build CosmicKube game client"
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
GODOT_VERSION: 4.2.1
EXPORT_NAME: CosmicKube
PROJECT_PATH: game-source

jobs:
export-web:
name: "Export for Web"
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates/
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Web Build
run: |
mkdir -v -p build/web
cd $PROJECT_PATH
godot --headless --verbose --export-release "Web" ../build/web/index.html 2>&1 | tee output.txt
echo Reading build logs...
if search="$(cat output.txt | grep 'ERROR: Project export')"
then
echo "Build failed!"
exit 1
else
echo "Build succeeded!"
exit 0
fi ;
- name: Create staticwebapp.config.json
run: |
cd build/web
echo "${{ vars.STATIC_WEB_APP_CONFIG }}" > staticwebapp.config.json
ls
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: web
path: build/web

- name: Publish to Azure Static Web Apps
id: publishto
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations ######
app_location: "build/web"
skip_app_build: true
###### End of Repository/Build Configurations ######
18 changes: 18 additions & 0 deletions .github/workflows/test-jenkinsfile.yml.noworky
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Test Jenkinsfile"
on: push

env:
GODOT_VERSION: 4.2.1
EXPORT_NAME: CosmicKube
PROJECT_PATH: game-source

jobs:
test-jenkins:
name: "Test Jenkinsfile"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: jenkinsfile-runner-prepackaged
uses: jenkinsci/jenkinsfile-runner-github-actions/jenkinsfile-runner-prepackaged@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 31 additions & 17 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
pipeline {
agent any
agent {
docker {
image 'barichello/godot-ci:4.2.1'

} }
environment {
GODOT_VERSION = '4.2.1'
EXPORT_NAME = 'CosmicKube'
PROJECT_PATH = 'game-source'
}

stages {
stage('Hello world') {
stage('Setup') {
steps {
sh 'echo pee pee'
sh '''mkdir -v -p ~/.local/share/godot/export_templates/
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
'''
}
}
stage('Web Build') {
steps {
sh '''mkdir -v -p build/web
cd $PROJECT_PATH
godot --headless --verbose --export-release "Web" ../build/web/index.html 2>&1 | tee output.txt
echo Reading build logs...
if search="$(cat output.txt | grep 'ERROR: Project export')"
then
echo "Build failed!"
exit 1
else
echo "Build succeeded!"
exit 0
fi ;'''
}
}

// stage('Push image') {
// steps {
// sh 'docker push localhost:5000/ttt'
// }
// }
//
// stage('Package') {
// steps {
// sh 'helm install ttt ttt | true'
// sh 'helm upgrade ttt ttt'
// }
// }
}
}
}
58 changes: 58 additions & 0 deletions client.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM ubuntu:jammy
LABEL author="https://github.com/aBARICHELLO/godot-ci/graphs/contributors"

USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git \
git-lfs \
unzip \
wget \
zip \
adb \
openjdk-17-jdk-headless \
rsync \
&& rm -rf /var/lib/apt/lists/*

ARG GODOT_VERSION="4.2.1"
ARG RELEASE_NAME="stable"
ARG SUBDIR=""
ARG GODOT_TEST_ARGS=""
ARG GODOT_PLATFORM="linux.x86_64"

RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_${GODOT_PLATFORM}.zip \
&& wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz \
&& mkdir ~/.cache \
&& mkdir -p ~/.config/godot \
&& mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${RELEASE_NAME} \
&& unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_${GODOT_PLATFORM}.zip \
&& mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_${GODOT_PLATFORM} /usr/local/bin/godot \
&& unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz \
&& mv templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.${RELEASE_NAME} \
&& rm -f Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz Godot_v${GODOT_VERSION}-${RELEASE_NAME}_${GODOT_PLATFORM}.zip

# Download and setup android-sdk
ENV ANDROID_HOME="/usr/lib/android-sdk"
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip \
&& unzip commandlinetools-linux-*_latest.zip -d cmdline-tools \
&& mv cmdline-tools $ANDROID_HOME/ \
&& rm -f commandlinetools-linux-*_latest.zip

ENV PATH="${ANDROID_HOME}/cmdline-tools/cmdline-tools/bin:${PATH}"

RUN yes | sdkmanager --licenses \
&& sdkmanager "platform-tools" "build-tools;33.0.2" "platforms;android-33" "cmdline-tools;latest" "cmake;3.22.1" "ndk;25.2.9519653"

# Adding android keystore and settings
RUN keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 \
&& mv debug.keystore /root/debug.keystore

RUN godot -v -e --quit --headless ${GODOT_TEST_ARGS}
RUN echo 'export/android/android_sdk_path = "/usr/lib/android-sdk"' >> ~/.config/godot/editor_settings-4.tres
RUN echo 'export/android/debug_keystore = "/root/debug.keystore"' >> ~/.config/godot/editor_settings-4.tres
RUN echo 'export/android/debug_keystore_user = "androiddebugkey"' >> ~/.config/godot/editor_settings-4.tres
RUN echo 'export/android/debug_keystore_pass = "android"' >> ~/.config/godot/editor_settings-4.tres
RUN echo 'export/android/force_system_user = false' >> ~/.config/godot/editor_settings-4.tres
RUN echo 'export/android/timestamping_authority_url = ""' >> ~/.config/godot/editor_settings-4.tres
RUN echo 'export/android/shutdown_adb_on_exit = true' >> ~/.config/godot/editor_settings-4.tres
37 changes: 37 additions & 0 deletions game-source/export_presets.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[preset.0]

name="Web"
platform="Web"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false

[preset.0.options]

custom_template/debug=""
custom_template/release=""
variant/extensions_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)
1 change: 1 addition & 0 deletions game-source/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ config/icon="res://icon.svg"

renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
Empty file added plugins.txt
Empty file.

0 comments on commit 7247116

Please sign in to comment.