enable GitHub Actions

This commit is contained in:
Jorge Aparicio 2021-05-15 20:45:41 +02:00
parent 552d5b941e
commit 29042a6af2
4 changed files with 74 additions and 102 deletions

74
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,74 @@
on:
push:
branches: [master]
pull_request:
branches: [master]
name: Continuous integration
jobs:
test :
name: Test Suite
strategy:
matrix:
target:
# Linux
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- i686-unknown-linux-gnu
- mips-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- mipsel-unknown-linux-gnu
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
# *BSD
- x86_64-unknown-freebsd
os:
- ubuntu-latest
include:
# macOS
- target: x86_64-apple-darwin
os: macOS-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: ${{ matrix.target }}
override: true
# omit tests
- uses: actions-rs/cargo@v1
if: matrix.target == '*bsd*'
with:
use-cross: true
command: check
args: --target ${{ matrix.target }}
- uses: actions-rs/cargo@v1
if: matrix.target != '*bsd*'
with:
use-cross: true
command: test
args: --target ${{ matrix.target }}
- uses: actions-rs/cargo@v1
if: matrix.target != '*bsd*'
with:
use-cross: true
command: run
args: --target ${{ matrix.target }} --release --example hello
- uses: actions-rs/cargo@v1
if: matrix.target != '*bsd*'
with:
use-cross: true
command: test
args: --target ${{ matrix.target }} --release

View file

@ -1,60 +0,0 @@
dist: trusty
language: rust
services: docker
sudo: required
rust: nightly
env: TARGET=x86_64-unknown-linux-gnu
matrix:
include:
# Linux
- env: TARGET=i686-unknown-linux-gnu
# - env: TARGET=x86_64-unknown-linux-gnu # this is the default job
# OSX
# - env: TARGET=i686-apple-darwin
# os: osx
- env: TARGET=x86_64-apple-darwin
os: osx
# *BSD
# - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
# - env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
# Other architectures
- env: TARGET=aarch64-unknown-linux-gnu
- env: TARGET=armv7-unknown-linux-gnueabihf
- env: TARGET=mips-unknown-linux-gnu
- env: TARGET=mips64-unknown-linux-gnuabi64
- env: TARGET=mips64el-unknown-linux-gnuabi64
- env: TARGET=mipsel-unknown-linux-gnu
- env: TARGET=powerpc-unknown-linux-gnu
- env: TARGET=powerpc64-unknown-linux-gnu
- env: TARGET=powerpc64le-unknown-linux-gnu
# - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1
before_install: set -e
install:
- sh ci/install.sh
- source ~/.cargo/env || true
script:
- bash ci/script.sh
after_script: set +e
cache: cargo
before_cache:
- chmod -R a+r $HOME/.cargo
branches:
only:
- auto
- try
notifications:
email:
on_success: never

View file

@ -1,22 +0,0 @@
set -ex
main() {
curl https://sh.rustup.rs -sSf | \
sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION
local target=
if [ $TRAVIS_OS_NAME = linux ]; then
target=x86_64-unknown-linux-gnu
else
target=x86_64-apple-darwin
fi
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- \
--force \
--git japaric/cross \
--tag v0.1.4 \
--target $target
}
main

View file

@ -1,20 +0,0 @@
set -ex
main() {
cross build --target $TARGET
cross build --target $TARGET --release
if [ ! -z $DISABLE_TESTS ]; then
return
fi
cross test --target $TARGET
cross test --target $TARGET --release
cross run --target $TARGET --example hello
cross run --target $TARGET --release --example hello
}
if [ -z $TRAVIS_TAG ]; then
main
fi