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 name: Security Audit
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - name: Checkout repo
uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1 - uses: actions-rs/audit-check@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

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

View File

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

View File

@ -10,119 +10,45 @@ on:
branches: [main, next] branches: [main, next]
jobs: jobs:
check_all: check:
name: Check All Features name: ${{ matrix.name }}
runs-on: ubuntu-latest 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: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install rust stable toolchain - name: Install rust stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
override: true override: true
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Run checks - name: Run checks
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: run command: run
args: -p xtask --no-default-features ci stable-all args: -p xtask --no-default-features ci ${{ matrix.cmd }}
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

View File

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