Skip to content

Commit

Permalink
🚦 Add action for preparing workflow runners
Browse files Browse the repository at this point in the history
The Github workflow runners are failing due to not having proper
dependencies installed for Linux builds. This attempts to add the
required dependencies for OpenAL, which appears to be the only tool
that does not have correct support available.
  • Loading branch information
bitwizeshift committed Dec 10, 2023
1 parent bc19dc2 commit d370c2e
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 16 deletions.
102 changes: 102 additions & 0 deletions .github/actions/prepare-runner/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: prepare-runner
description: "Prepares the underlying runner for building this project"

runs:
using: "composite"
steps:
# Install base dependencies

# ubuntu-latest, windows-latest, and macos-latest all come with cmake and
# clang, so we don't need any of these base dependencies.
#
# See:
# - https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
# - https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
# - https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md

- name: Prepare compiler
shell: bash
if: runner.os == 'Linux'
run: |
echo "CC=clang-15" >> "${GITHUB_ENV}"
echo "CXX=clang++-15" >> "${GITHUB_ENV}"
- name: Prepare compiler
shell: bash
if: runner.os == 'macOS'
run: |
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> "${GITHUB_ENV}"
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> "${GITHUB_ENV}"
# OpenAL

# macOS and Windows both use builtin audio-requirements, so only the linux
# runners need to install the audio dependencies in order to work.

- name: Install OpenAL requirements
shell: bash
if: runner.os == 'Linux'
run: |
# Install pulseaudio, portaudio, ALSA, JACK dependencies for
# corresponding backends.
# Install Qt5 dependency for alsoft-config.
sudo apt-get update -y
sudo apt-get install -y -qq \
libpulse-dev \
portaudio19-dev \
libasound2-dev \
libjack-dev \
qtbase5-dev
# GLFW

# macOS and Windows both use builtin requirements for GLFW, so only the linux
# runners need to install dependencies.

- name: Install GLFW requirements
shell: bash
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y -qq \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
libx11-dev
# Boxer

- name: Install Boxer requirements
shell: bash
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y -qq \
libgtk-3-dev
# Vulkan

- name: Install Vulkan requirements
shell: bash
if: runner.os == 'Linux'
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
sudo apt-get update -y
sudo apt-get install vulkan-sdk -y
- name: Install Vulkan requirements
shell: bash
if: runner.os == 'macOS'
run: |
brew install [email protected]
- name: Install Vulkan requirements
shell: powershell
if: runner.os == 'Windows'
run: |
choco install vulkan-sdk --version=1.2.182.0
- name: Checkout 3rd-party
uses: ./.github/actions/checkout
27 changes: 14 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand All @@ -55,8 +55,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand All @@ -68,13 +68,14 @@ jobs:
run: cargo deny check

- name: Create license manifest
run: cargo about generate .cargo-about/about.hbs -o ${{ env.OUTPUT_FILE }}
run: cargo about generate .cargo-about/template.hbs -o ${{ env.OUTPUT_FILE }}

- name: Upload Artifact
uses: actions/upload-artifact@v1
if: success() || failure()
continue-on-error: true
with:
name: licenses
path: ${{env.OUTPUT_FILE}}

clippy:
Expand Down Expand Up @@ -122,8 +123,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand All @@ -145,8 +146,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand All @@ -169,8 +170,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand Down Expand Up @@ -199,8 +200,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Prepare runner
uses: ./.github/actions/prepare-runner

- name: Install toolchain
uses: ./.github/actions/rust-toolchain
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Generate license manifest
run: |
cargo about generate .cargo-about/about.hbs -o target/doc/licenses.html
cargo about generate .cargo-about/template.hbs -o target/doc/licenses.html
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v1
Expand Down
26 changes: 26 additions & 0 deletions frameworks/openal-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,32 @@ fn main() {
fn compile_openal() {
let mut cfg = cmake::Config::new("../../3rd-party/openal-soft");

if cfg!(target_os = "windows") {
cfg
.define("LSOFT_BUILD_ROUTER", "ON")
.define("LSOFT_REQUIRE_WINMM", "ON")
.define("LSOFT_REQUIRE_DSOUND", "ON")
.define("LSOFT_REQUIRE_WASAPI", "ON")
.define("LSOFT_EMBED_HRTF_DATA", "YES");
} else if cfg!(target_os = "linux") {
cfg
.define("ALSOFT_REQUIRE_ALSA", "ON")
.define("ALSOFT_REQUIRE_OSS", "ON")
.define("ALSOFT_REQUIRE_PORTAUDIO", "ON")
.define("ALSOFT_REQUIRE_PULSEAUDIO", "ON")
.define("ALSOFT_REQUIRE_JACK", "ON")
.define("ALSOFT_EMBED_HRTF_DATA", "YES");
} else if cfg!(target_os = "macos") {
cfg
.define("ALSOFT_REQUIRE_COREAUDIO", "ON")
.define("DALSOFT_EMBED_HRTF_DATA", "ON");
} else if cfg!(target_os = "ios") {
cfg
.define("CMAKE_OSX_ARCHITECTURES", "armv7;arm64")
.define("ALSOFT_REQUIRE_COREAUDIO", "ON")
.define("DALSOFT_EMBED_HRTF_DATA", "ON");
}

let dst = cfg.define("LIBTYPE", "STATIC").build();

build::rustc_link_search!("native={}", dst.join("lib").display());
Expand Down

0 comments on commit d370c2e

Please sign in to comment.