瀏覽代碼

Merge #76

76: switch to Github Actions for CI r=Disasm a=almindor



Co-authored-by: Ales Katona <ales@katona.me>
bors[bot] 3 年之前
父節點
當前提交
b5fcd72f6d

+ 5 - 1
riscv-rt/.github/bors.toml

@@ -1,4 +1,8 @@
 block_labels = ["needs-decision"]
 delete_merged_branches = true
 required_approvals = 1
-status = ["continuous-integration/travis-ci/push"]
+status = [
+    "ci-linux (stable)",
+    "ci-linux (1.42.0)",
+    "Rustfmt"
+]

+ 40 - 0
riscv-rt/.github/workflows/ci.yaml

@@ -0,0 +1,40 @@
+on:
+  push:
+    branches: [ staging, trying, master ]
+  pull_request:
+
+name: Continuous integration
+
+jobs:
+  ci-linux:
+    runs-on: ubuntu-20.04
+    continue-on-error: ${{ matrix.experimental || false }}
+    strategy:
+      matrix:
+        # All generated code should be running on stable now, MRSV is 1.42.0
+        rust: [nightly, stable, 1.42.0]
+
+        include:
+          # Nightly is only for reference and allowed to fail
+          - rust: nightly
+            experimental: true
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: ${{ matrix.rust }}
+          override: true
+      - name: Install all Rust targets for ${{ matrix.rust }}
+        run: rustup target install --toolchain=${{ matrix.rust }} riscv32imac-unknown-none-elf riscv64imac-unknown-none-elf riscv64gc-unknown-none-elf
+      - name: Install riscv gcc
+        run: sudo apt-get update && sudo apt-get install -y gcc-riscv64-unknown-elf
+      - name: Run CI script for riscv32imac-unknown-none-elf under ${{ matrix.rust }}
+        run: TARGET=riscv32imac-unknown-none-elf cargo check
+      - name: Run CI script for riscv64imac-unknown-none-elf under ${{ matrix.rust }}
+        run: TARGET=riscv64imac-unknown-none-elf cargo check
+      - name: Run CI script for riscv64gc-unknown-none-elf under ${{ matrix.rust }}
+        run: TARGET=riscv64gc-unknown-none-elf cargo check
+      - name: Check blobs
+        run: ./check-blobs.sh

+ 24 - 0
riscv-rt/.github/workflows/rustfmt.yaml

@@ -0,0 +1,24 @@
+
+on:
+  push:
+    branches: [ staging, trying, master ]
+  pull_request:
+
+name: Code formatting check
+
+jobs:
+  fmt:
+    name: Rustfmt
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+          components: rustfmt
+      - uses: actions-rs/cargo@v1
+        with:
+          command: fmt
+          args: --all -- --check

+ 0 - 48
riscv-rt/.travis.yml

@@ -1,48 +0,0 @@
-language: rust
-
-rust:
-- nightly
-- stable
-- 1.38.0 # MSRV
-
-env:
-- TARGET=x86_64-unknown-linux-gnu
-- TARGET=riscv32i-unknown-none-elf
-- TARGET=riscv32imac-unknown-none-elf
-- TARGET=riscv64imac-unknown-none-elf
-
-if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master)
-
-matrix:
-  allow_failures:
-    - rust: nightly
-  include:
-    - env: CHECK_BLOBS=1
-      rust:
-      language: bash
-      if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master)
-    - env: RUSTFMT=1
-      rust: stable
-      if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master)
-
-
-install:
-  - ci/install.sh
-
-script:
-  - ci/script.sh
-
-cache:
-  cargo: true
-  directories:
-    - gcc
-
-branches:
-  only:
-    - master
-    - staging
-    - trying
-
-notifications:
-  email:
-    on_success: never

+ 0 - 18
riscv-rt/ci/install.sh

@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-
-set -euxo pipefail
-
-if [ -n "${TARGET:-}" ]; then
-    rustup target add $TARGET
-fi
-
-if [ -n "${CHECK_BLOBS:-}" ]; then
-    if [ ! -d gcc/bin ]; then
-        mkdir -p gcc
-        curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz
-    fi
-fi
-
-if [ -n "${RUSTFMT:-}" ]; then
-    rustup component add rustfmt
-fi

+ 0 - 24
riscv-rt/ci/script.sh

@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-
-set -euxo pipefail
-
-if [ -n "${TARGET:-}" ]; then
-    cargo check --target $TARGET
-
-    if [[ $TARGET == riscv* ]]; then
-        cargo check --target $TARGET --examples
-    fi
-
-    if [ $TRAVIS_RUST_VERSION = nightly ]; then
-        cargo check --target $TARGET --features inline-asm
-    fi
-fi
-
-if [ -n "${CHECK_BLOBS:-}" ]; then
-    PATH="$PATH:$PWD/gcc/bin"
-    ./check-blobs.sh
-fi
-
-if [ -n "${RUSTFMT:-}" ]; then
-    cargo fmt -- --check
-fi

+ 1 - 3
riscv-rt/macros/src/lib.rs

@@ -14,9 +14,7 @@ use rand::Rng;
 use rand::SeedableRng;
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::time::{SystemTime, UNIX_EPOCH};
-use syn::{
-    parse, spanned::Spanned, Ident, ItemFn, ReturnType, Type, Visibility,
-};
+use syn::{parse, spanned::Spanned, Ident, ItemFn, ReturnType, Type, Visibility};
 
 static CALL_COUNT: AtomicUsize = AtomicUsize::new(0);