浏览代码

ci: add use of github actions

now that travis has ditched it's free service.
Lyndon Brown 4 年之前
父节点
当前提交
6f1bf7dd07
共有 3 个文件被更改,包括 100 次插入1 次删除
  1. 98 0
      .github/workflows/test.yml
  2. 1 1
      COMPILING.md
  3. 1 0
      README.md

+ 98 - 0
.github/workflows/test.yml

@@ -0,0 +1,98 @@
+# Note, this is used in the badge URL!
+name: test
+
+on:
+  push:
+    branches: [master, dev]
+  pull_request:
+    branches: [master, dev]
+
+jobs:
+  fmt:
+    name: 'Rust: format check'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        # Only run the formatting check for stable
+        include:
+          - os: ubuntu-latest
+            toolchain: stable
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+      - name: Install toolchain
+        uses: actions-rs/toolchain@v1
+        with:
+          # Use default profile to get rustfmt
+          profile: default
+          toolchain: ${{ matrix.toolchain }}
+          override: true
+      - run: cargo fmt --verbose --all -- --check
+
+  test:
+    needs: fmt
+    runs-on: ${{ matrix.os }}
+    continue-on-error: ${{ matrix.experimental }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ubuntu-latest]
+        toolchain:
+          - 1.40.0 # MSRV (Minimum supported rust version)
+          - stable
+          - beta
+        experimental: [false]
+        # Ignore failures in nightly, not ideal, but necessary
+        include:
+          - os: ubuntu-latest
+            toolchain: nightly
+            experimental: true
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+      - name: Install toolchain
+        uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: ${{ matrix.toolchain }}
+          override: true
+      - name: Install developer package dependencies
+        run: sudo apt-get install libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev gstreamer1.0-dev libgstreamer-plugins-base1.0-dev
+      - run: cargo build --locked --no-default-features
+      - run: cargo build --locked --examples
+      - run: cargo build --locked --no-default-features --features "with-tremor"
+      - run: cargo build --locked --no-default-features --features "with-vorbis"
+      - run: cargo build --locked --no-default-features --features "alsa-backend"
+      - run: cargo build --locked --no-default-features --features "portaudio-backend"
+      - run: cargo build --locked --no-default-features --features "pulseaudio-backend"
+      - run: cargo build --locked --no-default-features --features "jackaudio-backend"
+      - run: cargo build --locked --no-default-features --features "rodio-backend"
+      - run: cargo build --locked --no-default-features --features "sdl-backend"
+      - run: cargo build --locked --no-default-features --features "gstreamer-backend"
+
+  test-cross-arm:
+    needs: fmt
+    runs-on: ${{ matrix.os }}
+    continue-on-error: false
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - os: ubuntu-latest
+            target: armv7-unknown-linux-gnueabihf
+            toolchain: stable
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+      - name: Install toolchain
+        uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          target: ${{ matrix.target }}
+          toolchain: ${{ matrix.toolchain }}
+          override: true
+      - name: Install cross
+        run: cargo install cross || true
+      - name: Build
+        run: cross build --locked --target ${{ matrix.target }} --no-default-features

+ 1 - 1
COMPILING.md

@@ -13,7 +13,7 @@ curl https://sh.rustup.rs -sSf | sh
 
 
 Follow any prompts it gives you to install Rust. Once that’s done, Rust's standard tools should be setup and ready to use.
 Follow any prompts it gives you to install Rust. Once that’s done, Rust's standard tools should be setup and ready to use.
 
 
-*Note: The current minimum required Rust version at the time of writing is 1.40.0, you can find the current minimum version specified in the `.travis.yml` file.*
+*Note: The current minimum required Rust version at the time of writing is 1.40.0, you can find the current minimum version specified in the `.github/workflow/test.yml` file.*
 
 
 #### Additional Rust tools - `rustfmt`
 #### Additional Rust tools - `rustfmt`
 To ensure a consistent codebase, we utilise [`rustfmt`](https://github.com/rust-lang/rustfmt), which is installed by default with `rustup` these days, else it can be installed manually with:
 To ensure a consistent codebase, we utilise [`rustfmt`](https://github.com/rust-lang/rustfmt), which is installed by default with `rustup` these days, else it can be installed manually with:

+ 1 - 0
README.md

@@ -1,3 +1,4 @@
+[![Build Status](https://img.shields.io/github/workflow/status/librespot-org/librespot/test/dev)](https://github.com/librespot-org/librespot/actions)
 [![Build Status](https://travis-ci.org/librespot-org/librespot.svg?branch=dev)](https://travis-ci.org/librespot-org/librespot)
 [![Build Status](https://travis-ci.org/librespot-org/librespot.svg?branch=dev)](https://travis-ci.org/librespot-org/librespot)
 [![Gitter chat](https://badges.gitter.im/librespot-org/librespot.png)](https://gitter.im/librespot-org/spotify-connect-resources)
 [![Gitter chat](https://badges.gitter.im/librespot-org/librespot.png)](https://gitter.im/librespot-org/spotify-connect-resources)
 [![Crates.io](https://img.shields.io/crates/v/librespot.svg)](https://crates.io/crates/librespot)
 [![Crates.io](https://img.shields.io/crates/v/librespot.svg)](https://crates.io/crates/librespot)