瀏覽代碼

Merge #79

79: Switch CI to Github Actions r=Disasm a=almindor



Co-authored-by: Ales Katona <ales@katona.me>
bors[bot] 3 年之前
父節點
當前提交
511247ecb3
共有 4 個文件被更改,包括 92 次插入52 次删除
  1. 7 1
      .github/bors.toml
  2. 61 0
      .github/workflows/ci.yaml
  3. 24 0
      .github/workflows/rustfmt.yaml
  4. 0 51
      .travis.yml

+ 7 - 1
.github/bors.toml

@@ -1,4 +1,10 @@
 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)",
+    "build-other (macOS-latest)",
+    "build-other (windows-latest)",
+    "Rustfmt"
+]

+ 61 - 0
.github/workflows/ci.yaml

@@ -0,0 +1,61 @@
+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 }} x86_64-unknown-linux-gnu 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 x86_64-unknown-linux-gnu under ${{ matrix.rust }}
+        run: TARGET=x86_64-unknown-linux-gnu cargo check
+      - 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
+
+  # On macOS and Windows, we at least make sure that the crate builds and links.
+  build-other:
+    strategy:
+      matrix:
+        os:
+          - macOS-latest
+          - windows-latest
+    runs-on: ${{ matrix.os }}
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+      - name: Build crate for host OS
+        run: cargo build

+ 24 - 0
.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 - 51
.travis.yml

@@ -1,51 +0,0 @@
-language: rust
-
-env:
-  - TARGET=x86_64-unknown-linux-gnu
-  - TARGET=riscv32imac-unknown-none-elf
-  - TARGET=riscv64imac-unknown-none-elf
-  - TARGET=riscv64gc-unknown-none-elf
-
-rust:
-  - nightly
-  - stable
-  - 1.42.0 # MSRV
-
-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: CHECK_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