Skip to content

Commit

Permalink
[CI] Optimize GitHub Actions setup, get rid of unmaintained `actions-…
Browse files Browse the repository at this point in the history
…rs`.
  • Loading branch information
azasypkin committed Jan 15, 2023
1 parent 6b00582 commit a75d30b
Showing 1 changed file with 32 additions and 130 deletions.
162 changes: 32 additions & 130 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,157 +2,59 @@ 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

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 "<meta http-equiv=\"refresh\" content=\"0; url=rust_cast\">" > ./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

0 comments on commit a75d30b

Please sign in to comment.