Skip to content

Commit 0b96abd

Browse files
authored
Merge pull request #17 from grisumbras/conan-support
Conan support
2 parents 6df748a + 823ce2c commit 0b96abd

File tree

16 files changed

+348
-147
lines changed

16 files changed

+348
-147
lines changed

.github/conan-remotes/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM conanio/gcc8 AS base
2+
3+
LABEL "com.github.actions.name"="conan-remotes"
4+
LABEL "com.github.actions.description"="Adds Conan remotes from environment variables"
5+
LABEL "description"="Adds Conan remotes from environment variables"
6+
LABEL "maintainer"="Dmitry Arkhipov <grisumbras@gmail.com>"
7+
8+
USER root
9+
ADD entrypoint.sh /entrypoint.sh
10+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh -l
2+
3+
eval "$(pyenv init -)"
4+
eval "$(pyenv virtualenv-init -)"
5+
6+
if [ x != "x$CONAN_UPLOAD" ]; then
7+
conan remote add upload_repo $CONAN_UPLOAD
8+
fi
9+
10+
i=1
11+
old_ifs=$IFS
12+
IFS=,
13+
for r in $CONAN_REMOTES; do
14+
conan remote add env_remote_$i "$r"
15+
i=$(($i+1))
16+
done
17+
IFS=$old_ifs

.github/conan-upload/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM conanio/gcc8
2+
3+
LABEL "com.github.actions.name"="conan-upload"
4+
LABEL "com.github.actions.description"="Uploads a Conan package"
5+
6+
LABEL "maintainer"="Dmitry Arkhipov <grisumbras@gmail.com>"
7+
8+
USER root
9+
ADD entrypoint.sh /entrypoint.sh
10+
ENTRYPOINT ["/entrypoint.sh"]

.github/conan-upload/entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh -l
2+
3+
eval "$(pyenv init -)"
4+
eval "$(pyenv virtualenv-init -)"
5+
conan user -p $CONAN_PASSWORD -r upload_repo $CONAN_LOGIN_USERNAME
6+
7+
PACKAGE_NAME=$(conan inspect . -a name | cut -d\ -f2)
8+
PACKAGE_VERSION=$(conan inspect . -a version | cut -d\ -f2)
9+
CONAN_REFERENCE=$PACKAGE_NAME/$PACKAGE_VERSION
10+
11+
conan upload -r upload_repo -c $CONAN_REFERENCE

.github/cpt/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM conanio/gcc8 AS base
2+
3+
LABEL "com.github.actions.name"="conan-build"
4+
LABEL "com.github.actions.description"="Builds a Conan package"
5+
6+
LABEL "maintainer"="Dmitry Arkhipov <grisumbras@gmail.com>"
7+
8+
USER root
9+
ADD entrypoint.sh /entrypoint.sh
10+
ENTRYPOINT ["/entrypoint.sh"]

.github/cpt/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh -l
2+
3+
eval "$(pyenv init -)"
4+
eval "$(pyenv virtualenv-init -)"
5+
if [ x != "x$CONAN_UPLOAD" ]; then
6+
conan remote add upload_repo $CONAN_UPLOAD
7+
fi
8+
python build.py

.github/main.workflow

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
workflow "CI" {
2+
on = "push"
3+
resolves = "publish"
4+
}
5+
6+
7+
action "remotes" {
8+
uses = "./.github/conan-remotes/"
9+
env = {
10+
CONAN_REMOTES = "https://api.bintray.com/conan/bincrafters/public-conan"
11+
CONAN_UPLOAD = "https://api.bintray.com/conan/grisumbras/conan"
12+
}
13+
}
14+
15+
16+
action "build" {
17+
needs = "remotes"
18+
uses = "./.github/cpt/"
19+
env = {
20+
CONAN_CHANNEL = "testing"
21+
CONAN_PRINT_RUN_COMMANDS = "1"
22+
CONAN_REMOTES = "https://api.bintray.com/conan/bincrafters/public-conan"
23+
CONAN_UPLOAD = "https://api.bintray.com/conan/grisumbras/conan"
24+
CONAN_USERNAME = "grisumbras"
25+
}
26+
}
27+
28+
29+
action "filter-ref" {
30+
needs = "build"
31+
uses = "actions/bin/filter@master"
32+
args = "branch master || tag"
33+
}
34+
35+
action "publish" {
36+
uses = "./.github/conan-upload/"
37+
needs = "filter-ref"
38+
secrets = ["CONAN_LOGIN_USERNAME", "CONAN_PASSWORD"]
39+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@
2121
*.app
2222

2323
# Test artefacts
24+
/bin
2425
test/bin
26+
27+
# Conan artificats
28+
/tmp
29+
test/build

build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from cpt.packager import ConanMultiPackager
2+
3+
4+
if __name__ == "__main__":
5+
builder = ConanMultiPackager()
6+
builder.add()
7+
builder.run()

conanfile.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from conans import (
2+
ConanFile,
3+
python_requires,
4+
)
5+
6+
7+
b2 = python_requires("b2-helper/0.2.0@grisumbras/testing")
8+
9+
10+
class EnumFlagsConan(b2.B2.Mixin, ConanFile):
11+
name = "enum-flags"
12+
version = "0.1.0"
13+
description = "Bit flags for C++ scoped enums"
14+
topics = "bit-mask", "bit-flag",
15+
author = "Dmitry Arkhipov <grisumbras@gmail.com>"
16+
license = "MIT"
17+
url = "https://github.com/grisumbras/enum-flags"
18+
homepage = url
19+
20+
exports_sources = "jamroot.jam", "build.jam", "*.hpp", "*.cpp", "LICENSE*",
21+
no_copy_source = True
22+
build_requires = "boost_build/[>=1.68]@bincrafters/stable"
23+
24+
def package_info(self):
25+
self.info.header_only()

0 commit comments

Comments
 (0)