Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from tarosky/dev/harai
Browse files Browse the repository at this point in the history
Build using GitHub Actions
  • Loading branch information
harai authored Sep 30, 2020
2 parents 2e8933a + d8be192 commit d610986
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
pull_request:
branches:
- master
push:
branches:
- master
- issue/*

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
# Pre-installed packages break the environment required to build BCC.
# That's why I decided to use Docker inside GitHub Actions.
- run: docker image build -f=build/Dockerfile -t box:latest .
- run: docker container run --rm --mount type=bind,source="$(pwd)",target=/workspace box:latest go build -o work/nudge .
- uses: actions/upload-artifact@v2
with:
name: artifact
path: work/nudge

release:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
- name: Generate build number
uses: einaregilsson/build-number@v2
with:
token: ${{secrets.GITHUB_TOKEN}}
prefix: build_number_generator
- name: Print new build number
run: echo "Build number is $BUILD_NUMBER"
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: build-${{env.BUILD_NUMBER}}
release_name: Build ${{env.BUILD_NUMBER}}
draft: false
prerelease: false
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ./nudge
asset_name: nudge.build-${{env.BUILD_NUMBER}}-linux-amd64
asset_content_type: application/octet-stream
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

53 changes: 53 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ubuntu:20.04

ARG BCC_VERSION=0.16.0
ARG GO_VERSION=1.15.2

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
arping \
bison \
build-essential \
cmake \
flex \
git \
iperf3 \
libclang-9-dev \
libedit-dev \
libelf-dev \
libllvm9 \
llvm-9-dev \
netperf \
python3 \
python3-distutils \
zlib1g-dev

RUN cd /var/tmp && git clone -b v${BCC_VERSION} https://github.com/iovisor/bcc.git
RUN mkdir -p /var/tmp/bcc/build && cd /var/tmp/bcc/build

RUN update-alternatives --install /usr/local/bin/python python /usr/bin/python3.8 1

WORKDIR /var/tmp/bcc/build

RUN cmake ..
RUN make
RUN make install

# build python3 binding
RUN cmake -DPYTHON_CMD=python3 ..

WORKDIR /var/tmp/bcc/build/src/python

RUN make
RUN make install

RUN mkdir -p /var/tmp/go
WORKDIR /var/tmp/go
RUN apt-get install -y curl

RUN curl -sSfL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz
ENV PATH $PATH:/usr/local/go/bin

RUN mkdir /workspace
WORKDIR /workspace
Empty file added script
Empty file.
2 changes: 2 additions & 0 deletions work/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit d610986

Please sign in to comment.