Skip to content

Commit

Permalink
Automatically deploy packages to bintray
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDenisov committed Mar 12, 2020
1 parent dabce5e commit 23bb50d
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 37 deletions.
93 changes: 65 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,76 @@ jobs:
test:
name: LLVM ${{ matrix.LLVM_VERSION }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
container:
image: ubuntu:bionic64
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]
# LLVM_VERSION: ["3.9", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0"]
# os: [ubuntu-18.04, macOS-10.15]
LLVM_VERSION: ["9.0"]
os: [ubuntu-18.04]

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Run macOS
if: matrix.os == 'macOS-10.15'
- name: Detect Mull version
id: version
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
cat /etc/or-release
# sudo apt-get update
# sudo apt-get install -y --allow-downgrades libstdc++6=8.3.0-26ubuntu1~18.04 libstdc++-6-dev
# clang++-9 main.cpp -v
# grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '
# echo $GITHUB_REF | awk -F/ ' { print $3 } '
# echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '`.`echo $GITHUB_REF | awk -F/ ' { print $3 } '`
# - 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 }}.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: Run Ubuntu
# if: matrix.os == 'ubuntu-18.04'
# run: |
# sudo apt-get update
# sudo apt-get install -y --allow-downgrades libstdc++6=8.3.0-26ubuntu1~18.04
# sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
# 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 (Ubuntu)
# if: matrix.os == 'ubuntu-18.04' && 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/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/mull-nightly/${{ steps.version.outputs.version }}/pool/main/m/`cat infrastructure/PACKAGE_FILE_NAME`.deb;publish=1"
# - name: Publish package (macOS)
# if: matrix.os == 'macOS-10.15' && 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"
67 changes: 67 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

on: [release]

jobs:
test:
name: LLVM ${{ matrix.LLVM_VERSION }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macOS-10.15]
LLVM_VERSION: [ "9.0" ]

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Detect Mull version
id: version
run: |
grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '
echo ::set-output name=version::`grep -Eo "MULL_VERSION [0-9.]+" CMakeLists.txt | awk ' { print $2 } '`
- 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 }}.0" \
-e source_dir=$PWD/.. \
-e gitref=$GITHUB_SHA \
-e host=localhost \
-e SDKROOT=`xcrun -show-sdk-path` \
--verbose
- name: Run Ubuntu
if: matrix.os == 'ubuntu-18.04'
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 \
--verbose
- name: Publish package (Ubuntu)
if: matrix.os == 'ubuntu-18.04'
run: |
curl --silent --show-error --location --request DELETE \
--user "alexdenisov:${{ secrets.BINTRAY_API_KEY }}" \
"https://api.bintray.com/packages/mull-project/ubuntu/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/mull/${{ steps.version.outputs.version }}/pool/main/m/`cat infrastructure/PACKAGE_FILE_NAME`.deb;publish=1"
- name: Publish package (macOS)
if: matrix.os == 'macOS-10.15'
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"
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
2 changes: 1 addition & 1 deletion cmake/cpack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions cmake/packaging/cpack.ZIP-macOS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set (CPACK_GENERATOR "ZIP")
8 changes: 2 additions & 6 deletions infrastructure/helpers/build-mull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -70,25 +70,21 @@
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:
src: "{{ release_build_dir }}/{{ lookup('file', 'PACKAGE_FILE_NAME') }}.{{ item }}"
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 }}"
3 changes: 1 addition & 2 deletions infrastructure/macos-playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package_maker_path: PackageMaker.app

package_extensions:
- dmg
- zip

mull_cxx_flags: ""

Expand Down Expand Up @@ -65,4 +65,3 @@

- name: Integration Tests
include: helpers/integration-tests.yaml

6 changes: 6 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>

int main() {
std::cout << "Hello, world" << "\n";
return 0;
}

0 comments on commit 23bb50d

Please sign in to comment.