diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3bc2a4..e287294 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,24 +1,30 @@ name: test install-vulkan-sdk + on: push: workflow_dispatch: - inputs: - extra_tests: - description: 'Enable additional CI tests' - required: false - default: false - versions: - description: 'Vulkan SDK Versions' - required: true - default: '[ "1.3.204.1" ]' - oses: - description: 'Matrix OSes' - required: true - default: '[ "ubuntu-latest", "windows-latest", "macos-12" ]' - quiet: - description: 'silence annotation' - required: false - default: false + inputs: + extra_tests: + description: "Enable additional CI tests" + required: false + default: false + versions: + description: "Vulkan SDK Versions" + required: true + default: '[ "1.4.304.0" ]' + oses: + description: "Matrix OSes" + required: true + default: '[ "ubuntu-latest", "ubuntu-24.04-arm", "ubuntu-22.04-arm", "windows-latest", "macos-15", "macos-12" ]' + quiet: + description: "Silence annotation" + required: false + default: false + use_arm_artifact: + description: "Use prebuilt ARM artifacts" + type: boolean + default: true + jobs: setup-all-matrix: if: ${{ github.event.inputs.extra_tests == 'true' || github.event.inputs.extra_tests == 'matrix' }} @@ -28,12 +34,37 @@ jobs: version: ${{ fromJSON(github.event.inputs.versions) }} runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - name: Check for ARM Artifact + if: ${{ matrix.os contains 'arm' && inputs.use_arm_artifact }} + id: check-arm + uses: actions/github-script@v7 + with: + script: | + const { data } = await github.rest.actions.listArtifactsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + name: `vulkansdk-linux-arm64-${process.env.RUNNER_OS}-${process.env.VERSION}` + }); + return data.artifacts.length > 0 ? 'exists' : 'not-found'; + + - name: Download ARM Artifact + if: ${{ steps.check-arm.outputs.result == 'exists' }} + uses: actions/download-artifact@v4 + with: + name: vulkansdk-linux-arm64-${{ matrix.os }}-${{ env.VULKAN_SDK_VERSION }} + + - name: Build ARM SDK + if: ${{ steps.check-arm.outputs.result == 'not-found' && matrix.os contains 'arm' }} + uses: ./.github/workflows/ubuntu-arm.yml + with: + version: ${{ env.VULKAN_SDK_VERSION }} + - uses: ./ with: version: ${{ matrix.version }} cache: true - quiet: ${{ github.event.inputs.quiet }} + use_arm_artifact: ${{ inputs.use_arm_artifact }} + - name: Test Vulkan SDK Install shell: bash run: | @@ -80,6 +111,36 @@ jobs: test-prebuilt-linux: if: ${{ contains(github.event.inputs.extra_tests, 'prebuilt-linux') }} runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + version: ${{ fromJSON(github.event.inputs.versions)[0] }} + cache: false + - name: Smoke test Vulkan SDK + shell: bash + run: | + echo VULKAN_SDK=$VULKAN_SDK + echo VULKAN_SDK_VERSION=$VULKAN_SDK_VERSION + glslangValidator --version + spirv-cfg --version + spirv-cross --help 2>&1 | head -1 + glslc --version + du -hsc $VULKAN_SDK/* + find $VULKAN_SDK -size +50M | xargs ls -lrth + - name: Test compiling against Vulkan SDK Install + shell: bash + run: | + echo "Vulkan SDK Version=='$VULKAN_SDK_VERSION'" + echo "VULKAN_SDK=='$VULKAN_SDK'" + test -n "$VULKAN_SDK_VERSION" + cmake -B tests/build -S tests -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. + cmake --build tests/build --config release + ./tests/build/test_vulkan + + test-prebuilt-linux-arm: + if: ${{ contains(github.event.inputs.extra_tests, 'prebuilt-linux') }} + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 - uses: ./ @@ -146,4 +207,4 @@ jobs: test -n "$VULKAN_SDK_VERSION" cmake -B tests/build -S tests -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. cmake --build tests/build --config release - ./tests/build/test_vulkan + ./tests/build/test_vulkan \ No newline at end of file diff --git a/.github/workflows/ubuntu-arm.yml b/.github/workflows/ubuntu-arm.yml new file mode 100644 index 0000000..2b43c85 --- /dev/null +++ b/.github/workflows/ubuntu-arm.yml @@ -0,0 +1,89 @@ +name: Build-Vulkan-SDK-ARM +on: + push: + workflow_dispatch: + inputs: + version: + description: 'Vulkan SDK version (e.g., 1.4.304.0)' + required: false + default: 'latest' + +jobs: + build-linux-arm: + name: Build Vulkan-SDK-ARM for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-24.04-arm, ubuntu-22.04-arm ] + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set version variable + id: vars + run: | + if [[ "${{ github.event.inputs.version }}" == "latest" || -z "${{ github.event.inputs.version }}" ]]; then + echo "SDK_URL=https://sdk.lunarg.com/sdk/download/latest/linux/vulkan-sdk.tar.xz" >> $GITHUB_ENV + echo "Using default SDK version: latest" + else + echo "SDK_URL=https://sdk.lunarg.com/sdk/download/${{ github.event.inputs.version }}/linux/vulkansdk-linux-arm64-${{ github.event.inputs.version }}.tar.xz" >> $GITHUB_ENV + echo "Using specified SDK version: ${{ github.event.inputs.version }}" + fi + + - name: Update APT + run: sudo apt update + + - name: Install Host Dependencies + run: | + if [[ "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then + sudo apt install cmake ninja-build gcc-12 g++-12 bison ocaml-core xz-utils pkg-config python3-pip -y + elif [[ "${{ matrix.os }}" == "ubuntu-24.04-arm" ]]; then + sudo apt install cmake ninja-build gcc-14 g++-14 bison ocaml-core xz-utils pkg-config python3-pip -y + fi + + - name: Install Python + run: pip3 install setuptools wheel + + - name: Install Target Dependencies + run: | + sudo apt install libglm-dev libxcb-dri3-0 libxcb-present0 libpciaccess0 \ + libpng-dev libxcb-keysyms1-dev libxcb-dri3-dev libx11-dev \ + libwayland-dev libxrandr-dev libxcb-randr0-dev libxcb-ewmh-dev \ + libx11-xcb-dev liblz4-dev libzstd-dev \ + libxml2-dev wayland-protocols -y --no-install-recommends + + - name: Download SDK + run: curl -L -o vulkan-sdk.tar.xz "$SDK_URL" + + - name: Extract SDK and Determine SDK Directory + run: | + tar -xJf vulkan-sdk.tar.xz + SDK_DIR=$(find . -maxdepth 1 -type d -name '1.*' | head -n 1) + echo "SDK_DIR=${SDK_DIR}" >> $GITHUB_ENV + echo "SDK_VERSION=$(basename ${SDK_DIR})" >> $GITHUB_ENV + + - name: Remove x86_64 directory + run: | + cd "${{ env.SDK_DIR }}" + rm -rf x86_64 + + - name: Build SDK + run: | + cd "${{ env.SDK_DIR }}" + if [[ "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then + CC=/usr/bin/aarch64-linux-gnu-gcc-12 CXX=/usr/bin/aarch64-linux-gnu-g++-12 ./vulkansdk --maxjobs vulkan-loader vulkan-validationlayers vulkan-extensionlayer + elif [[ "${{ matrix.os }}" == "ubuntu-24.04-arm" ]]; then + CC=/usr/bin/aarch64-linux-gnu-gcc-14 CXX=/usr/bin/aarch64-linux-gnu-g++-14 ./vulkansdk --maxjobs vulkan-loader vulkan-validationlayers vulkan-extensionlayer + fi + + # When an Artifact is uploaded, all the files are assembled into an immutable Zip archive. There is currently no way to download artifacts in a format other than a Zip or to download individual artifact contents. + - name: Rename SDK Directory for Artifact + run: | + mv "${{ env.SDK_DIR }}" "vulkansdk-linux-arm64-${{ matrix.os }}-${{ env.SDK_VERSION }}" + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: vulkansdk-linux-arm64-${{ matrix.os }}-${{ env.SDK_VERSION }} + path: vulkansdk-linux-arm64-${{ matrix.os }}-${{ env.SDK_VERSION }} + retention-days: 30 \ No newline at end of file diff --git a/LICENSE b/LICENSE index 61aedce..d90165a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 humbletim +Copyright (c) 2025 humbletim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 84496e6..0bc1ac8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This action automatically downloads and installs the Vulkan SDK development envi ```yaml -name: Install Vulkan SDK - uses: humbletim/install-vulkan-sdk@v1.1.1 + uses: humbletim/install-vulkan-sdk@v2 with: version: 1.3.204.1 cache: true diff --git a/action.yml b/action.yml index 7c303b4..36743bb 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,10 @@ inputs: description: 'silence GitHub Annotation notice displayed if resolving `latest` into Vulkan SDK release number' default: false required: false + use_arm_artifact: + description: 'Use prebuilt ARM artifacts from GitHub Actions' + default: false + required: false runs: using: "composite" steps: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 63ed881..3358e9c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18) +cmake_minimum_required(VERSION 3.20) project(test_vulkan) message(STATUS "") diff --git a/vulkan_prebuilt_helpers.sh b/vulkan_prebuilt_helpers.sh index 3606fd0..3f0b0a4 100644 --- a/vulkan_prebuilt_helpers.sh +++ b/vulkan_prebuilt_helpers.sh @@ -12,6 +12,7 @@ function _os_filename() { case $1 in mac) echo vulkan_sdk.dmg ;; linux) echo vulkan_sdk.tar.gz ;; + linux-arm) echo vulkansdk-linux-arm64-$RUNNER_OS-$VULKAN_SDK_VERSION.zip ;; windows) echo vulkan_sdk.exe ;; *) echo "unknown $1" >&2 ; exit 9 ;; esac @@ -19,17 +20,23 @@ function _os_filename() { function download_vulkan_installer() { local os=$1 - local filename=$(_os_filename $os) - local url=https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/$os/$filename?Human=true - echo "_download_os_installer $os $filename $url" >&2 - if [[ -f $filename ]] ; then - echo "using cached: $filename" >&2 + if [[ "$os" == "linux" && "${{ inputs.use_arm_artifact }}" == "true" ]]; then + os="linux-arm" + echo "Downloading ARM artifact for version $VULKAN_SDK_VERSION" + gh run download --pattern "vulkansdk-linux-arm64-$RUNNER_OS-$VULKAN_SDK_VERSION.zip" + unzip vulkansdk-linux-arm64-$RUNNER_OS-$VULKAN_SDK_VERSION.zip -d $VULKAN_SDK else - curl --fail-with-body -s -L -o ${filename}.tmp $url || { echo "curl failed with error code: $?" >&2 ; curl -s -L --head $url >&2 ; exit 32 ; } - test -f ${filename}.tmp - mv -v ${filename}.tmp ${filename} - fi - ls -lh $filename >&2 + local filename=$(_os_filename $os) + local url=https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/$os/$filename?Human=true + echo "_download_os_installer $os $filename $url" >&2 + if [[ -f $filename ]] ; then + echo "using cached: $filename" >&2 + else + curl --fail-with-body -s -L -o ${filename}.tmp $url || { echo "curl failed with error code: $?" >&2 ; curl -s -L --head $url >&2 ; exit 32 ; } + test -f ${filename}.tmp + mv -v ${filename}.tmp ${filename} + fi + ls -lh $filename >&2 } function unpack_vulkan_installer() {