mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
Create custom action for installing Linux dependencies (#12850)
# Objective - There are several occurrences where different actions install alsa, udev, and various other libraries for Linux. - This is repetitive and can be an issue if the dependencies required by Bevy ever change. ## Solution - Create a custom action for installing Linux dependencies. - It can be used by adding `- uses: ./.github/actions/install-linux-deps`. - It supports configuring which libraries are installed using the `with` property. - It does nothing if not run on Linux, so workflows don't need to worry about adding `if: ${{ runner.os == 'linux' }}`. ## Discussion - The only instance where this action is not used cleanly is for the `run-examples-linux-vulkan` verification job. I need to investigate further the flags and dependencies that it installs.
This commit is contained in:
parent
9622557093
commit
380b35cee6
5 changed files with 102 additions and 41 deletions
49
.github/actions/install-linux-deps/action.yml
vendored
Normal file
49
.github/actions/install-linux-deps/action.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# 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' || '' }}
|
34
.github/workflows/ci.yml
vendored
34
.github/workflows/ci.yml
vendored
|
@ -34,9 +34,8 @@ jobs:
|
|||
target/
|
||||
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
if: runner.os == 'linux'
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Build & run tests
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- test
|
||||
|
@ -61,8 +60,11 @@ jobs:
|
|||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt, 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 Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
with:
|
||||
wayland: true
|
||||
xkb: true
|
||||
- name: CI job
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- lints
|
||||
|
@ -118,8 +120,8 @@ jobs:
|
|||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Check Compile
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- compile
|
||||
|
@ -284,8 +286,11 @@ jobs:
|
|||
target/
|
||||
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- 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 Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
with:
|
||||
wayland: true
|
||||
xkb: true
|
||||
- name: Build and check doc
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- doc
|
||||
|
@ -389,8 +394,8 @@ jobs:
|
|||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ env.MSRV }}
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Run cargo check
|
||||
id: check
|
||||
run: cargo check
|
||||
|
@ -443,8 +448,11 @@ jobs:
|
|||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
|
||||
- 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 Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
with:
|
||||
wayland: true
|
||||
xkb: true
|
||||
- name: Build and check cfg typos
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- cfg-check
|
||||
|
|
7
.github/workflows/docs.yml
vendored
7
.github/workflows/docs.yml
vendored
|
@ -37,8 +37,11 @@ jobs:
|
|||
with:
|
||||
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
|
||||
|
||||
- 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 Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
with:
|
||||
wayland: true
|
||||
xkb: true
|
||||
|
||||
# This does the following:
|
||||
# - Replaces the docs icon with one that clearly denotes it's not the released package on crates.io
|
||||
|
|
30
.github/workflows/validation-jobs.yml
vendored
30
.github/workflows/validation-jobs.yml
vendored
|
@ -71,18 +71,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Install Bevy dependencies
|
||||
run: |
|
||||
sudo apt-get update;
|
||||
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq \
|
||||
libasound2-dev libudev-dev libxkbcommon-x11-0;
|
||||
- name: install xvfb, llvmpipe and lavapipe
|
||||
run: |
|
||||
sudo apt-get update -y -qq
|
||||
sudo add-apt-repository ppa:kisak/turtle -y
|
||||
sudo apt-get update
|
||||
sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
# At some point this may be merged into `install-linux-deps`, but for now it is its own step.
|
||||
- name: Install additional Linux dependencies for Vulkan
|
||||
run: |
|
||||
sudo add-apt-repository ppa:kisak/turtle -y
|
||||
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
|
@ -240,8 +236,8 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Build
|
||||
run: cargo build -p ${{ matrix.crate }} --no-default-features
|
||||
env:
|
||||
|
@ -282,8 +278,8 @@ jobs:
|
|||
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
|
||||
- name: Installs cargo-udeps
|
||||
run: cargo install --force cargo-udeps
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Run cargo udeps
|
||||
run: cargo udeps
|
||||
|
||||
|
@ -305,8 +301,8 @@ jobs:
|
|||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Installs cargo-udeps
|
||||
run: cargo install --force cargo-udeps
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Apply patches
|
||||
run: |
|
||||
for patch in tools/example-showcase/*.patch; do
|
||||
|
|
23
.github/workflows/weekly.yml
vendored
23
.github/workflows/weekly.yml
vendored
|
@ -21,9 +21,8 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@beta
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
if: runner.os == 'linux'
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Build & run tests
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- test
|
||||
|
@ -39,8 +38,11 @@ jobs:
|
|||
- uses: dtolnay/rust-toolchain@beta
|
||||
with:
|
||||
components: rustfmt, 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 Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
with:
|
||||
wayland: true
|
||||
xkb: true
|
||||
- name: Run lints
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- lints
|
||||
|
@ -52,8 +54,8 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@beta
|
||||
- name: Install alsa and udev
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Install Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
- name: Check compile test
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- compile
|
||||
|
@ -64,8 +66,11 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@beta
|
||||
- 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 Linux dependencies
|
||||
uses: ./.github/actions/install-linux-deps
|
||||
with:
|
||||
wayland: true
|
||||
xkb: true
|
||||
- name: Build and check docs
|
||||
# See tools/ci/src/main.rs for the commands this runs
|
||||
run: cargo run -p ci -- doc
|
||||
|
|
Loading…
Add table
Reference in a new issue