ci: Improve readability / reduce duplication of workflow files

This commit is contained in:
Jonas Platte 2022-03-25 09:51:52 +01:00
parent a108c9a08f
commit 22239c39fc
No known key found for this signature in database
GPG Key ID: BBA95679259D342F
6 changed files with 80 additions and 228 deletions

View File

@ -12,7 +12,9 @@ jobs:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Checkout repo
uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -16,6 +16,7 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install nightly rust toolchain
uses: actions-rs/toolchain@v1
with:
@ -23,7 +24,9 @@ jobs:
# Needed for use of unstable options
toolchain: nightly-2022-03-23
override: true
- uses: Swatinem/rust-cache@v1
- name: Build docs
uses: actions-rs/cargo@v1
env:
@ -31,6 +34,7 @@ jobs:
with:
command: doc
args: --no-deps --workspace --exclude ruma-macros --exclude ruma-identifiers-validation --exclude xtask --all-features -Zrustdoc-map
- name: Deploy to docs branch
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: JamesIves/github-pages-deploy-action@4.1.4

View File

@ -10,77 +10,31 @@ on:
branches: [main, next]
jobs:
all_features:
name: Check All Features
check:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust 1.55 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: '1.55'
# Used to compile xtask
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
with:
# A stable compiler update should automatically not reuse old caches.
# Add the MSRV as a stable cache key too so bumping it also gets us a
# fresh cache.
sharedKey: msrv1.55
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci msrv-all
strategy:
matrix:
include:
- name: Check All Features
cmd: msrv-all
client:
name: Check Client
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust 1.55 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: '1.55'
# Used to compile xtask
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
with:
# A stable compiler update should automatically not reuse old caches.
# Add the MSRV as a stable cache key too so bumping it also gets us a
# fresh cache.
sharedKey: msrv1.55
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci msrv-client
- name: Check Client
cmd: msrv-client
- name: Check Ruma
cmd: msrv-ruma
ruma:
name: Check Ruma
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust 1.55 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: '1.55'
# Used to compile xtask
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
@ -88,14 +42,16 @@ jobs:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
with:
# A stable compiler update should automatically not reuse old caches.
# Add the MSRV as a stable cache key too so bumping it also gets us a
# fresh cache.
sharedKey: msrv1.55
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci msrv-ruma
args: -p xtask --no-default-features ci ${{ matrix.cmd }}

View File

@ -10,83 +10,43 @@ on:
branches: [main, next]
jobs:
fmt:
name: Fmt
check:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: Check Formatting
cmd: fmt
components: rustfmt
- name: Full Features
cmd: nightly-full
- name: Clippy Default Features
cmd: clippy-default
components: clippy
- name: Clippy All Features
cmd: clippy-all
components: clippy
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-03-23
override: true
components: rustfmt
components: ${{ matrix.components }}
- uses: Swatinem/rust-cache@v1
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci fmt
check_full:
name: Check Full Features
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-03-23
override: true
- uses: Swatinem/rust-cache@v1
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci nightly-full
clippy_default:
name: Clippy Default Features
runs-on: ubuntu-latest
needs: check_full
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-03-23
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Run lints
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci clippy-default
clippy_all:
name: Clippy All Features
runs-on: ubuntu-latest
needs: check_full
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-03-23
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Run lints
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci clippy-all
args: -p xtask --no-default-features ci ${{ matrix.cmd }}

View File

@ -10,119 +10,45 @@ on:
branches: [main, next]
jobs:
check_all:
name: Check All Features
check:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: Check All Features
cmd: stable-all
- name: Check Client
cmd: stable-client
- name: Check Common
cmd: stable-common
- name: Run Tests
cmd: test-all
- name: Run Doc Tests
cmd: test-doc
- name: Test Common Features
cmd: test-common
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci stable-all
check_client:
name: Check Client
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci stable-client
check_common:
name: Check Common
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Run checks
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci stable-common
test_all:
name: Run Tests
runs-on: ubuntu-latest
needs: check_all
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci test-all
test_doc:
name: Run Doc Tests
runs-on: ubuntu-latest
needs: check_all
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci test-doc
test_common:
name: Test Common Features
runs-on: ubuntu-latest
needs: check_common
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: run
args: -p xtask --no-default-features ci test-common
args: -p xtask --no-default-features ci ${{ matrix.cmd }}

View File

@ -23,13 +23,17 @@ jobs:
profile: minimal
toolchain: nightly-2022-03-23
override: true
- uses: Swatinem/rust-cache@v1
- name: Check spelling
uses: crate-ci/typos@master
- name: Install cargo-sort
uses: actions-rs/install@v0.1
with:
crate: cargo-sort
- name: Run lints
uses: actions-rs/cargo@v1
with: