From 1319fe2eb5881bcb8e4e2f218eedff152ca7da6a Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 24 Sep 2019 12:55:39 +0200 Subject: [PATCH] GH actions: conan --- .../workflows/{coveralls.yml => coverage.yml} | 4 +- .github/workflows/deploy.yml | 33 +++++++++++++++ .travis.yml | 42 ------------------- CMakeLists.txt | 5 ++- TODO | 4 +- conan/build.py | 20 +++------ docs/CMakeLists.txt | 13 ++---- scripts/update_homebrew.sh | 4 +- scripts/update_packages.sh | 3 -- 9 files changed, 50 insertions(+), 78 deletions(-) rename .github/workflows/{coveralls.yml => coverage.yml} (88%) create mode 100644 .github/workflows/deploy.yml delete mode 100755 scripts/update_packages.sh diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coverage.yml similarity index 88% rename from .github/workflows/coveralls.yml rename to .github/workflows/coverage.yml index 92b20ef9b..c251d248a 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coverage.yml @@ -1,4 +1,4 @@ -name: coveralls +name: coverage on: [push, pull_request] @@ -34,4 +34,4 @@ jobs: run: | pip install --upgrade wheel pip install cpp-coveralls - coveralls --gcov gcov-7 --gcov-options '\-lp' -r . -b ./build -x cpp -x hpp -e ./deps -i ./src + coveralls --gcov gcov-7 --gcov-options '\-lp' -r . -b build -x cpp -x hpp -e deps -i src diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..62d1fc2fc --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ +name: deploy + +on: + push: + tags: + - v* + +jobs: + + conan: + timeout-minutes: 5 + runs-on: ubuntu-latest + + steps: + - uses: docker://conanio/gcc8 + - uses: actions/checkout@v1 + - name: Setup Python + uses: actions/setup-python@master + with: + version: 3.6 + - name: Install + run: | + chmod +x conan/ci/install.sh + ./conan/ci/install.sh + - name: Deploy + env: + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASSWORD }} + CONAN_UPLOAD: ${{ secrets.CONAN_UPLOAD }} + CONAN_GCC_VERSIONS: 8 + run: | + chmod +x conan/ci/build.sh + ./conan/ci/build.sh diff --git a/.travis.yml b/.travis.yml index 9b3294803..3a40dfe2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,38 +2,6 @@ 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 @@ -54,9 +22,6 @@ matrix: osx_image: xcode10 compiler: clang env: COMPILER=clang++ - # Conan testing and uploading - - <<: *conan-linux - env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8 notifications: email: @@ -75,10 +40,3 @@ script: - mkdir -p build && cd build - cmake -DBUILD_TESTING=ON -DBUILD_LIB=ON .. && make -j4 - CTEST_OUTPUT_ON_FAILURE=1 ctest --timeout 5 -C Debug -j4 - -deploy: - provider: script - script: scripts/update_packages.sh $TRAVIS_TAG - on: - tags: true - condition: “$NON_CONAN_DEPLOYMENT = “True” diff --git a/CMakeLists.txt b/CMakeLists.txt index bce69bcd3..aa4243cd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,11 +219,12 @@ endif() # AOB # +FILE(GLOB GH_WORKFLOWS .github/workflows/*.yml) + add_custom_target( entt_aob SOURCES - .github/workflows/ci.yml - .github/workflows/coveralls.yml + ${GH_WORKFLOWS} .github/FUNDING.yml appveyor.yml AUTHORS diff --git a/TODO b/TODO index 00da1bc81..709a045bb 100644 --- a/TODO +++ b/TODO @@ -35,7 +35,5 @@ TODO * nested groups: AB/ABC/ABCD/... (hints: sort, check functions) * GH actions: + - get rid of travis/appveyor - badge(s) from github actions - - deploy doc (github pages) on tags - - rebuild single file somehow, somewhere - - conan on tags diff --git a/conan/build.py b/conan/build.py index 4b3bde840..462f9c5a7 100644 --- a/conan/build.py +++ b/conan/build.py @@ -4,24 +4,19 @@ from cpt.packager import ConanMultiPackager import os if __name__ == "__main__": + username = os.getenv("GITHUB_ACTOR") + tag_version = os.getenv("GITHUB_REF") + tag_package = os.getenv("GITHUB_REPOSITORY") 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) + package_version = tag_version.replace("refs/tags/v", "") + package_name = tag_package.replace("skypjack/", "") 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, @@ -31,10 +26,7 @@ if __name__ == "__main__": 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() + builder.add() filtered_builds = [] for settings, options, env_vars, build_requires, reference in builder.items: diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 8fae0568c..1d06a5baa 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -21,18 +21,11 @@ install( DESTINATION share/${PROJECT_NAME}-${PROJECT_VERSION}/ ) +FILE(GLOB MD_FILES md/*.md) + add_custom_target( docs_aob SOURCES dox/extra.dox - md/core.md - md/entity.md - md/faq.md - md/lib.md - md/links.md - md/locator.md - md/meta.md - md/process.md - md/resource.md - md/signal.md + ${MD_FILES} ) diff --git a/scripts/update_homebrew.sh b/scripts/update_homebrew.sh index 2c91c99db..300a2980a 100755 --- a/scripts/update_homebrew.sh +++ b/scripts/update_homebrew.sh @@ -41,14 +41,14 @@ echo "Sedding..." # change the url in the formula file # the slashes in the URL must be escaped -ESCAPED_URL="$(sed -e 's/[\/&]/\\&/g' <<< "$URL")" +ESCAPED_URL="$(echo "$URL" | sed -e 's/[\/&]/\\&/g')" sed -i -e '/url/s/".*"/"'$ESCAPED_URL'"/' $FORMULA # change the hash in the formula file sed -i -e '/sha256/s/".*"/"'$HASH'"/' $FORMULA # delete temporary file created by sed -rm "$FORMULA-e" +rm -rf "$FORMULA-e" # update remote repo echo "Gitting..." diff --git a/scripts/update_packages.sh b/scripts/update_packages.sh deleted file mode 100755 index d8cc9106d..000000000 --- a/scripts/update_packages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -scripts/update_homebrew.sh $1