diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23d254e42..2271546fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,15 @@ name: Rust Cast CI on: push: - branches: [ master ] + branches: [ main ] + paths-ignore: + - 'LICENSE' + - '*.md' pull_request: - branches: [ master ] + branches: [ main ] + paths-ignore: + - 'LICENSE' + - '*.md' env: CARGO_TERM_COLOR: always @@ -12,147 +18,43 @@ env: jobs: ci: name: Build (Linux) - runs-on: ubuntu-latest - strategy: - matrix: - rust: [stable, beta, nightly] - steps: - - uses: actions/checkout@v3 - name: Checkout - - - uses: actions-rs/toolchain@v1 - name: Install toolchain - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true - components: rustfmt, clippy - - - uses: actions-rs/cargo@v1 - name: Check format - with: - command: fmt - args: --all -- --check - - - uses: actions-rs/cargo@v1 - name: Clippy - with: - command: clippy - args: -- -D warnings - - - uses: actions-rs/cargo@v1 - name: Build (default features) - with: - command: build - args: --release --examples - - - uses: actions-rs/cargo@v1 - name: Build (thread-safe feature) - with: - command: build - args: --release --examples --features thread_safe - - - uses: actions-rs/cargo@v1 - name: Test (default features) - with: - command: test - - - uses: actions-rs/cargo@v1 - name: Test (thread-safe feature) - with: - command: test - args: --features thread_safe - ci-osx: - name: Build (MacOS) - runs-on: macos-latest strategy: matrix: - rust: [ stable, beta, nightly ] - steps: - - uses: actions/checkout@v3 - name: Checkout + rust: [stable] + os: [ubuntu-latest, macos-latest] - - uses: actions-rs/toolchain@v1 - name: Install toolchain - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true + runs-on: ${{ matrix.os }} - - uses: actions-rs/cargo@v1 - name: Build (default features) - with: - command: build - args: --release --examples - - - uses: actions-rs/cargo@v1 - name: Build (thread-safe feature) - with: - command: build - args: --release --examples --features thread_safe - - ci-osx-arm: - if: ${{ false }} - runs-on: macos-latest - strategy: - matrix: - rust: [stable, beta, nightly] - target: [aarch64-unknown-linux-gnu] steps: - uses: actions/checkout@v3 name: Checkout - - uses: actions-rs/toolchain@v1 - name: Install toolchain - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true + # Always install nightly toolchain for `Rustfmt`. + - name: Install toolchain ${{ matrix.rust }} + run: | + rustup toolchain install ${{ matrix.rust }} nightly + rustup override set ${{ matrix.rust }} + rustup component add clippy + rustup component add --toolchain nightly rustfmt - - uses: actions-rs/cargo@v1 - name: Build (default features) - with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} --examples + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - name: Build (thread-safe feature) - with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} --examples --features thread_safe + - name: Check format + run: cargo +nightly fmt --all -- --check - ci-build-docs: - name: GitHub Pages - runs-on: ubuntu-latest + - name: Clippy + run: cargo clippy --all-targets -- -D warnings - steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Build (default features) + run: cargo build --release --examples - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - components: rustfmt, rust-src + - name: Build (thread-safe feature) + run: cargo build --release --examples --features thread_safe - - name: Build documentation - uses: actions-rs/cargo@v1 - with: - command: doc - args: --all - - - name: Create index.html - run: | - echo "" > ./target/doc/index.html + - name: Test (default features) + run: cargo test - - name: Deploy documentation - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./target/doc + - name: Test (thread-safe feature) + run: cargo test --features thread_safe