Skip to content

Fleshes out the build/test matrix and tests with assert-enabled LLVM #161

Fleshes out the build/test matrix and tests with assert-enabled LLVM

Fleshes out the build/test matrix and tests with assert-enabled LLVM #161

Workflow file for this run

---
name: Test
on:
push:
branches: [ main ]
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
pull_request:
branches: [ "**" ]
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
jobs:
dev-container:
name: "Dev container: ${{ matrix.configuration }}"
strategy:
fail-fast: false
matrix:
include:
- configuration: debug
HYLO_LLVM_BUILD_TYPE: Debug
- configuration: release
HYLO_LLVM_BUILD_TYPE: MinSizeRel
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- name: Build and run devcontainer task
uses: devcontainers/[email protected]
env:
HYLO_LLVM_BUILD_TYPE: ${{ matrix.HYLO_LLVM_BUILD_TYPE }}
with:
runCmd: swift test --parallel -c ${{ matrix.configuration }}
native:
name: "Native: ${{ matrix.os }}/${{ matrix.configuration }}"
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
configuration: [debug, release]
include:
- HYLO_LLVM_DOWNLOAD_URL: https://github.com/hylo-lang/llvm-build/releases/download
- HYLO_LLVM_BUILD_RELEASE: 2024-02-29-r2
- HYLO_LLVM_VERSION: 17.0.6
- swift_test_options:
- unpackage_command: tar -x --zstd
- package_suffix: .tar.zst
- configuration: debug
HYLO_LLVM_BUILD_TYPE: Debug
- configuration: release
HYLO_LLVM_BUILD_TYPE: MinSizeRel
- os: windows-latest
unpackage_command: 7z x -t7z -si
package_suffix: .7z
triple_suffix: unknown-windows-msvc17
- os: ubuntu-latest
triple_suffix: unknown-linux-gnu
- os: macos-latest
triple_suffix: apple-darwin23.3.0
- os: ubuntu-latest
configuration: release
swift_test_options: --enable-code-coverage
runs-on: ${{ matrix.os }}
env:
url_prefix: ${{ matrix.HYLO_LLVM_DOWNLOAD_URL }}/${{ matrix.HYLO_LLVM_BUILD_RELEASE }}
package_basename: llvm-${{ matrix.HYLO_LLVM_VERSION }}-x86_64-${{ matrix.triple_suffix }}-${{ matrix.HYLO_LLVM_BUILD_TYPE }}
steps:
- name: Setup Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '5.9'
- name: Install LLVM
run: >-
curl --no-progress-meter -L
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"
${{ env.url_prefix }}/${{ env.package_basename }}${{ matrix.package_suffix }}
| ${{ matrix.unpackage_command }}
- name: Checkout (GitHub)
uses: actions/checkout@v4
with:
path: Swifty-LLVM
- name: Create LLVM pkgconfig file
run: PATH="${{ github.workspace }}/${{ env.package_basename }}/bin:$PATH" Swifty-LLVM/Tools/make-pkgconfig.sh llvm.pc
shell: bash
- name: Test
run: swift test ${{ matrix.swift_test_options }} -c ${{ matrix.configuration }}
working-directory: Swifty-LLVM
env:
PKG_CONFIG_PATH: ${{ github.workspace }}
- name: Export Coverage
if: ${{ contains(matrix.swift_test_options, '--enable-code-coverage') }}
working-directory: Swifty-LLVM
run: |
dot_os=(.build/${{ matrix.configuration }}/*.build/**/*.o)
bin_params=("${dot_os[0]}")
for o in "${dot_os[@]:1}"; do
bin_params+=("-object" "${o}")
done
# Note: on mac this command might require a leading xcrun.
llvm-cov export -format="lcov" -instr-profile "$(swift test -c ${{ matrix.configuration }} --show-codecov-path | xargs dirname)"/default.profdata "${bin_params[@]}" > info.lcov
- name: Upload coverage reports to Codecov
if: ${{ contains(matrix.swift_test_options, '--enable-code-coverage') }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true