From 58ba6309d10e4131d74c0ca66744a8c77fbf33aa Mon Sep 17 00:00:00 2001 From: Alex Denisov Date: Tue, 10 Mar 2020 10:24:10 +0100 Subject: [PATCH] Automatically deploy packages to bintray --- .github/workflows/ci-macos.yml | 45 +++++++++++++++ .github/workflows/ci-ubuntu-16.yml | 47 ++++++++++++++++ .github/workflows/ci-ubuntu-18.yml | 55 +++++++++++++++++++ .github/workflows/ci.yml | 44 --------------- .github/workflows/release-macos.yaml | 49 +++++++++++++++++ .github/workflows/release-ubuntu-16.yaml | 51 +++++++++++++++++ .github/workflows/release-ubuntu-18.yaml | 51 +++++++++++++++++ CMakeLists.txt | 2 + cmake/cpack.cmake | 2 +- cmake/packaging/cpack.DEB-ubuntu.cmake | 2 +- cmake/packaging/cpack.ZIP-macOS.cmake | 1 + infrastructure/helpers/build-mull.yaml | 8 +-- infrastructure/macos-playbook.yaml | 3 +- .../hello-world/step-1-version/sample.cpp | 2 +- 14 files changed, 307 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/ci-macos.yml create mode 100644 .github/workflows/ci-ubuntu-16.yml create mode 100644 .github/workflows/ci-ubuntu-18.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release-macos.yaml create mode 100644 .github/workflows/release-ubuntu-16.yaml create mode 100644 .github/workflows/release-ubuntu-18.yaml create mode 100644 cmake/packaging/cpack.ZIP-macOS.cmake diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml new file mode 100644 index 000000000..8abc5c7a8 --- /dev/null +++ b/.github/workflows/ci-macos.yml @@ -0,0 +1,45 @@ +name: CI macOS + +on: [pull_request] + +jobs: + test: + name: LLVM ${{ matrix.LLVM_VERSION }} + runs-on: macOS-latest + strategy: + matrix: + LLVM_VERSION: ["3.9", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0"] + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Detect Mull version + id: version + run: | + env | sort + grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } ' + grep -Eo "\"number\": [0-9]+" $GITHUB_EVENT_PATH | awk ' { print $2; exit } ' + echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '`.`grep -Eo "\"number\": [0-9]+" $GITHUB_EVENT_PATH | awk ' { print $2; exit } '` + - name: Run CI task + run: | + pip install ansible + cd infrastructure && \ + ansible-playbook macos-playbook.yaml \ + -e llvm_version="${{ matrix.LLVM_VERSION }}.0" \ + -e source_dir=$PWD/.. \ + -e gitref=$GITHUB_SHA \ + -e host=localhost \ + -e SDKROOT=`xcrun -show-sdk-path` \ + -e mull_version=${{ steps.version.outputs.version }} \ + --verbose + - name: Publish package (macOS) + if: matrix.LLVM_VERSION == '9.0' + run: | + curl --silent --show-error --location --request DELETE \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/packages/mull-project/macos/mull-nightly/versions/${{ steps.version.outputs.version }}" + curl --silent --show-error --fail --location --request PUT \ + --upload-file infrastructure/packages/`cat infrastructure/PACKAGE_FILE_NAME`.zip \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/content/mull-project/macos/mull-nightly/${{ steps.version.outputs.version }}/`cat infrastructure/PACKAGE_FILE_NAME`.zip;publish=1" diff --git a/.github/workflows/ci-ubuntu-16.yml b/.github/workflows/ci-ubuntu-16.yml new file mode 100644 index 000000000..6b0ce3a13 --- /dev/null +++ b/.github/workflows/ci-ubuntu-16.yml @@ -0,0 +1,47 @@ +name: CI Ubuntu 16.04 + +on: [pull_request] + +jobs: + test: + name: LLVM 8.0.0 + runs-on: ubuntu-latest + container: ubuntu:16.04 + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Detect Mull version + id: version + run: | + env | sort + grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } ' + grep -Eo "\"number\": [0-9]+" $GITHUB_EVENT_PATH | awk ' { print $2; exit } ' + echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '`.`grep -Eo "\"number\": [0-9]+" $GITHUB_EVENT_PATH | awk ' { print $2; exit } '` + - name: Install software + run: | + apt-get update && apt-get install -y python-pip curl + pip install ansible + - name: Run CI task + run: | + cd infrastructure && \ + ansible-playbook ubuntu-playbook.yaml \ + -e llvm_version="8.0.0" \ + -e source_dir=$PWD/.. \ + -e gitref=$GITHUB_SHA \ + -e host=localhost \ + -e mull_version=${{ steps.version.outputs.version }} \ + --verbose + - name: Publish package + run: | + curl --silent --show-error --location --request DELETE \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/packages/mull-project/ubuntu-16/mull-nightly/versions/${{ steps.version.outputs.version }}" + curl --silent --show-error --fail --location --request PUT \ + --upload-file infrastructure/packages/`cat infrastructure/PACKAGE_FILE_NAME`.deb \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + -H "X-Bintray-Debian-Distribution: nightly" \ + -H "X-Bintray-Debian-Component: main" \ + -H "X-Bintray-Debian-Architecture: amd64" \ + "https://api.bintray.com/content/mull-project/ubuntu-16/mull-nightly/${{ steps.version.outputs.version }}/pool/main/m/`cat infrastructure/PACKAGE_FILE_NAME`.deb;publish=1" \ No newline at end of file diff --git a/.github/workflows/ci-ubuntu-18.yml b/.github/workflows/ci-ubuntu-18.yml new file mode 100644 index 000000000..56e25c39b --- /dev/null +++ b/.github/workflows/ci-ubuntu-18.yml @@ -0,0 +1,55 @@ +name: CI Ubuntu 18.04 + +on: [pull_request] + +jobs: + test: + name: LLVM ${{ matrix.LLVM_VERSION }} + runs-on: ubuntu-latest + container: ubuntu:18.04 + strategy: + matrix: + LLVM_VERSION: ["3.9", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0"] + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Detect Mull version + id: version + run: | + env | sort + grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } ' + grep -Eo "\"number\": [0-9]+" $GITHUB_EVENT_PATH | awk ' { print $2; exit } ' + echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '`.`grep -Eo "\"number\": [0-9]+" $GITHUB_EVENT_PATH | awk ' { print $2; exit } '` + - name: Install software + run: | + apt-get update && apt-get install -y python-pip curl + pip install ansible + - name: Patch 3.9/4.0 + if: matrix.LLVM_VERSION == '3.9' || matrix.LLVM_VERSION == '4.0' + run: | + ln -s /usr/include/locale.h /usr/include/xlocale.h + - name: Run CI task + run: | + cd infrastructure && \ + ansible-playbook ubuntu-playbook.yaml \ + -e llvm_version="${{ matrix.LLVM_VERSION }}.0" \ + -e source_dir=$PWD/.. \ + -e gitref=$GITHUB_SHA \ + -e host=localhost \ + -e mull_version=${{ steps.version.outputs.version }} \ + --verbose + - name: Publish package + if: matrix.LLVM_VERSION == '9.0' + run: | + curl --silent --show-error --location --request DELETE \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/packages/mull-project/ubuntu-18/mull-nightly/versions/${{ steps.version.outputs.version }}" + curl --silent --show-error --fail --location --request PUT \ + --upload-file infrastructure/packages/`cat infrastructure/PACKAGE_FILE_NAME`.deb \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + -H "X-Bintray-Debian-Distribution: nightly" \ + -H "X-Bintray-Debian-Component: main" \ + -H "X-Bintray-Debian-Architecture: amd64" \ + "https://api.bintray.com/content/mull-project/ubuntu-18/mull-nightly/${{ steps.version.outputs.version }}/pool/main/m/`cat infrastructure/PACKAGE_FILE_NAME`.deb;publish=1" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 296131bb3..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: CI - -on: [pull_request] - -jobs: - test: - name: LLVM ${{ matrix.LLVM_VERSION }} / ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - LLVM_VERSION: [3.9.0, 4.0.0, 5.0.0, 6.0.0, 7.0.0, 8.0.0, 9.0.0] - os: [ubuntu-18.04, macOS-10.15] - - steps: - - uses: actions/checkout@v1 - with: - submodules: true - - name: Run macOS - if: matrix.os == 'macOS-10.15' - run: | - pip install ansible - cd infrastructure && \ - ansible-playbook macos-playbook.yaml \ - -e llvm_version=${{ matrix.LLVM_VERSION }} \ - -e source_dir=$PWD/.. \ - -e gitref=$GITHUB_SHA \ - -e host=localhost \ - -e skip_package=true \ - -e SDKROOT=`xcrun -show-sdk-path` \ - --verbose - - name: Run Ubuntu - if: matrix.os == 'ubuntu-18.04' - run: | - sudo ln -s /usr/include/locale.h /usr/include/xlocale.h - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - cd infrastructure && \ - ansible-playbook ubuntu-playbook.yaml \ - -e llvm_version=${{ matrix.LLVM_VERSION }} \ - -e source_dir=$PWD/.. \ - -e gitref=$GITHUB_SHA \ - -e host=localhost \ - -e skip_package=true \ - --verbose diff --git a/.github/workflows/release-macos.yaml b/.github/workflows/release-macos.yaml new file mode 100644 index 000000000..09b073f7d --- /dev/null +++ b/.github/workflows/release-macos.yaml @@ -0,0 +1,49 @@ +name: Release macOS + +on: + release: + types: + - created + +jobs: + test: + name: Release macOS Package + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Detect Mull version + id: version + run: | + if [ `echo $GITHUB_REF | awk -F/ ' { print $3 } '` != `grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '` ]; + then + false + fi + echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '` + - name: Install software + run: | + apt-get update && apt-get install -y python-pip curl + pip install ansible + - name: Run CI task + run: | + pip install ansible + cd infrastructure && \ + ansible-playbook macos-playbook.yaml \ + -e llvm_version="9.0.0" \ + -e source_dir=$PWD/.. \ + -e gitref=$GITHUB_SHA \ + -e host=localhost \ + -e SDKROOT=`xcrun -show-sdk-path` \ + -e mull_version=${{ steps.version.outputs.version }} \ + --verbose + - name: Publish package + run: | + curl --silent --show-error --location --request DELETE \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/packages/mull-project/macos/mull/versions/${{ steps.version.outputs.version }}" + curl --silent --show-error --fail --location --request PUT \ + --upload-file infrastructure/packages/`cat infrastructure/PACKAGE_FILE_NAME`.zip \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/content/mull-project/macos/mull/${{ steps.version.outputs.version }}/`cat infrastructure/PACKAGE_FILE_NAME`.zip;publish=1" diff --git a/.github/workflows/release-ubuntu-16.yaml b/.github/workflows/release-ubuntu-16.yaml new file mode 100644 index 000000000..2907f7949 --- /dev/null +++ b/.github/workflows/release-ubuntu-16.yaml @@ -0,0 +1,51 @@ +name: Release Ubuntu 16.04 + +on: + release: + types: + - created + +jobs: + test: + name: Release Ubuntu Package + runs-on: ubuntu-latest + container: ubuntu:16.04 + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Detect Mull version + id: version + run: | + if [ `echo $GITHUB_REF | awk -F/ ' { print $3 } '` != `grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '` ]; + then + false + fi + echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '` + - name: Install software + run: | + apt-get update && apt-get install -y python-pip curl + pip install ansible + - name: Run CI task + run: | + cd infrastructure && \ + ansible-playbook ubuntu-playbook.yaml \ + -e llvm_version="8.0.0" \ + -e source_dir=$PWD/.. \ + -e gitref=$GITHUB_SHA \ + -e host=localhost \ + -e mull_version=${{ steps.version.outputs.version }} \ + --verbose + - name: Publish package + run: | + curl --silent --show-error --location --request DELETE \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/packages/mull-project/ubuntu-16/mull/versions/${{ steps.version.outputs.version }}" + curl --silent --show-error --fail --location --request PUT \ + --upload-file infrastructure/packages/`cat infrastructure/PACKAGE_FILE_NAME`.deb \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + -H "X-Bintray-Debian-Distribution: nightly" \ + -H "X-Bintray-Debian-Component: main" \ + -H "X-Bintray-Debian-Architecture: amd64" \ + "https://api.bintray.com/content/mull-project/ubuntu-16/mull/${{ steps.version.outputs.version }}/pool/main/m/`cat infrastructure/PACKAGE_FILE_NAME`.deb;publish=1" \ No newline at end of file diff --git a/.github/workflows/release-ubuntu-18.yaml b/.github/workflows/release-ubuntu-18.yaml new file mode 100644 index 000000000..fea2e46d0 --- /dev/null +++ b/.github/workflows/release-ubuntu-18.yaml @@ -0,0 +1,51 @@ +name: Release Ubuntu 18.04 + +on: + release: + types: + - created + +jobs: + test: + name: Release Ubuntu Package + runs-on: ubuntu-latest + container: ubuntu:18.04 + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Detect Mull version + id: version + run: | + if [ `echo $GITHUB_REF | awk -F/ ' { print $3 } '` != `grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '` ]; + then + false + fi + echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '` + - name: Install software + run: | + apt-get update && apt-get install -y python-pip curl + pip install ansible + - name: Run CI task + run: | + cd infrastructure && \ + ansible-playbook ubuntu-playbook.yaml \ + -e llvm_version="9.0.0" \ + -e source_dir=$PWD/.. \ + -e gitref=$GITHUB_SHA \ + -e host=localhost \ + -e mull_version=${{ steps.version.outputs.version }} \ + --verbose + - name: Publish package + run: | + curl --silent --show-error --location --request DELETE \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + "https://api.bintray.com/packages/mull-project/ubuntu-18/mull/versions/${{ steps.version.outputs.version }}" + curl --silent --show-error --fail --location --request PUT \ + --upload-file infrastructure/packages/`cat infrastructure/PACKAGE_FILE_NAME`.deb \ + --user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \ + -H "X-Bintray-Debian-Distribution: nightly" \ + -H "X-Bintray-Debian-Component: main" \ + -H "X-Bintray-Debian-Architecture: amd64" \ + "https://api.bintray.com/content/mull-project/ubuntu-18/mull/${{ steps.version.outputs.version }}/pool/main/m/`cat infrastructure/PACKAGE_FILE_NAME`.deb;publish=1" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c7383a845..33586c2f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.7.0) +if (NOT MULL_VERSION) set (MULL_VERSION 0.6.1) +endif() project(Mull VERSION ${MULL_VERSION} diff --git a/cmake/cpack.cmake b/cmake/cpack.cmake index 57961c0ca..365830657 100644 --- a/cmake/cpack.cmake +++ b/cmake/cpack.cmake @@ -56,7 +56,7 @@ else() endif() if (${CPACK_SYSTEM_NAME} STREQUAL "macOS") - include(cmake/packaging/cpack.PKG-macOS.cmake) + include(cmake/packaging/cpack.ZIP-macOS.cmake) elseif (${CPACK_SYSTEM_NAME} STREQUAL "debian") include(cmake/packaging/cpack.DEB-debian.cmake) elseif(${CPACK_SYSTEM_NAME} STREQUAL "ubuntu") diff --git a/cmake/packaging/cpack.DEB-ubuntu.cmake b/cmake/packaging/cpack.DEB-ubuntu.cmake index 5c9bfce88..e1c4172c6 100644 --- a/cmake/packaging/cpack.DEB-ubuntu.cmake +++ b/cmake/packaging/cpack.DEB-ubuntu.cmake @@ -3,4 +3,4 @@ set (CPACK_GENERATOR DEB) set (CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) set (CPACK_DEBIAN_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION}) -set (CPACK_DEBIAN_PACKAGE_DEPENDS "libz-dev, libsqlite3-dev, ncurses-dev, libstdc++6, libxml2-dev, uuid-dev") +set (CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g, libncurses5, libstdc++6, libxml2, libsqlite3-0") diff --git a/cmake/packaging/cpack.ZIP-macOS.cmake b/cmake/packaging/cpack.ZIP-macOS.cmake new file mode 100644 index 000000000..11d85c37a --- /dev/null +++ b/cmake/packaging/cpack.ZIP-macOS.cmake @@ -0,0 +1 @@ +set (CPACK_GENERATOR "ZIP") diff --git a/infrastructure/helpers/build-mull.yaml b/infrastructure/helpers/build-mull.yaml index b22c9791f..8ea9fe590 100644 --- a/infrastructure/helpers/build-mull.yaml +++ b/infrastructure/helpers/build-mull.yaml @@ -38,7 +38,7 @@ state: directory - name: Prepare Build System (Release) - command: cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DPATH_TO_LLVM={{ llvm_dir }} -DCMAKE_CXX_FLAGS="{{ mull_cxx_flags }}" {{ source_dir }} + command: cmake -G Ninja -DMULL_VERSION={{ mull_version }} -DCMAKE_BUILD_TYPE=Release -DPATH_TO_LLVM={{ llvm_dir }} -DCMAKE_CXX_FLAGS="{{ mull_cxx_flags }}" {{ source_dir }} args: chdir: "{{ release_build_dir }}" creates: "{{ release_build_dir }}/CMakeCache.txt" @@ -70,14 +70,12 @@ args: chdir: "{{ release_build_dir }}" become: true - when: not skip_package - name: Copy package file name fetch: src: "{{ release_build_dir }}/PACKAGE_FILE_NAME" dest: PACKAGE_FILE_NAME flat: true - when: not skip_package - name: Copy package to the local machine fetch: @@ -85,10 +83,8 @@ dest: "packages/{{ lookup('file', 'PACKAGE_FILE_NAME') }}.{{ item }}" flat: true with_items: "{{ package_extensions }}" - when: not skip_package - name: Print Mull version command: mull-cxx -version args: - chdir: "{{ release_build_dir }}" - + chdir: "{{ release_build_dir }}" \ No newline at end of file diff --git a/infrastructure/macos-playbook.yaml b/infrastructure/macos-playbook.yaml index c6792e1fb..c913aad7a 100644 --- a/infrastructure/macos-playbook.yaml +++ b/infrastructure/macos-playbook.yaml @@ -11,7 +11,7 @@ package_maker_path: PackageMaker.app package_extensions: - - dmg + - zip mull_cxx_flags: "" @@ -65,4 +65,3 @@ - name: Integration Tests include: helpers/integration-tests.yaml - diff --git a/tests-lit/tests/tutorials/hello-world/step-1-version/sample.cpp b/tests-lit/tests/tutorials/hello-world/step-1-version/sample.cpp index e5cc1f05c..9ecc94e7b 100644 --- a/tests-lit/tests/tutorials/hello-world/step-1-version/sample.cpp +++ b/tests-lit/tests/tutorials/hello-world/step-1-version/sample.cpp @@ -2,7 +2,7 @@ ; RUN: %MULL_EXEC -version 2>&1 | %FILECHECK_EXEC %s --strict-whitespace --match-full-lines ; CHECK:Mull: LLVM-based mutation testing ; CHECK:https://github.com/mull-project/mull -; CHECK:{{^Version: \d+\.\d+.\d+$}} +; CHECK:{{^Version: \d+\.\d+.\d+.?\d*$}} ; CHECK:{{^Commit: [a-h0-9]+$}} ; CHECK:{{^Date: .*$}} ; CHECK:{{^LLVM: \d+\.\d+.\d+$}}