Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 973275c

Browse files
authored
[CI] Use travis for CI/CD (#72)
* Adding initial travis skeleton * test * Add first ci steps * Add unit tests into travis ci yml * Fix docker args * Fix docker args * Migrate to opencv3/4 API * Opencv v2 compat * Reverse opencv compat condition * Fix compat condition; remove already defined items * fix logic for CV_FOURCC_COMPAT * initial OSX bundle support * Fix icon name in osx * More OSX packaging options * Add deploy step * Don't require qemu-arm-static if we're not building docker images * test release * Use custom upload token * Build on all branches * More fix on deploy * Correct version for releases; also get a better formatted body * Fix travis.yml syntax * [OSX] Place icon in the correct path * Multi-platform build test * Switch language to c++ * Use python 3.6 venv before running packaging in Linux * Use DragNDrop generator for OSX automated builds * Use custom release script * add missing deploy script * Use sudo to install PIP dependency * Fix compilation on ubuntu 16.04 Add skip_cleanup flag for deployment * Use python 3.6 virtualenv for GitHub release * Explicit use of python3 in deploy scripts * Fix deploy script * Only build on PR or master * Build for all architectures * Parametric build matrix * Add build step for building unit tests only * Remove ubuntu 16.04 from supported distros * Fix fedora build * Restore previous scripts format * Download google tests via cmake fix network unit test * Remove all submodules, use cmake downloader instead * Restore ubuntu 16.04 Fix out-of-project build * Add more distributions, and remove deprecated ones. Try to optimise travis by skipping tests on arm builds * More cache optimisation by reusing build directory in docker * Consistent date on release number * remove CMake cache to enforce docker generated variables * Downgrade cmake requirements to 3.0 to get compilation working on Jessie * Restore cmake 3.1 dependency; remove debian jessie support (besides cmake, Qt version is too low for it) * Use plain https download instead of git for googletest * Increment parallel make jobs * Add more verbose unit tests output * Revert add_test in CMake; remove arm images as they're too slow to build on CI * Revert failing test * reuse docker images * Restore previous behaviour; run on xenial instead of trusty * Rework and simplify build by using python as travis yaml generator * Install pyaml on travis * Minor updates to travis scripts * Upgrade docker version * cd to correct directory in OSX * Change docker startup options * debug docker startup * Adding append-docker-arg option to pass --security-opt seccomp:unconfined * Fix docker.py flag * Try #2 * Exit on deps installation issues on osx * Fix indentation block * Restore trusty as compile machine for travis * Use docker privileged mode
1 parent 92e8c29 commit 973275c

54 files changed

Lines changed: 650 additions & 179 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
[submodule "GuLinux-Commons"]
2-
path = GuLinux-Commons
3-
url = https://github.com/GuLinux/GuLinux-Commons.git
4-
[submodule "src/drivers/qhy/QHYCCD_Linux"]
5-
path = src/drivers/qhy/QHYCCD_Linux
6-
url = https://github.com/qhyccd-lzr/QHYCCD_Linux.git
7-
[submodule "tests/googletest"]
8-
path = tests/googletest
9-
url = https://github.com/google/googletest

.travis.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
before_install:
2+
- 'bash -x ${TRAVIS_BUILD_DIR}/scripts/travis/before_install'
3+
deploy:
4+
on:
5+
branch: master
6+
repo: GuLinux/PlanetaryImager
7+
provider: script
8+
script: 'bash -x ${TRAVIS_BUILD_DIR}/scripts/travis/deploy'
9+
skip_cleanup: true
10+
if: 'branch = master OR type = pull_request'
11+
language: cpp
12+
matrix:
13+
include:
14+
- env: 'SKIP_TESTS=0 BUILD_OS_FAMILY=osx'
15+
os: osx
16+
- dist: xenial
17+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:ubuntu-19.04-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
18+
os: linux
19+
services:
20+
- docker
21+
- dist: xenial
22+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:ubuntu-18.04-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
23+
os: linux
24+
services:
25+
- docker
26+
- dist: xenial
27+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:ubuntu-16.04-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
28+
os: linux
29+
services:
30+
- docker
31+
- dist: xenial
32+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:debian-stretch-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
33+
os: linux
34+
services:
35+
- docker
36+
- dist: xenial
37+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:debian-buster-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
38+
os: linux
39+
services:
40+
- docker
41+
- dist: xenial
42+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:fedora-29-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
43+
os: linux
44+
services:
45+
- docker
46+
- dist: xenial
47+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:fedora-30-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
48+
os: linux
49+
services:
50+
- docker
51+
- dist: xenial
52+
env: 'SKIP_TESTS=0 DOCKER_IMAGE=gulinux/planetaryimager_build:fedora-31-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=linux CMAKE_BINARY=cmake'
53+
os: linux
54+
services:
55+
- docker
56+
- dist: xenial
57+
env: 'SKIP_TESTS=1 DOCKER_IMAGE=gulinux/planetaryimager_build:windows-x86_64 IMAGE_ARCH=x86_64 BUILD_OS_FAMILY=windows CMAKE_BINARY=x86_64-w64-mingw32.static-cmake'
58+
os: linux
59+
services:
60+
- docker
61+
script: 'bash -x ${TRAVIS_BUILD_DIR}/scripts/travis/ci-build && bash -x ${TRAVIS_BUILD_DIR}/scripts/travis/tests && bash -x ${TRAVIS_BUILD_DIR}/scripts/travis/package'

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1)
22
enable_testing()
33
project(PlanetaryImager)
44
set(CMAKE_CXX_STANDARD 14)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
56

67
set(MAJOR_VERSION 0)
78
set(MINOR_VERSION 7)
@@ -15,15 +16,24 @@ include(cmake/options.cmake)
1516
include(cmake/utils.cmake)
1617
include(cmake/functions.cmake)
1718

18-
add_definitions(-DSRC_DIR="${CMAKE_SOURCE_DIR}")
19+
external_project_download(cmake/GuLinux-Commons.cmake.in GuLinux-Commons)
1920

21+
add_definitions(-DSRC_DIR="${CMAKE_SOURCE_DIR}")
22+
configure_file(${CMAKE_SOURCE_DIR}/scripts/version.sh.in ${CMAKE_BINARY_DIR}/scripts/version.sh)
2023

21-
install(FILES README.md Changelog.md DESTINATION share/doc/PlanetaryImager)
24+
if(NOT OSX_BUNDLE)
25+
install(FILES README.md Changelog.md DESTINATION share/doc/PlanetaryImager)
26+
endif()
2227

2328

2429

25-
add_subdirectory(GuLinux-Commons/Qt)
26-
add_subdirectory(GuLinux-Commons/c++)
30+
add_subdirectory(${CMAKE_BINARY_DIR}/GuLinux-Commons/Qt ${CMAKE_BINARY_DIR}/GuLinux-Commons-build/Qt)
31+
add_subdirectory(${CMAKE_BINARY_DIR}/GuLinux-Commons/c++ ${CMAKE_BINARY_DIR}/GuLinux-Commons-build/c++)
32+
include_directories(
33+
${CMAKE_BINARY_DIR}/GuLinux-Commons/Qt
34+
${CMAKE_BINARY_DIR}/GuLinux-Commons/c++
35+
${CMAKE_BINARY_DIR}/GuLinux-Commons
36+
)
2737

2838
add_subdirectory(src)
2939
if(ENABLE_PLANETARYIMAGER_TESTING)

GuLinux-Commons

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmake/GuLinux-Commons.cmake.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
3+
project(GuLinux-Commons-Download NONE)
4+
5+
include(ExternalProject)
6+
ExternalProject_Add(GuLinux-Commons
7+
GIT_REPOSITORY https://github.com/GuLinux/GuLinux-Commons.git
8+
GIT_TAG 7aafede7ec32b576ba6648fa53613f319f215111
9+
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/GuLinux-Commons"
10+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/GuLinux-Commons-build"
11+
CONFIGURE_COMMAND ""
12+
BUILD_COMMAND ""
13+
INSTALL_COMMAND ""
14+
TEST_COMMAND ""
15+
)

cmake/functions.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,20 @@ function(add_driver)
4646
install(TARGETS ${add_driver_NAME} LIBRARY DESTINATION ${drivers_destination})
4747
set(enabled_drivers ${enabled_drivers} ${add_driver_NAME} CACHE INTERNAL "")
4848
endfunction()
49+
50+
function(external_project_download IN_FILE OUT_DIR)
51+
configure_file(${IN_FILE} ${OUT_DIR}_download/CMakeLists.txt)
52+
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
53+
RESULT_VARIABLE result
54+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OUT_DIR}_download)
55+
if(result)
56+
message(FATAL_ERROR "CMake step for ${OUT_DIR} failed: ${result}")
57+
endif()
58+
execute_process(COMMAND ${CMAKE_COMMAND} --build .
59+
RESULT_VARIABLE result
60+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OUT_DIR}_download )
61+
if(result)
62+
message(FATAL_ERROR "Build step for ${OUT_DIR} failed: ${result}")
63+
endif()
64+
endfunction()
65+

cmake/options.cmake

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,16 @@ if(DEBUG_NETWORK_PACKETS)
3030
endif()
3131

3232
# Extra executables to be built
33-
option(build_network_server "Build PlanetaryImager network daemon and frontend" On)
34-
33+
if("${CPACK_GENERATOR}" STREQUAL "DragNDrop")
34+
message("Disabling PlanetaryImager network daemon and frontend in bundle mode")
35+
set(build_network_server Off)
36+
set(OSX_BUNDLE On)
37+
add_definitions(-DOSX_BUNDLE=1)
38+
set(CMAKE_INSTALL_PREFIX /)
39+
set(MACOSX_BUNDLE_BUNDLE_NAME PlanetaryImager)
40+
set(MACOSX_BUNDLE_BUNDLE_VERSION ${FULL_VERSION})
41+
set(MACOSX_BUNDLE_GUI_IDENTIFIER net.gulinux.planetaryimager)
42+
set(APPBUNDLE_INSTALL_PREFIX "${MACOSX_BUNDLE_BUNDLE_NAME}.app/")
43+
else()
44+
option(build_network_server "Build PlanetaryImager network daemon and frontend" On)
45+
endif()

files/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
55
add_subdirectory(icons)
66
endif()
77
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
8-
install(FILES planetary_imager.icns DESTINATION Resources)
9-
install(FILES Info.plist DESTINATION .)
10-
install(PROGRAMS planetary_imager_osx_launcher.sh DESTINATION MacOS)
8+
install(FILES planetary_imager.icns DESTINATION ${APPBUNDLE_INSTALL_PREFIX}/Contents/Resources)
9+
set(MACOSX_BUNDLE_ICON_FILE planetary_imager CACHE INTERNAL "")
10+
# install(FILES Info.plist DESTINATION .)
11+
# install(PROGRAMS planetary_imager_osx_launcher.sh DESTINATION MacOS)
1112
endif()

scripts/release-travis.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python
2+
from github import Github
3+
from github.GithubException import UnknownObjectException
4+
import os
5+
import sys
6+
7+
github = Github(os.environ['GITHUB_OAUTH_USER'], os.environ['GITHUB_OAUTH_TOKEN'])
8+
repo = github.get_repo('GuLinux/PlanetaryImager')
9+
10+
release_name = os.environ['PLANETARY_IMAGER_VERSION']
11+
release_tag = 'v' + release_name
12+
release_body = os.environ['TRAVIS_COMMIT_MESSAGE']
13+
commit_id = os.environ['TRAVIS_COMMIT']
14+
15+
pr_number = os.environ.get('TRAVIS_PULL_REQUEST', 'false')
16+
if pr_number and pr_number != 'false':
17+
try:
18+
pr = repo.get_pull(int(pr_number))
19+
print(pr)
20+
print(pr.title)
21+
print(pr.body)
22+
release_body='''# {}
23+
{}
24+
25+
## Commit message:
26+
```
27+
{}
28+
```
29+
'''.format(pr.title, pr.body, release_body)
30+
print(release_body)
31+
except ValueError:
32+
pass
33+
34+
release = None
35+
try:
36+
release = repo.get_release(release_tag)
37+
except UnknownObjectException:
38+
release = repo.create_git_release(release_tag, release_name, release_body, draft=False, prerelease=True, target_commitish=commit_id)
39+
40+
print('Release created/updated: ' + release_tag)
41+
for asset in sys.argv[1:]:
42+
print(' - deploying asset: ' + asset)
43+
release.upload_asset(asset)

scripts/travis/before_install

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
4+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
6+
sudo apt-get update
7+
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
8+
sudo systemctl restart docker
9+
docker --version
10+
current_arch="$(uname -i)"
11+
if [ "$current_arch" != "${IMAGE_ARCH}" ]; then
12+
echo "Architecture $current_arch different than specified docker image ($DOCKER_IMAGE); enabling qemu-arm-static"
13+
sudo apt-get install -y binfmt-support
14+
docker run --rm --privileged multiarch/qemu-user-static:register
15+
fi
16+
fi
17+
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
18+
bash support/osx/install-deps
19+
brew install python@3
20+
fi
21+
echo "export GIT_COMMIT_DATE=\"$(git show -s --format='%cd' --date=short | tr -d '-')\"" > ${TRAVIS_BUILD_DIR}/git_commit_date.sh
22+
cat ${TRAVIS_BUILD_DIR}/git_commit_date.sh
23+

0 commit comments

Comments
 (0)