{{tag>igde ci}}
[[:start|Start Page]] >> [[:gamedev|Game Development with the Drag[en]gine]] >> **Game CI (Continuous Integration)**
====== Game CI (Continuous Integration) ======
{{ :gamedev:gameci.png?direct |Game CI (Continuous Integration)}}
The IGDE can be used to build distribution files (*.delga) from the console. This especially allows to easily create distribution files using existing free continuous integration solutions without needing costly services nor being complicated at all.
In the IGDE each editor module can provide command line interactions. To learn about them open a console, change directory to your project directory then enter:
deigde --help
whereas "" is the relative or absolute path to the project file (*.degp). This will list all command line interactions provided by all editors supporting them. Commands are formed like this: ".", whereas "" can be any string including more dots.
Most important are actions by "project" which is the [[gamedev:deigde:editors:project|Project Editor/Runner]] you usually use to build distribution files. To build a distribution file run this command in the console:
deigde --project.profile.distribute
This will build the distribution file for the profile named "". The distribution file will be written to the file stored in the profile.
If you use file name versioning it is recommended to use an unversioned file name here, for example "MyGame.delga" and renaming the distribution file using your CI system of choice afterwards, for example to "MyGame-2.5.delga". This makes it easier to write CI scripts since the filename is well known.
====== CI/Build Server ======
While you can use the regular IGDE to run commands from the console on your developer machine on a CI/Build servers without UI (like docker images) this is not going to work. For CI/Build servers a special IGDE build exists which runs on UI-less systems. Download and install these two files:
* [[https://github.com/LordOfDragons/dragengine/releases/download/nightly/install-dragengine-ci-nightly-linux64.sh|install-dragengine-ci-latest.sh]]
* [[https://github.com/LordOfDragons/dragengine/releases/download/nightly/install-deigde-ci-nightly-linux64.sh|install-deigde-ci-latest.sh]]
This downloads the latest nightly build. You can also use regular release versions from [[https://github.com/LordOfDragons/dragengine/releases|Drag[en]gine Releases]]. The files are named install-dragengine-ci-{version}.sh and install-deigde-ci-{version}.sh.
Except from being UI-less it behaves the same for console use as the regular IGDE.
The sections below show some examples on how to use this in CI-Systems.
===== Docker =====
{{ :gamedev:docker.png?direct |Docker Logo}}
A docker image is ready made to be used: [[https://hub.docker.com/repository/docker/lordofdragons/deigde-ci|Docker Image DEIGDE-CI]]. The ready made docker image contains the most recent stable release.
To run the docker image use a command line like this:
docker run -it --rm --volume=/home/user/deprojects/MyGame:/project lordofdragons/deigde-ci /project/MyGame.degp --project.profile.distribute Release
The *.delga file is then located in the path /home/user/deprojects/MyGame/{path-delga} whereas {path-delga} is the path set in the profile Release.
==== Custom Docker Image ====
If you want to integrate the IGDE-CI directly into your docker build image you can do this with the following run commands:
ENV DE_RELEASE_VERSION=1.13
ENV BASE_URL_DE_RELEASE=https://github.com/LordOfDragons/dragengine/releases/download/v$DE_RELEASE_VERSION
RUN curl -sL -o install-dragengine-ci.sh $BASE_URL_DE_RELEASE/install-dragengine-ci-$DE_RELEASE_VERSION-linux64.sh \
&& curl -sL -o install-deigde-ci.sh $BASE_URL_DE_RELEASE/install-deigde-ci-$DE_RELEASE_VERSION-linux64.sh \
&& chmod 755 install-dragengine-ci.sh install-deigde-ci.sh \
&& ./install-dragengine-ci.sh --yes \
&& ./install-deigde-ci.sh --yes \
&& rm install-dragengine-ci.sh install-deigde-ci.sh
Adjust DE_RELEASE_VERSION to the Drag[en]gine release version to use. This script requires "curl", "tar" and "bzip2" to be present otherwise it fails.
===== GitHub Actions =====
{{ :gamedev:githubactions.png?direct |Github Actions Logo}}
For GitHub Actions a ready made action is provided: [[https://github.com/marketplace/actions/build-delga|Build DELGA distribution docker action]]. This action allows to run the distribute command. To use the action checkout the game project from your repository then include this code in your build script:
- name: Distribute
id: distribute
uses: LordOfDragons/build-delga@v1
with:
projectFile: 'MyGame.degp'
profile: 'Release'
A full example could look like this:
name: Distribute
on:
workflow_dispatch:
jobs:
distribute:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Distribute
id: distribute
uses: LordOfDragons/build-delga@v1
with:
projectFile: 'MyGame.degp'
profile: 'Release'
The upcoming build scripts can then use the distribution file with the path distribute/MyGame.delga given this is the path stored in the profile Release.
==== Custom Actions Script ====
If you do not want to use the provided action, for example to use commands beyond building the distribution file, you can either use the docker image from the previous section or you can install the IGDE-CI into the running VM instance like this:
- name: Install IGDE-CI
run: |
DE_RELEASE_VERSION=1.13
BASE_URL_DE_RELEASE=https://github.com/LordOfDragons/dragengine/releases/download/v$DE_RELEASE_VERSION
curl -sL -o install-dragengine-ci.sh $BASE_URL_DE_RELEASE/install-dragengine-ci-$DE_RELEASE_VERSION-linux64.sh
curl -sL -o install-deigde-ci.sh $BASE_URL_DE_RELEASE/install-deigde-ci-$DE_RELEASE_VERSION-linux64.sh
chmod 755 install-dragengine-ci.sh install-deigde-ci.sh
sudo ./install-dragengine-ci.sh --yes
sudo ./install-deigde-ci.sh --yes
rm install-dragengine-ci.sh install-deigde-ci.sh
Then you can use deigde command directly.
===== Jenkins =====
{{ :gamedev:jenkins.png?direct |}}
For Jenkins it is recommended to use the docker image mentioned above. You can also install the IGDE-CI directly into your build system as outline in the previous section. It is though easier to use the ready made docker image.