Skip to content

Commit

Permalink
Fix missing CI dependencies on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
TimJentzsch committed Jan 12, 2025
1 parent 0c0e440 commit 2c64167
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 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 @@
# 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).
#
# Adopted from the Bevy repository: https://github.com/bevyengine/bevy/blob/main/.github/workflows/ci.yml

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' || '' }}
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
with:
sweep-cache: true

- name: Install Linux dependencies for Bevy
uses: ./.github/actions/install-linux-deps

- name: Run tests
run: |
cargo test --workspace --all-features --all-targets
Expand All @@ -54,7 +57,7 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.extract-rust-version.outputs.channel }}
components: '${{ needs.extract-rust-version.outputs.components }}, clippy'
components: "${{ needs.extract-rust-version.outputs.components }}, clippy"

- name: Cache build artifacts
uses: Leafwing-Studios/cargo-cache@v2
Expand All @@ -76,7 +79,7 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.extract-rust-version.outputs.channel }}
components: '${{ needs.extract-rust-version.outputs.components }}, rustfmt'
components: "${{ needs.extract-rust-version.outputs.components }}, rustfmt"

- name: Run rustfmt
run: cargo fmt --all --check
Expand Down

0 comments on commit 2c64167

Please sign in to comment.