Skip to content

Commit

Permalink
Merge pull request #334 from l3laze/auto-build
Browse files Browse the repository at this point in the history
Prebuilt releases
  • Loading branch information
SimonKagstrom committed Aug 24, 2020
2 parents 6c310f3 + c481faa commit c18c775
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/generic-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

set -euo pipefail

run () {
apt-get update
apt-mark hold php* google* libobjc* libpq* libidn* postgresql* python-samba python3-httplib2 samba* >/dev/null
apt-get upgrade -y
apt-get install -y binutils-dev libcurl4-openssl-dev libdw-dev libiberty-dev gcc g++ make cmake libssl-dev git python python3
export PATH="${PATH}:${HOME}/kcov/bin"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. || exit 64
make || exit 64
make install || exit 64
cd ..
tar czf kcov-"$1".tar.gz /usr/local/bin/kcov* /usr/local/share/doc/kcov/* /usr/local/share/man/man1/kcov.1
readelf -h /usr/local/bin/kcov
if [[ -e "kcov-$1.tar.gz" ]]; then
echo "Built for $1".
fi

chmod u+x .github/workflows/test-executable.sh
kcov --include-path=.github/workflows/test-executable.sh coverage .github/workflows/test-executable.sh

local coverage="$(<coverage/test*.sh*/coverage.json)"
local percent="${coverage##*percent_covered\": \"}"
local total_lines="${coverage##*total_lines\": }"
local covered_lines="${coverage##*covered_lines\": }"

echo -e "Coverage: ${covered_lines%%,*}/${total_lines%%,*} ${percent%%\"*}%"
}

run "$@"
58 changes: 58 additions & 0 deletions .github/workflows/ghactions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI
on:
push:
tags:
- "*"

jobs:
build:
name: Build executable
runs-on: ubuntu-latest
strategy:
matrix:
arch: [i386, amd64, armv7, aarch64, ppc64le]

steps:
- uses: actions/checkout@v2

- name: Prepare
run: chmod u+x .github/workflows/generic-build.sh

- name: Build for matrix.arch == amd64
if: ${{ matrix.arch == 'amd64' }}
run: sudo .github/workflows/generic-build.sh ${{ matrix.arch }}

- name: Build for matrix.arch == i386
if: ${{ matrix.arch == 'i386' }}
run: |
chmod u+x ./.github/workflows/setup-i386.sh
sudo .github/workflows/setup-i386.sh
sudo schroot -c mychroot -- ./.github/workflows/generic-build.sh ${{ matrix.arch }}
- name: Build for matrix.arch == armv7, aarch64, ppc64le
if: ${{ matrix.arch == 'armv7' || matrix.arch == 'aarch64' || matrix.arch == 'ppc64le' }}
uses: uraimo/run-on-arch-action@v1.0.9
with:
architecture: ${{ matrix.arch }}
distribution: ubuntu18.04
run: .github/workflows/generic-build.sh ${{ matrix.arch }}

- uses: actions/upload-artifact@v2
with:
name: kcov-${{ matrix.arch }}.tar.gz
path: kcov-${{ matrix.arch }}.tar.gz

create_release:
name: Create release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2

- name: Create release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: kcov-*/kcov-*.tar.gz
artifactContentType: application/gzip
token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/setup-i386.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

apt-get update
apt-get install schroot debootstrap
install -d /chroots/i386

printf "[mychroot]
type=directory
description=An i386 chroot for building kcov.
directory=/chroots/i386
users=$(whoami)
root-groups=root
preserve-environment=true
personality=linux32" >> /etc/schroot/schroot.conf

debootstrap --variant=buildd --arch i386 bionic /chroots/i386 http://archive.ubuntu.com/ubuntu/
5 changes: 5 additions & 0 deletions .github/workflows/test-executable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

if [[ true ]]; then
echo "Hello, kcov!"
fi
1 change: 0 additions & 1 deletion README

This file was deleted.

1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md

0 comments on commit c18c775

Please sign in to comment.