Skip to content

Commit

Permalink
ci: Refactor CI
Browse files Browse the repository at this point in the history
  • Loading branch information
shun-shobon committed May 6, 2024
1 parent c772ced commit 6d0646b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 6 deletions.
51 changes: 51 additions & 0 deletions .github/actions/install-linux-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ref: https://github.com/bevyengine/bevy/blob/77ed72bc161a561eee5cacbb9d126cdd93fc44b3/.github/actions/install-linux-deps/action.yml

# This action installs a few dependencies necessary to build Bevy on Linux. By default it installs
# alsa and udev, but can be configured depending on which libraries are needed:
#
# ```
# - uses: ./.github/actions/install-linux-deps
# with:
# alsa: false
# wayland: true
# ```
#
# See the `inputs` section for all options and their defaults. Note that you must checkout the
# repository before you can use this action.
#
# This action will only install dependencies when the current operating system is Linux. It will do
# nothing on any other OS (MacOS, Windows).

name: Install Linux dependencies
description: Installs the dependencies necessary to build Bevy on Linux.
inputs:
alsa:
description: Install alsa (libasound2-dev)
required: false
default: true
udev:
description: Install udev (libudev-dev)
required: false
default: true
wayland:
description: Install Wayland (libwayland-dev)
required: false
default: false
xkb:
description: Install xkb (libxkbcommon-dev)
required: false
default: false
runs:
using: composite
steps:
- name: Install Linux dependencies
shell: bash
if: ${{ runner.os == 'linux' }}
run: >
sudo apt-get update
sudo apt-get install --no-install-recommends
${{ fromJSON(inputs.alsa) && 'libasound2-dev' || '' }}
${{ fromJSON(inputs.udev) && 'libudev-dev' || '' }}
${{ fromJSON(inputs.wayland) && 'libwayland-dev' || '' }}
${{ fromJSON(inputs.xkb) && 'libxkbcommon-dev' || '' }}
21 changes: 15 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -18,10 +18,19 @@ jobs:
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
components: clippy

- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Install deps
uses: ./.github/actions/install-linux-deps

- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features -- -D warnings

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- run: cargo fmt --all -- --check

0 comments on commit 6d0646b

Please sign in to comment.