Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CI to github actions #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Cross compile other architectures

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
#arch: [arm-unknown-linux-gnueabihf, armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu, i686-unknown-linux-gnu]
arch: [aarch64-unknown-linux-gnu]

steps:
- uses: actions/checkout@v2
- name: prepare build container
uses: actions-rs/cargo@v1
run: ci/setup-cross.sh ${{ matrix.arch }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.arch }}
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target ${{ matrix.arch }}
27 changes: 27 additions & 0 deletions .github/workflows/reprotest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test reproducible builds

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Update apt index
run: sudo apt update

- name: Install reprotest
run: sudo apt install reprotest libpcap-dev libseccomp-dev

- name: Install diffoscope
run: sudo apt install --no-install-recommends diffoscope

- name: Run reprotest
run: ci/reprotest.sh
10 changes: 0 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ matrix:
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-gnu BUILD_MODE=boxxy
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-gnu BUILD_MODE=reprotest
## broken on 1.26.0
#- os: linux
# rust: stable
# env: TARGET=aarch64-unknown-linux-gnu BUILD_MODE=cross
- os: linux
rust: stable
env: TARGET=i686-unknown-linux-gnu BUILD_MODE=cross

before_install:
- sudo ci/setup.sh "$TRAVIS_OS_NAME"
Expand Down
7 changes: 0 additions & 7 deletions ci/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions ci/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/bin/sh
set -ex

case "$TARGET" in
aarch64-unknown-linux-gnu)
export RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc-6"
;;
esac

case "$BUILD_MODE" in
release)
cargo build --verbose --release --target="$TARGET"
Expand All @@ -16,12 +10,4 @@ case "$BUILD_MODE" in
boxxy)
cargo build --verbose --examples
;;
reprotest)
docker build -t reprotest-sniffglue -f docs/Dockerfile.reprotest .
;;
cross)
docker build --build-arg TARGET="$TARGET" -t "sniffglue-test-$TARGET" -f ci/Dockerfile .
# restart this script but inside the container and without BUILD_MODE=cross
docker run -e TARGET="$TARGET" "sniffglue-test-$TARGET" ci/build.sh
;;
esac
32 changes: 32 additions & 0 deletions ci/setup-cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
set -xe

case "$1" in
arm-*)
ARCH=arm64
;;
armv7-*)
ARCH=arm64
;;
aarch64-*)
ARCH=arm64
;;
i686-*)
ARCH=i386
;;
*)
echo 'ERROR: unknown arch'
exit 1
;;
esac

CROSS=`cross -V | sed -nr 's/cross (.*)/\1/p'`

cat > Dockerfile.cross <<EOF
FROM rustembedded/cross:$1-$CROSS
RUN dpkg --add-architecture $ARCH && \
apt-get update && \
apt-get install libpcap-dev:$ARCH libseccomp-dev:$ARCH
EOF

docker build -t "rustembedded/cross:$1-$CROSS" Dockerfile.cross
39 changes: 3 additions & 36 deletions ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,15 @@ set -ex

case "$1" in
linux)
if [ -z "$TRAVIS" ]; then
case "$TARGET" in
aarch64-unknown-linux-gnu)
dpkg --add-architecture arm64
;;
i686-unknown-linux-gnu)
dpkg --add-architecture i386
;;
esac
fi

apt-get -q update

if [ -n "$TRAVIS" ]; then
# update docker
apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
fi

case "$TARGET" in
x86_64-unknown-linux-gnu)
apt-get install -qy \
libpcap-dev \
libseccomp-dev
;;
aarch64-unknown-linux-gnu)
if [ -z "$TRAVIS" ]; then
apt-get install -qy gcc-6-aarch64-linux-gnu \
libpcap0.8-dev:arm64 \
libseccomp-dev:arm64
fi
;;
i686-unknown-linux-gnu)
if [ -z "$TRAVIS" ]; then
apt-get install -qy gcc-multilib \
libpcap0.8-dev:i386 \
libseccomp-dev:i386
fi
;;
*)
echo "UNKNOWN TARGET: $TARGET"
exit 1
;;
esac
apt-get install -qy \
libpcap-dev \
libseccomp-dev
;;
esac
6 changes: 0 additions & 6 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ case "$BUILD_MODE" in
exit 1
fi
;;
reprotest)
docker run --privileged reprotest-sniffglue ci/reprotest.sh || true
;;
cross)
# do not execute tests when cross compiling
;;
esac
11 changes: 0 additions & 11 deletions docs/Dockerfile.reprotest

This file was deleted.