2024-02-07 02:51:01 +00:00
|
|
|
local docker_base = 'registry.oxen.rocks/lokinet-ci-';
|
2024-02-07 03:18:19 +00:00
|
|
|
local default_deps = [];
|
2024-02-07 02:51:01 +00:00
|
|
|
|
2024-02-07 02:37:46 +00:00
|
|
|
// Log a bunch of version information to make it easier for debugging
|
|
|
|
local version_info = {
|
|
|
|
name: 'Version Information',
|
|
|
|
commands: [
|
|
|
|
'/usr/lib/android-ndk --version',
|
|
|
|
'/usr/lib/android-sdk --version'
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2024-02-07 02:19:57 +00: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 03:18:19 +00:00
|
|
|
commands: ['git fetch --tags', 'git submodule update --init --recursive --depth=2 --jobs=4']
|
2024-02-07 02:19:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// cmake options for static deps mirror
|
|
|
|
local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https://oxen.rocks/deps ' else '');
|
|
|
|
|
2024-02-07 03:18:19 +00:00
|
|
|
local debian_pipeline(name,
|
|
|
|
image,
|
|
|
|
arch='amd64',
|
|
|
|
deps=default_deps,
|
|
|
|
oxen_repo=false,
|
|
|
|
kitware_repo=''/* ubuntu codename, if wanted */,
|
|
|
|
allow_fail=false,
|
|
|
|
build=['echo "Error: drone build argument not set"', 'exit 1'])
|
|
|
|
= {
|
|
|
|
kind: 'pipeline',
|
|
|
|
type: 'docker',
|
|
|
|
name: name,
|
|
|
|
platform: { arch: arch },
|
|
|
|
steps: [
|
2024-02-07 03:21:35 +00:00
|
|
|
clone_submodules,
|
2024-02-07 03:18:19 +00:00
|
|
|
{
|
|
|
|
name: 'build',
|
|
|
|
image: image,
|
|
|
|
pull: 'always',
|
|
|
|
[if allow_fail then 'failure']: 'ignore',
|
2024-02-07 03:21:35 +00:00
|
|
|
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
|
|
|
|
commands: [
|
|
|
|
'./gradlew assemblePlayDebug',
|
|
|
|
'./Scripts/drone-static-upload.sh',
|
|
|
|
] + build,
|
2024-02-07 03:18:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
local debian_build(name,
|
|
|
|
image,
|
|
|
|
arch='amd64',
|
|
|
|
deps=default_deps,
|
|
|
|
build_type='Release',
|
|
|
|
lto=false,
|
|
|
|
werror=true,
|
|
|
|
cmake_extra='',
|
|
|
|
jobs=6,
|
|
|
|
tests=true,
|
|
|
|
oxen_repo=false,
|
|
|
|
kitware_repo=''/* ubuntu codename, if wanted */,
|
|
|
|
allow_fail=false)
|
|
|
|
= debian_pipeline(
|
|
|
|
name,
|
|
|
|
image,
|
|
|
|
arch=arch,
|
|
|
|
deps=deps,
|
|
|
|
oxen_repo=oxen_repo,
|
|
|
|
kitware_repo=kitware_repo,
|
|
|
|
allow_fail=allow_fail,
|
2024-02-07 03:21:35 +00:00
|
|
|
build=[]
|
2024-02-07 03:18:19 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2024-02-07 02:19:57 +00:00
|
|
|
[
|
|
|
|
// Unit tests (PRs only)
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
2024-02-07 02:37:46 +00:00
|
|
|
type: 'docker',
|
2024-02-07 02:19:57 +00:00
|
|
|
name: 'Unit Tests',
|
|
|
|
platform: { arch: 'amd64' },
|
|
|
|
trigger: { event: { exclude: [ 'push' ] } },
|
|
|
|
steps: [
|
2024-02-07 02:37:46 +00:00
|
|
|
version_info,
|
2024-02-07 02:19:57 +00:00
|
|
|
clone_submodules,
|
|
|
|
{
|
|
|
|
name: 'Run Unit Tests',
|
2024-02-07 02:51:01 +00:00
|
|
|
image: docker_base + 'android',
|
2024-02-07 02:19:57 +00:00
|
|
|
commands: [
|
|
|
|
'./gradlew testPlayDebugUnitTestCoverageReport'
|
|
|
|
],
|
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// Validate build artifact was created by the direct branch push (PRs only)
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
2024-02-07 02:37:46 +00:00
|
|
|
type: 'docker',
|
2024-02-07 02:19:57 +00:00
|
|
|
name: 'Check Build Artifact Existence',
|
|
|
|
platform: { arch: 'amd64' },
|
|
|
|
trigger: { event: { exclude: [ 'push' ] } },
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'Poll for build artifact existence',
|
2024-02-07 02:51:01 +00:00
|
|
|
image: docker_base + 'android',
|
2024-02-07 02:19:57 +00:00
|
|
|
commands: [
|
|
|
|
'./Scripts/drone-upload-exists.sh'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
// Debug APK build (non-PRs only)
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
2024-02-07 02:37:46 +00:00
|
|
|
type: 'docker',
|
2024-02-07 02:19:57 +00:00
|
|
|
name: 'Debug APK Build',
|
|
|
|
platform: { arch: 'amd64' },
|
|
|
|
trigger: { event: { exclude: [ 'pull_request' ] } },
|
|
|
|
steps: [
|
2024-02-07 03:18:19 +00:00
|
|
|
debian_pipeline(
|
|
|
|
'Build',
|
|
|
|
docker_base + 'android',
|
|
|
|
build=[]
|
|
|
|
),
|
2024-02-07 02:19:57 +00:00
|
|
|
{
|
|
|
|
name: 'Upload artifacts',
|
2024-02-07 02:51:01 +00:00
|
|
|
image: docker_base + 'android',
|
2024-02-07 02:19:57 +00:00
|
|
|
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
|
|
|
|
commands: [
|
|
|
|
'./Scripts/drone-static-upload.sh'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
]
|