# Native extensions + CI builds

**URL:** <https://forum.defold.com/t/native-extensions-ci-builds/67093>\
**Category:** The Defoldmine\
**Created:** [December 24, 2020, 12:09pm UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093 "2020-12-24T12:09:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [December 24, 2020, 12:09pm UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093/1 "2020-12-24T12:09:54Z")

</div>

Hello everyone!

I’ve just now added a first CI (continuous integration, a.k.a “autobuilder”) script to one of our extensions, `extension-websocket`. Having such a script makes it easier for us to verify that the extension builds properly for each platform after each commit we make to the repository. It also helps us make sure that the extension builds between Defold versions. The plan is to add such a script to all our supported extensions.

The script currently does these things:

- Find the stable version of Defold
- Download bob.jar
- Resolve dependencies
- Build the extension (i.e. the sample project)
- Bundle the example project

This script is triggered on each push/pull request, but it’s also scheduled to build twice a month, to make sure the code doesn’t grow old between released Defold versions.

# How to add the script to my native extension

The script is written to be very low maintenance, and could be used as-is.

Copy the [bob.yml](https://github.com/defold/extension-websocket/blob/master/.github/workflows/bob.yml) file into your repository, to `.github/workflows/bob.yml`, commit the file and push to your repository.

You can see the builds under the “Actions” tab in the github repo: [example](https://github.com/defold/extension-websocket/actions/runs/442193249)

Note, if you copy this script, it might be good if you change the cron job to some different time or date, as to not crowd the build server all at once 🙂

# How to write a Github CI script

You write a script (in Yaml) for [Github Actions](https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions), which might look [like this](https://github.com/defold/extension-websocket/blob/master/.github/workflows/bob.yml).

I hope this can give you a hint on how to start testing your own extensions and/or your games hosted on Github.

If you’re not using Github there are usually similar functionalities there.

---

<div class="post-metadata">

**Author:** ![dapetcu21](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dapetcu21/32/25120_2.png) [@dapetcu21](https://forum.defold.com/u/dapetcu21)\
**Post date:** [December 26, 2020, 10:40am UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093/2 "2020-12-26T10:40:39Z")

</div>

Awesome!

This seems like a great place to plug my [setup-defold](https://github.com/dapetcu21/setup-defold) Github Action which automatically downloads bob.jar and dmengine\_headless in CI scripts 😀

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [July 14, 2021, 6:40am UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093/3 "2021-07-14T06:40:33Z")

</div>

I’m adding it for all my libraries now. Thank you!

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [July 14, 2021, 6:43am UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093/4 "2021-07-14T06:43:44Z")

</div>

For the next repo, I’d also try out the github action that @dapetcu21 wrote.  
Hopefully it will remove some more boiler plate.

---

<div class="post-metadata">

**Author:** ![Lex](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/lex/32/23856_2.png) [@Lex](https://forum.defold.com/u/Lex)\
**Post date:** [July 16, 2021, 12:18pm UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093/5 "2021-07-16T12:18:32Z")

</div>

Thanks for sharing this script.

When I try to use it, I get the following error

```
armv7a-linux-androideabi16-clang++ -c -O2 -g -gdwarf-2 -fpic -ffunction-sections -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fomit-frame-pointer -fno-strict-aliasing -funwind-tables -isysroot=/opt/platformsdk/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DANDROID -Wa,--noexecstack -DDLIB_LOG_DOMAIN="FIREBASEREMOTECONFIG" -DDM_PLATFORM_ANDROID -DDDF_EXPOSE_DESCRIPTORS -DLUA_BYTECODE_ENABLE_32 -D __ARM_ARCH_5__ -D __ARM_ARCH_5T__ -D __ARM_ARCH_5E__ -D __ARM_ARCH_5TE__ -DDM_RELEASE -fno-exceptions -fvisibility=hidden -std=c++11 -Iupload/defold/firebase_remoteconfig/include -Ibuild/firebase_remoteconfig/ -Iupload/ -Iupload/defold/ironsource/include -I/var/extender/sdk/1f5712609c345f870b691a85d611d4825d22a718/defoldsdk//include -I/var/extender/sdk/1f5712609c345f870b691a85d611d4825d22a718/defoldsdk//sdk/include -I/var/extender/sdk/1f5712609c345f870b691a85d611d4825d22a718/defoldsdk//ext/include -I/opt/platformsdk/android/android-ndk-r20/sources/android/native_app_glue -I/opt/platformsdk/android/android-ndk-r20/sources/android/cpufeatures upload/defold/firebase_remoteconfig/src/firebase_remoteconfig.cpp -obuild/firebase_remoteconfig.cpp_2.o
upload/defold/firebase_remoteconfig/src/firebase_remoteconfig.cpp:2:9: warning: 'DLIB_LOG_DOMAIN' macro redefined [-Wmacro-redefined]
#define DLIB_LOG_DOMAIN LIB_NAME
        ^
<command line>:2:9: note: previous definition is here
#define DLIB_LOG_DOMAIN "FIREBASEREMOTECONFIG"
        ^
upload/defold/firebase_remoteconfig/src/firebase_remoteconfig.cpp:8:10: fatal error: 'luautils.h' file not found
#include "luautils.h"
         ^ ~~~~~~~~~~~
1 warning and 1 error generated.

```

On my local machine, I can compile fine.  
The problem seems to be coming from the firebase extension, how come the build behaviour is different on the CI server than on my machine?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [July 16, 2021, 12:30pm UTC](https://forum.defold.com/t/native-extensions-ci-builds/67093/6 "2021-07-16T12:30:39Z")

</div>

There is no “luautils.h” in that extension.

Have you added the dependencies as specified in the manual?

> **[Installation - Defold Firebase Analytics documentation](https://defold.com/extension-firebase-analytics/#installation)**
>
> This extension allows you to interact with Firebase Analytics in a uniform way for games on iOS and Android. | This manual covers how to setup and use Firebase Analytics in Defold.
