Merge pull request #29 from japaric/gha

enable GitHub Actions
This commit is contained in:
Jorge Aparicio 2021-05-15 19:31:28 +00:00 committed by GitHub
commit c2927ab3ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 84 additions and 110 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 on BSD
- uses: actions-rs/cargo@v1
if: matrix.target == 'x86_64-unknown-freebsd'
with:
use-cross: true
command: check
args: --target ${{ matrix.target }}
- uses: actions-rs/cargo@v1
if: matrix.target != 'x86_64-unknown-freebsd'
with:
use-cross: true
command: test
args: --target ${{ matrix.target }}
- uses: actions-rs/cargo@v1
if: matrix.target != 'x86_64-unknown-freebsd'
with:
use-cross: true
command: run
args: --target ${{ matrix.target }} --release --example hello
- uses: actions-rs/cargo@v1
if: matrix.target != 'x86_64-unknown-freebsd'
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

2
Cross.toml Normal file
View file

@ -0,0 +1,2 @@
[target.powerpc64-unknown-linux-gnu]
image = 'rustembedded/cross:powerpc64-unknown-linux-gnu-0.2.0'

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

View file

@ -14,7 +14,7 @@ pub mod nr;
#[inline(always)]
pub unsafe fn syscall0(n: usize) -> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n)
: "memory" "cc"
@ -25,7 +25,7 @@ pub unsafe fn syscall0(n: usize) -> usize {
#[inline(always)]
pub unsafe fn syscall1(n: usize, a1: usize) -> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1)
: "memory" "cc"
@ -36,7 +36,7 @@ pub unsafe fn syscall1(n: usize, a1: usize) -> usize {
#[inline(always)]
pub unsafe fn syscall2(n: usize, a1: usize, a2: usize) -> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1) "{r1}"(a2)
: "memory" "cc"
@ -47,7 +47,7 @@ pub unsafe fn syscall2(n: usize, a1: usize, a2: usize) -> usize {
#[inline(always)]
pub unsafe fn syscall3(n: usize, a1: usize, a2: usize, a3: usize) -> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1) "{r1}"(a2) "{r2}"(a3)
: "memory" "cc"
@ -63,7 +63,7 @@ pub unsafe fn syscall4(n: usize,
a4: usize)
-> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1) "{r1}"(a2) "{r2}"(a3) "{r3}"(a4)
: "memory" "cc"
@ -80,7 +80,7 @@ pub unsafe fn syscall5(n: usize,
a5: usize)
-> usize {
let ret: usize;
llvm_asm!("swi $$0" : "={r0}"(ret)
llvm_asm!("swi 0" : "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1) "{r1}"(a2) "{r2}"(a3) "{r3}"(a4) "{r4}"(a5)
: "memory" "cc"
: "volatile");
@ -97,7 +97,7 @@ pub unsafe fn syscall6(n: usize,
a6: usize)
-> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1) "{r1}"(a2) "{r2}"(a3) "{r3}"(a4) "{r4}"(a5)
"{r5}"(a6)
@ -117,7 +117,7 @@ pub unsafe fn syscall7(n: usize,
a7: usize)
-> usize {
let ret: usize;
llvm_asm!("swi $$0"
llvm_asm!("swi 0"
: "={r0}"(ret)
: "{r7}"(n) "{r0}"(a1) "{r1}"(a2) "{r2}"(a3) "{r3}"(a4) "{r4}"(a5)
"{r5}"(a6) "{r6}"(a7)