2024-02-07 13:51:01 +11:00
|
|
|
local docker_base = 'registry.oxen.rocks/lokinet-ci-';
|
|
|
|
|
2024-02-07 14:54:42 +11:00
|
|
|
// Log a bunch of version information to make it easier for debugging
|
|
|
|
local version_info = {
|
|
|
|
name: 'Version Information',
|
|
|
|
image: docker_base + 'android',
|
|
|
|
commands: [
|
2024-02-07 15:04:53 +11:00
|
|
|
'cmake --version',
|
2024-02-07 15:14:56 +11:00
|
|
|
'apt --installed list'
|
2024-02-07 14:54:42 +11:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-02-07 13:19:57 +11:00
|
|
|
// Intentionally doing a depth of 2 as libSession-util has it's own submodules (and libLokinet likely will as well)
|
|
|
|
local clone_submodules = {
|
|
|
|
name: 'Clone Submodules',
|
2024-02-07 14:35:36 +11:00
|
|
|
image: 'drone/git',
|
2024-02-07 14:18:19 +11:00
|
|
|
commands: ['git fetch --tags', 'git submodule update --init --recursive --depth=2 --jobs=4']
|
2024-02-07 13:19:57 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
// cmake options for static deps mirror
|
|
|
|
local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https://oxen.rocks/deps ' else '');
|
|
|
|
|
|
|
|
[
|
|
|
|
// Unit tests (PRs only)
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
2024-02-07 13:37:46 +11:00
|
|
|
type: 'docker',
|
2024-02-07 13:19:57 +11:00
|
|
|
name: 'Unit Tests',
|
|
|
|
platform: { arch: 'amd64' },
|
|
|
|
trigger: { event: { exclude: [ 'push' ] } },
|
|
|
|
steps: [
|
2024-02-07 14:54:42 +11:00
|
|
|
version_info,
|
2024-02-07 13:19:57 +11:00
|
|
|
clone_submodules,
|
|
|
|
{
|
|
|
|
name: 'Run Unit Tests',
|
2024-02-07 14:54:42 +11:00
|
|
|
image: docker_base + 'android',
|
2024-02-07 14:28:03 +11:00
|
|
|
pull: 'always',
|
2024-02-07 14:54:42 +11:00
|
|
|
environment: { ANDROID_HOME: '/usr/lib/android-sdk' },
|
2024-02-07 13:19:57 +11:00
|
|
|
commands: [
|
2024-02-07 16:53:40 +11:00
|
|
|
'apt-get install -y ninja-build',
|
2024-02-07 13:19:57 +11:00
|
|
|
'./gradlew testPlayDebugUnitTestCoverageReport'
|
|
|
|
],
|
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// Validate build artifact was created by the direct branch push (PRs only)
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
2024-02-07 13:37:46 +11:00
|
|
|
type: 'docker',
|
2024-02-07 13:19:57 +11:00
|
|
|
name: 'Check Build Artifact Existence',
|
|
|
|
platform: { arch: 'amd64' },
|
|
|
|
trigger: { event: { exclude: [ 'push' ] } },
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'Poll for build artifact existence',
|
2024-02-07 14:54:42 +11:00
|
|
|
image: docker_base + 'android',
|
2024-02-07 14:28:03 +11:00
|
|
|
pull: 'always',
|
2024-02-07 13:19:57 +11:00
|
|
|
commands: [
|
2024-02-07 15:33:31 +11:00
|
|
|
'./scripts/drone-upload-exists.sh'
|
2024-02-07 13:19:57 +11:00
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
// Debug APK build (non-PRs only)
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
2024-02-07 13:37:46 +11:00
|
|
|
type: 'docker',
|
2024-02-07 13:19:57 +11:00
|
|
|
name: 'Debug APK Build',
|
|
|
|
platform: { arch: 'amd64' },
|
|
|
|
trigger: { event: { exclude: [ 'pull_request' ] } },
|
|
|
|
steps: [
|
2024-02-07 14:54:42 +11:00
|
|
|
version_info,
|
2024-02-07 14:26:28 +11:00
|
|
|
clone_submodules,
|
|
|
|
{
|
2024-02-07 16:53:40 +11:00
|
|
|
name: 'Build and upload',
|
2024-02-07 14:54:42 +11:00
|
|
|
image: docker_base + 'android',
|
2024-02-07 14:28:03 +11:00
|
|
|
pull: 'always',
|
2024-02-07 16:53:40 +11:00
|
|
|
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, ANDROID_HOME: '/usr/lib/android-sdk' },
|
2024-02-07 13:19:57 +11:00
|
|
|
commands: [
|
2024-02-07 16:53:40 +11:00
|
|
|
'apt-get install -y ninja-build',
|
|
|
|
'./gradlew assemblePlayDebug',
|
|
|
|
'./scripts/drone-static-upload.sh'
|
2024-02-07 14:43:11 +11:00
|
|
|
],
|
2024-02-07 16:53:40 +11:00
|
|
|
}
|
2024-02-07 13:19:57 +11:00
|
|
|
],
|
|
|
|
}
|
|
|
|
]
|