diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml new file mode 100644 index 0000000..9031dab --- /dev/null +++ b/.github/workflows/cross.yml @@ -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 }} diff --git a/.github/workflows/reprotest.yml b/.github/workflows/reprotest.yml new file mode 100644 index 0000000..e20ab9c --- /dev/null +++ b/.github/workflows/reprotest.yml @@ -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 diff --git a/.travis.yml b/.travis.yml index 44b35e8..b8870e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/ci/Dockerfile b/ci/Dockerfile deleted file mode 100644 index 3cae7b1..0000000 --- a/ci/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM rust:latest -ARG TARGET -WORKDIR /app -COPY . . -RUN rustup install "stable-$TARGET" \ - && rustup target add "$TARGET" -RUN ci/setup.sh linux diff --git a/ci/build.sh b/ci/build.sh index 43775a4..29cca01 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -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" @@ -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 diff --git a/ci/setup-cross.sh b/ci/setup-cross.sh new file mode 100755 index 0000000..1f8d185 --- /dev/null +++ b/ci/setup-cross.sh @@ -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 <