Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore(ci): Update rust, cargo and cache actions #177

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 29 additions & 77 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,24 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy
override: true
- name: Rustfmt
run: cargo +nightly fmt --all -- --check
- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features full-doc
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt,clippy
- name: Setup cache
uses: Swatinem/rust-cache@v2
- name: Rustfmt
run: cargo +nightly fmt --all -- --check
- name: Clippy
run: cargo clippy --features full-doc

test:
name: Test
runs-on: ${{ matrix.os || 'ubuntu-latest' }}

strategy:
fail-fast: false
matrix:
Expand All @@ -39,8 +35,6 @@ jobs:
- Windows
- driver only
- gateway only
- legacy tokio

include:
- name: beta
toolchain: beta
Expand All @@ -56,80 +50,49 @@ jobs:
- name: gateway only
features: serenity-rustls
dont-test: true

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install toolchain
id: tc
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain || 'stable' }}
profile: minimal
override: true

- name: Setup cache
uses: Swatinem/rust-cache@v2
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev

- name: Setup cache
if: runner.os != 'macOS'
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ steps.tc.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.toml') }}

- name: Build all features
if: matrix.features == ''
run: cargo build --features full-doc

- name: Test all features
if: matrix.features == ''
run: cargo test --features full-doc

- name: Build some features
if: matrix.features
run: cargo build --no-default-features --features "${{ matrix.features }}"

- name: Test some features
if: ${{ !matrix.dont-test && matrix.features }}
run: cargo test --no-default-features --features "${{ matrix.features }}"

doc:
name: Build docs
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install toolchain
id: tc
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
profile: minimal
override: true

- name: Setup cache
uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev

- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-docs-${{ steps.tc.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.toml') }}

- name: Build docs
env:
RUSTDOCFLAGS: -D broken_intra_doc_links
Expand All @@ -139,45 +102,34 @@ jobs:
examples:
name: Examples
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install toolchain
id: tc
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
profile: minimal
override: true

- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
workspaces: examples
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev

- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
examples/target
key: ${{ runner.os }}-examples-${{ steps.tc.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.toml') }}

- name: 'Build serenity/voice'
- name: Build serenity/voice
working-directory: examples
run: cargo build -p voice
- name: 'Build serenity/voice_events_queue'
- name: Build serenity/voice_events_queue
working-directory: examples
run: cargo build -p voice_events_queue
- name: 'Build serenity/voice_receive'
- name: Build serenity/voice_receive
working-directory: examples
run: cargo build -p voice_receive
- name: 'Build serenity/voice_storage'
- name: Build serenity/voice_storage
working-directory: examples
run: cargo build -p voice_storage
- name: 'Build twilight'
- name: Build twilight
working-directory: examples
run: cargo build -p twilight