From d370c2eb0fd168614268bed7ce31177a43492f9e Mon Sep 17 00:00:00 2001 From: Matthew Rodusek <7519129+bitwizeshift@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:40:05 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A6=20Add=20action=20for=20preparing?= =?UTF-8?q?=20workflow=20runners?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/actions/prepare-runner/action.yaml | 102 +++++++++++++++++++++ .github/workflows/build.yaml | 27 +++--- .github/workflows/docs.yaml | 6 +- frameworks/openal-sys/build.rs | 26 ++++++ 4 files changed, 145 insertions(+), 16 deletions(-) create mode 100644 .github/actions/prepare-runner/action.yaml diff --git a/.github/actions/prepare-runner/action.yaml b/.github/actions/prepare-runner/action.yaml new file mode 100644 index 0000000..a2f0a2e --- /dev/null +++ b/.github/actions/prepare-runner/action.yaml @@ -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 molten-vk@1.2.6 + + - 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 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 06e8d54..dacf91d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index e2f2f9d..a7e6e78 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -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 @@ -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 diff --git a/frameworks/openal-sys/build.rs b/frameworks/openal-sys/build.rs index 6bda7c1..ff4fd75 100644 --- a/frameworks/openal-sys/build.rs +++ b/frameworks/openal-sys/build.rs @@ -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());