Upgrade to LLVM 23 and remove zstd dependency #714
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE" | |
| - ".gitignore" | |
| - ".editorconfig" | |
| pull_request: | |
| branches: [ "**" ] | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE" | |
| - ".gitignore" | |
| - ".editorconfig" | |
| env: | |
| spm-build-options: -Xswiftc -enable-testing --explicit-target-dependency-import-check error | |
| spm-test-options: --parallel | |
| swift-version: '6.3' | |
| HYLO_LLVM_BUILD_RELEASE: 20260905-150549 | |
| HYLO_LLVM_VERSION: '23.1.0' | |
| jobs: | |
| line-length: | |
| name: "Line length" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check max line length of 100 characters | |
| run: "! grep -rnE --include=*.swift --exclude-dir=cmake.* --exclude-dir=.build '.{101,}' ." | |
| dev-container: | |
| name: "Ubuntu dev container/${{matrix.build-system}}/${{ matrix.cmake_build_type }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cmake_build_type: [Debug, Release] | |
| build-system: [cmake, spm] | |
| include: | |
| - spm_configuration: debug | |
| cmake_build_type: Debug | |
| more-spm-test-options: --enable-code-coverage | |
| HYLO_LLVM_BUILD_TYPE: Debug | |
| - spm_configuration: release | |
| cmake_build_type: Release | |
| HYLO_LLVM_BUILD_TYPE: MinSizeRel | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| show-progress: false | |
| - name: Initialize Dev Container | |
| uses: devcontainers/ci@v0.3 | |
| with: | |
| runCmd: uname -a # Just print OS information | |
| push: never | |
| - name: Build and run via CMake | |
| uses: devcontainers/ci@v0.3 | |
| if: ${{ matrix.build-system == 'cmake' }} | |
| env: | |
| HYLO_LLVM_BUILD_TYPE: ${{ matrix.HYLO_LLVM_BUILD_TYPE }} | |
| with: | |
| runCmd: > | |
| set -exu # fail fast, print commands before executing, treat unset variables as an error | |
| LLVM_DIR="$(llvm-config --prefix)/lib/cmake/llvm" | |
| [ -f "$LLVM_DIR/LLVMConfig.cmake" ] || | |
| (echo "LLVMConfig.cmake not found in '$LLVM_DIR'. Available files are:"; | |
| ls "$LLVM_DIR"; | |
| exit 1) | |
| cmake -GNinja -S . -B .cmake-build | |
| -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} | |
| -DBUILD_TESTING=YES | |
| -DLLVM_DIR="$LLVM_DIR" | |
| cmake --build .cmake-build | |
| ctest --output-on-failure --parallel --test-dir .cmake-build | |
| push: never | |
| - name: Build and Test via SPM | |
| if: ${{ matrix.build-system == 'spm' }} | |
| uses: devcontainers/ci@v0.3 | |
| with: # todo make pipe fail if first command fails | |
| runCmd: | | |
| /usr/bin/llvm-cov --version | |
| swift test -c ${{ matrix.spm_configuration }} ${{ env.spm-build-options }} ${{ env.spm-test-options }} ${{ matrix.more-spm-test-options }} | |
| push: never | |
| - name: Export Coverage | |
| uses: devcontainers/ci@v0.3 | |
| if: ${{ matrix.build-system == 'spm' && contains(matrix.more-spm-test-options, '--enable-code-coverage') }} | |
| with: | |
| runCmd: | | |
| shopt -s nullglob | |
| dot_os=(.build/${{ matrix.spm_configuration }}/*.build/*.o .build/${{ matrix.spm_configuration }}/*.build/**/*.o) | |
| bin_params=("${dot_os[0]}") | |
| for o in "${dot_os[@]:1}"; do | |
| bin_params+=("-object" "${o}") | |
| done | |
| # Note: on mac using llvm-cov from Xcode might require a leading xcrun. | |
| /usr/bin/llvm-cov export -format="lcov" -instr-profile "$(swift test -c ${{ matrix.spm_configuration }} --show-codecov-path | xargs dirname)"/default.profdata "${bin_params[@]}" > info.lcov | |
| push: never | |
| - name: Upload coverage reports to Codecov | |
| if: ${{ matrix.build-system == 'spm' && contains(matrix.more-spm-test-options, '--enable-code-coverage') }} | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| native-spm: | |
| name: "SPM: ${{ matrix.os }}/${{ matrix.spm_configuration }}${{ matrix.cross_compilation && '/cross' || '' }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-15, ubuntu-24.04, windows-2025] | |
| spm_configuration: [debug, release] | |
| cross_compilation: [true, false] | |
| include: | |
| - spm_configuration: debug | |
| HYLO_LLVM_BUILD_TYPE: Debug | |
| - spm_configuration: release | |
| HYLO_LLVM_BUILD_TYPE: MinSizeRel | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| show-progress: false | |
| path: Swifty-LLVM | |
| - name: Set up LLVM | |
| uses: hylo-lang/get-llvm@6a49368ad6b8b735b444d4b9840b0bc466e7875a # v0.4.0 | |
| id: get-llvm | |
| with: | |
| llvmVersion: ${{ env.HYLO_LLVM_VERSION }} | |
| llvmBuildRelease: ${{ env.HYLO_LLVM_BUILD_RELEASE }} | |
| llvmBuildConfig: ${{ matrix.HYLO_LLVM_BUILD_TYPE }} | |
| addToPkgConfigPath: true | |
| addToPath: true | |
| - name: Set up specific Xcode version | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| if: ${{ runner.os == 'macOS' }} | |
| with: | |
| xcode-version: '26.0.1' | |
| - name: Set up swift | |
| uses: SwiftyLab/setup-swift@latest | |
| with: | |
| swift-version: ${{ env.swift-version }} | |
| - name: Download Recent Visual Studio and Windows SDK | |
| uses: compnerd/gha-setup-vsdevenv@main | |
| with: | |
| winsdk: "10.0.26100.0" | |
| # Note: The GitHub windows-2025 runner has only a very old version of the Windows SDK available by default. | |
| # Swift is said to require version 10.0.22621.0: https://forums.swift.org/t/swiftpm-plugin-doesnt-work-with-the-latest-visual-studio-version/78183/14 | |
| # That no longer works, so we had to upgrade to 10.0.26100.0. | |
| # See also: https://github.com/swiftlang/swift/issues/88237 | |
| - name: SPM Cache Setup | |
| uses: actions/cache@v4.2.4 | |
| with: | |
| path: Swifty-LLVM/.build | |
| key: ${{ matrix.os }}-${{ matrix.spm_configuration }}-spm-${{ hashFiles('Swifty-LLVM/**/Package.resolved') || 'no-dependencies' }} | |
| restore-keys: | | |
| ${{ matrix.os }}-${{ matrix.spm_configuration }}-spm- | |
| - name: Build and Test via SPM | |
| run: swift test -v ${{ matrix.swift_test_options }} ${{ matrix.cross_compilation && '-Xswiftc -DSWIFTY_LLVM_CROSS_COMPILATION_ENABLED' || '' }} -c ${{ matrix.spm_configuration }} | |
| working-directory: Swifty-LLVM | |
| native-cmake: | |
| name: "CMake: ${{ matrix.os }}/${{ matrix.cmake_build_type }}/${{ matrix.cmake_generator }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-15, ubuntu-24.04, windows-2025] | |
| cmake_build_type: [Debug, Release] | |
| cmake_generator: [Ninja, Xcode] # TODO: add back XCode generator after switching to macos-15: https://github.com/hylo-lang/hylo/issues/1730 | |
| exclude: | |
| - os: ubuntu-24.04 | |
| cmake_generator: Xcode | |
| - os: windows-2025 | |
| cmake_generator: Xcode | |
| include: | |
| - cmake_build_type: Debug | |
| HYLO_LLVM_BUILD_TYPE: Debug | |
| - cmake_build_type: Release | |
| HYLO_LLVM_BUILD_TYPE: MinSizeRel | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| show-progress: false | |
| path: Swifty-LLVM | |
| - name: Set up LLVM | |
| uses: hylo-lang/get-llvm@6a49368ad6b8b735b444d4b9840b0bc466e7875a # v0.4.0 | |
| id: get-llvm | |
| with: | |
| llvmVersion: ${{ env.HYLO_LLVM_VERSION }} | |
| llvmBuildRelease: ${{ env.HYLO_LLVM_BUILD_RELEASE }} | |
| llvmBuildConfig: ${{ matrix.HYLO_LLVM_BUILD_TYPE }} | |
| addToPkgConfigPath: true | |
| addToPath: true | |
| - name: Set up specific Xcode version | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| if: ${{ runner.os == 'macOS' }} | |
| with: | |
| xcode-version: '26.0.1' | |
| - name: Set up latest CMake and Ninja | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: latest | |
| - name: Set up swift | |
| uses: SwiftyLab/setup-swift@latest | |
| with: | |
| swift-version: ${{ env.swift-version }} | |
| - name: Download Recent Visual Studio and Windows SDK | |
| uses: compnerd/gha-setup-vsdevenv@main | |
| with: | |
| winsdk: "10.0.26100.0" | |
| # Note: The GitHub windows-2025 runner has only a very old version of the Windows SDK available by default. | |
| # Swift is said to require version 10.0.22621.0: https://forums.swift.org/t/swiftpm-plugin-doesnt-work-with-the-latest-visual-studio-version/78183/14 | |
| # That no longer works, so we had to upgrade to 10.0.26100.0. | |
| # See also: https://github.com/swiftlang/swift/issues/88237 | |
| - name: Configure (CMake) | |
| # We explicitly point to swiftc in the PATH because otherwise CMake picks up the one in XCode. | |
| shell: bash | |
| run: > | |
| set -exu # fail fast, print commands before executing, treat unset variables as an error | |
| LLVM_DIR="${{ steps.get-llvm.outputs.llvmCmakeDirectory }}" | |
| [ -f "$LLVM_DIR/LLVMConfig.cmake" ] || | |
| (echo "LLVMConfig.cmake not found in '$LLVM_DIR'. Available files are:"; | |
| ls "$LLVM_DIR"; | |
| exit 1) | |
| cmake -G '${{ matrix.cmake_generator }}' | |
| -S . | |
| -B .cmake-build | |
| ${{ matrix.cmake_generator != 'Xcode' && format('-DCMAKE_BUILD_TYPE={0}', matrix.cmake_build_type) || '' }} | |
| -DBUILD_TESTING=YES | |
| -DLLVM_DIR="$LLVM_DIR" | |
| ${{ runner.os == 'macOS' && '-DCMAKE_Swift_COMPILER=swiftc -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path)' || '' }} | |
| working-directory: Swifty-LLVM | |
| - name: Build (CMake) | |
| run: cmake --build Swifty-LLVM/.cmake-build ${{ matrix.cmake_generator == 'Xcode' && format('--config {0}', matrix.cmake_build_type) || '' }} | |
| - name: Test (CMake) | |
| run: ctest --output-on-failure --parallel --test-dir Swifty-LLVM/.cmake-build ${{ matrix.cmake_generator == 'Xcode' && format('-C {0}', matrix.cmake_build_type) || '' }} |