Skip to content

Commit

Permalink
Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dswd committed Apr 17, 2020
1 parent fd45da4 commit 45fa0bf
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 19 deletions.
20 changes: 20 additions & 0 deletions .github/actions/build-deb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:16.04

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf \
libc6-dev-arm64-cross \
libc6-dev-armhf-cross \
libc6-dev-i386 \
gcc-5-multilib \
ruby-ronn \
&& rm -rf /var/cache/dpkg

RUN ln -s asm-generic/ /usr/include/asm

ADD entrypoint.sh /entrypoint.sh

ENTRYPOINT /entrypoint.sh
11 changes: 11 additions & 0 deletions .github/actions/build-deb/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'build-deb'
description: 'Create deb packages'
inputs:
rust:
description: Rust version
default: 'stable'
runs:
using: 'docker'
image: 'Dockerfile'
env:
RUST: ${{ inputs.rust }}
33 changes: 33 additions & 0 deletions .github/actions/build-deb/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -e

curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST}
source $HOME/.cargo/env

rustup target add i686-unknown-linux-gnu
rustup target add armv7-unknown-linux-gnueabihf
rustup target add aarch64-unknown-linux-gnu

cargo install cargo-deb

VERSION=$(grep -e '^version =' Cargo.toml | sed -e 's/version = "\(.*\)"/\1/')

mkdir dist

cargo deb
cp target/debian/vpncloud_${VERSION}_amd64.deb dist/vpncloud_${VERSION}_amd64.deb

# i386 deb
cargo deb --target i686-unknown-linux-gnu
cp target/i686-unknown-linux-gnu/debian/vpncloud_${VERSION}_i386.deb dist/vpncloud_${VERSION}_i386.deb

# arm7hf deb
cargo deb --target armv7-unknown-linux-gnueabihf
cp target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${VERSION}_armhf.deb dist/vpncloud_${VERSION}_armhf.deb

# aarch64 deb
cargo deb --target aarch64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/debian/vpncloud_${VERSION}_arm64.deb dist/vpncloud_${VERSION}_arm64.deb


10 changes: 10 additions & 0 deletions .github/actions/build-rpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM centos:7

RUN yum groupinstall -y 'Development Tools'

RUN yum-config-manager --add-repo http://springdale.math.ias.edu/data/puias/computational/7/x86_64 \
&& yum install --nogpgcheck -y rubygem-ronn

ADD entrypoint.sh /entrypoint.sh

ENTRYPOINT /entrypoint.sh
11 changes: 11 additions & 0 deletions .github/actions/build-rpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'build-deb'
description: 'Create deb packages'
inputs:
rust:
description: Rust version
default: 'stable'
runs:
using: 'docker'
image: 'Dockerfile'
env:
RUST: ${{ inputs.rust }}
19 changes: 19 additions & 0 deletions .github/actions/build-rpm/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST}
source $HOME/.cargo/env

rustup target add i686-unknown-linux-gnu
rustup target add armv7-unknown-linux-gnueabihf

cargo install cargo-rpm

VERSION=$(grep -e '^version =' Cargo.toml | sed -e 's/version = "\(.*\)"/\1/')

mkdir dist

cargo build --release
cargo rpm build
cp target/release/rpmbuild/RPMS/x86_64/vpncloud-${VERSION}-1.x86_64.rpm dist/vpncloud_${VERSION}.x86_64.rpm
12 changes: 12 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
19 changes: 0 additions & 19 deletions .github/workflows/build.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Checks
on: [push]
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
version: '0.9.0'
args: '-o Html -- --test-threads=1'
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: code-coverage-report
path: tarpaulin-report.html
45 changes: 45 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
release:
types: [created]
name: Build packages
jobs:
deb:
name: "Build deb packages"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run builder
uses: ./.github/actions/build-deb
with:
rust: '1.40.0'
- name: Archive artifacts
uses: actions/upload-artifact@v1
with:
name: packages
path: dist
- name: Upload artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'dist/*.deb'
rpm:
name: "Build rpm packages"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run builder
uses: ./.github/actions/build-rpm
with:
rust: '1.40.0'
- name: Archive artifacts
uses: actions/upload-artifact@v1
with:
name: packages
path: dist
- name: Upload artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'dist/*.rpm'

0 comments on commit 45fa0bf

Please sign in to comment.