Skip to content

Commit

Permalink
Conan: Add CI setup #163
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Dec 5, 2018
1 parent 41750c3 commit 72d4e94
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 3 deletions.
37 changes: 36 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@ language: cpp
dist: trusty
sudo: false

env:
global:
- CONAN_USERNAME="skypjack"
- CONAN_PACKAGE_NAME="entt"
- CONAN_HEADER_ONLY="True"
- NON_CONAN_DEPLOYMENT="True"

conan-buildsteps: &conan-buildsteps
before_install:
# use this step if you desire to manipulate CONAN variables programmatically
- NON_CONAN_DEPLOYMENT="False"
install:
- chmod +x ./conan/ci/install.sh
- ./conan/ci/install.sh
script:
- chmod +x ./conan/ci/build.sh
- ./conan/ci/build.sh
# the following are dummies to overwrite default build steps
before_script:
- true
after_success:
- true
if: tag IS present
conan-linux: &conan-linux
os: linux
sudo: required
language: python
python: "3.6"
services:
- docker
<<: *conan-buildsteps

matrix:
include:
- os: linux
Expand Down Expand Up @@ -35,6 +67,9 @@ matrix:
- pip install --user cpp-coveralls
after_success:
- coveralls --gcov gcov-7 --gcov-options '\-lp' --root ${TRAVIS_BUILD_DIR} --build-root ${TRAVIS_BUILD_DIR}/build --extension cpp --extension hpp --exclude deps --include src
# Conan testing and uploading
- <<: *conan-linux
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8

notifications:
email:
Expand All @@ -59,4 +94,4 @@ deploy:
script: scripts/update_packages.sh $TRAVIS_TAG
on:
tags: true
condition: “$TRAVIS_BRANCH” = “$TRAVIS_TAG
condition: “$NON_CONAN_DEPLOYMENT = “True
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,16 @@ Note that benchmarks are not part of this set.

`EnTT` is available for some of the most known packaging tools. In particular:

* [`vcpkg`](https://github.com/Microsoft/vcpkg/tree/master/ports/entt),
Microsoft VC++ Packaging Tool.
* [`Conan`](https://bintray.com/skypjack/conan/entt%3Askypjack/_latestVersion),
the C/C++ Package Manager for Developers.
* [`Homebrew`](https://github.com/skypjack/homebrew-entt), the missing package
manager for macOS.<br/>
Available as a homebrew formula. Just type the following to install it:
```
brew install skypjack/entt/entt
```
* [`vcpkg`](https://github.com/Microsoft/vcpkg/tree/master/ports/entt),
Microsoft VC++ Packaging Tool.

Consider this list a work in progress and help me to make it longer.

Expand Down
45 changes: 45 additions & 0 deletions conan/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from cpt.packager import ConanMultiPackager
import os

if __name__ == "__main__":
login_username = os.getenv("CONAN_LOGIN_USERNAME")
username = os.getenv("CONAN_USERNAME")
tag_version = os.getenv("CONAN_PACKAGE_VERSION", os.getenv("TRAVIS_TAG"))
package_version = tag_version.replace("v", "")
package_name_unset = "SET-CONAN_PACKAGE_NAME-OR-CONAN_REFERENCE"
package_name = os.getenv("CONAN_PACKAGE_NAME", package_name_unset)
reference = "{}/{}".format(package_name, package_version)
channel = os.getenv("CONAN_CHANNEL", "stable")
upload = os.getenv("CONAN_UPLOAD")
stable_branch_pattern = os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+.*")
test_folder = os.getenv("CPT_TEST_FOLDER", os.path.join("conan", "test_package"))
upload_only_when_stable = os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True)
header_only = os.getenv("CONAN_HEADER_ONLY", False)
pure_c = os.getenv("CONAN_PURE_C", False)

disable_shared = os.getenv("CONAN_DISABLE_SHARED_BUILD", "False")
if disable_shared == "True" and package_name == package_name_unset:
raise Exception("CONAN_DISABLE_SHARED_BUILD: True is only supported when you define CONAN_PACKAGE_NAME")

builder = ConanMultiPackager(username=username,
reference=reference,
channel=channel,
login_username=login_username,
upload=upload,
stable_branch_pattern=stable_branch_pattern,
upload_only_when_stable=upload_only_when_stable,
test_folder=test_folder)
if header_only == "False":
builder.add_common_builds(pure_c=pure_c)
else:
builder.add()

filtered_builds = []
for settings, options, env_vars, build_requires, reference in builder.items:
if disable_shared == "False" or not options["{}:shared".format(package_name)]:
filtered_builds.append([settings, options, env_vars, build_requires])
builder.builds = filtered_builds

builder.run()
7 changes: 7 additions & 0 deletions conan/ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e
set -x

conan user
python conan/build.py
6 changes: 6 additions & 0 deletions conan/ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e
set -x

pip install -U conan_package_tools conan

0 comments on commit 72d4e94

Please sign in to comment.