Attempt to add coverage reporting. #124
Workflow file for this run
This file contains 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, rewrite ] | |
paths-ignore: | |
- "**.md" | |
- "LICENSE" | |
- ".gitignore" | |
pull_request: | |
branches: [ "**" ] | |
paths-ignore: | |
- "**.md" | |
- "LICENSE" | |
- ".gitignore" | |
jobs: | |
build-devcontainer: | |
name: "Devcontainer: ${{ matrix.host.os }}/${{ matrix.configuration }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
host: [ | |
{ type: linux, os: ubuntu-latest, test-options: --enable-code-coverage, } | |
] | |
configuration: [ "debug", "release" ] | |
runs-on: ${{ matrix.host.os }} | |
steps: | |
- name: Checkout (GitHub) | |
uses: actions/checkout@v3 | |
- run: git config --global core.autocrlf input | |
- name: Build and run devcontainer task | |
uses: devcontainers/[email protected] | |
with: | |
runCmd: swift test --parallel -v --enable-code-coverage -c ${{ matrix.configuration }} ${{ matrix.host.test-options }} | |
- name: Compute refname | |
shell: bash | |
run: echo "refname=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: hylo-lang/Swifty-LLVM/${{ env.refname }}/${{ matrix.configuration }} | |
build-native: | |
name: "Native: ${{ matrix.host.os }}/${{ matrix.configuration }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
host: [ | |
{ type: macos, os: macos-latest} | |
] | |
configuration: [ "debug", "release" ] | |
runs-on: ${{ matrix.host.os }} | |
steps: | |
- name: Checkout (GitHub) | |
uses: actions/checkout@v3 | |
- run: git config --global core.autocrlf input | |
- name: Setup Swift | |
uses: swift-actions/setup-swift@v1 | |
- run: swift --version | |
- name: Install LLVM | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "15.0" | |
- run: llvm-config --version | |
- name: Configure pkgconfig | |
run: sudo ./Tools/make-pkgconfig.sh /usr/local/lib/pkgconfig/llvm.pc | |
- name: Build | |
run: swift build -v -c ${{ matrix.configuration }} | |
- name: Test | |
run: swift test -v -c ${{ matrix.configuration }} ${{ matrix.host.test-options }} | |
build-native-windows: | |
name: "Native: windows-latest/debug" | |
strategy: | |
fail-fast: false | |
runs-on: windows-latest | |
steps: | |
- name: Setup swift | |
uses: compnerd/[email protected] | |
with: | |
github-repo: thebrowsercompany/swift-build | |
release-asset-name: installer-amd64.exe | |
release-tag-name: 20231130.2 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
show-progress: false | |
- name: Swift version | |
run: swift --version | |
- name: Set up LLVM 15.0.6 | |
run: | | |
curl.exe -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"https://github.com/c3lang/win-llvm/releases/download/llvm_15_0_6/llvm-15.0.6-windows-x86-msvc17-msvcrt.7z | |
7z x llvm-15.0.6-windows-x86-msvc17-msvcrt.7z -oC:\ | |
Add-Content $env:GITHUB_PATH 'C:\llvm-15.0.6-windows-x86-msvc17-msvcrt\bin' | |
- run: llvm-config --version | |
- name: Generate LLVM pkgconfig file | |
run: | | |
swift package resolve | |
& "C:\Program Files\Git\bin\bash.exe" Tools/make-pkgconfig.sh llvm.pc | |
type llvm.pc | |
- run: llvm-config --version | |
- name: Prevent reentrant builds for speed | |
run: echo 'SPM_BUILD_TOOL_SUPPORT_NO_REENTRANT_BUILD=1' >> $env:GITHUB_ENV | |
- name: Build (Debug) | |
run: swift build --explicit-target-dependency-import-check error --build-tests --pkg-config-path . | |
- name: Test (Debug) | |
run: swift test --parallel --skip-build --pkg-config-path . |