Skip to content

Commit

Permalink
Optimize CI
Browse files Browse the repository at this point in the history
- use rust-cache
- combine fast rustfmt and slower clippy into one
- cleanups

Similar to ssalonen/libcec-sys#34

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
  • Loading branch information
ssalonen committed Jul 5, 2023
1 parent ec9383c commit fd4e295
Showing 1 changed file with 12 additions and 30 deletions.
42 changes: 12 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
rust: [stable]
job:
# Windows disabled
# See https://github.com/ssalonen/cec-rs/issues/27
Expand Down Expand Up @@ -92,21 +91,24 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- if: runner.os == 'Linux'
name: Apt-get update
run: sudo apt-get update -yq
- name: Installing Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
toolchain: stable
profile: minimal
target: ${{ matrix.job.target }}
override: true
- uses: Swatinem/rust-cache@v1
# libcec and p8-platform from apt repo
- if: ${{ !startsWith(matrix.job.libcec, 'vendored') && runner.os == 'Linux' }}
name: Install libcec(-dev) and build dependencies
run: |
set -e
# introduce Ubuntu 20.04 (Focal Fossa) repos as well for easy libcec4 installation
sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install -yq libudev-dev libp8-platform2 libp8-platform-dev
apt show '${{ matrix.job.libcec }}'
Expand Down Expand Up @@ -146,42 +148,22 @@ jobs:
with:
command: test
use-cross: ${{ matrix.job.use-cross }}
toolchain: ${{ matrix.rust }}
args: --target ${{ matrix.job.target }} -vv

rustfmt:
name: Rustfmt
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: actions/checkout@v3
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Check formatting
submodules: recursive
- name: Rustfmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-gnu
components: clippy
# need to use cross to setup dependencies
- name: Clippy Check
uses: actions-rs/cargo@v1
with:
Expand All @@ -196,7 +178,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Update apt
run: sudo apt-get update
run: sudo apt-get update -yq
- name: Install dependencies for build and coverage
run: sudo apt-get install libudev-dev libcec6 libcec-dev pkg-config libp8-platform-dev
- name: Install stable toolchain
Expand Down

0 comments on commit fd4e295

Please sign in to comment.