Skip to content

Commit

Permalink
Setup cache in CI and install linux dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
merwan committed Jul 7, 2024
1 parent 9c6fdfd commit 877aacf
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/actions/install-linux-deps/action.yml
Original file line number Diff line number Diff line change
@@ -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' || '' }}
11 changes: 11 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-build-${{ hashFiles('**/Cargo.toml') }}
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Build
run: cargo build --verbose
- name: Run tests
Expand Down

0 comments on commit 877aacf

Please sign in to comment.