Set up benchmarks (#138) #1
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: "CI" | |
on: [push, pull_request] | |
jobs: | |
soundness: | |
name: Soundness Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.0 | |
- name: Bootstrap Mint | |
uses: irgaly/setup-mint@v1 | |
- name: Run soundness | |
run: | | |
scripts/soundness.sh | |
exit $(git status --porcelain | wc -l) | |
unit-test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
swift: [5.9, latest] | |
steps: | |
- name: Install Swift | |
uses: vapor/swiftly-action@v0.1 | |
with: | |
toolchain: ${{ matrix.swift }} | |
env: | |
SWIFTLY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4.2.0 | |
- name: Cache Swift PM | |
uses: actions/cache@v4.0.2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-${{ matrix.swift }}-ci-spm-${{ hashFiles('Package.swift') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.swift }}-ci-spm- | |
- name: Resolve Swift dependencies | |
run: swift package resolve | |
- name: Run Unit Tests | |
run: swift test --parallel --enable-code-coverage | |
- name: Merge code coverage | |
if: matrix.swift == '5.9' | |
run: | | |
llvm-cov export -format "lcov" \ | |
.build/debug/swift-otelPackageTests.xctest \ | |
-ignore-filename-regex="\/Tests\/" \ | |
-ignore-filename-regex="\/Generated\/" \ | |
-ignore-filename-regex="\/.build\/" \ | |
-instr-profile=./.build/debug/codecov/default.profdata \ | |
> info.lcov | |
- name: Upload code coverage report to Codecov | |
if: matrix.swift == '5.9' | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ./info.lcov | |
compile-counter-example: | |
name: Compile Counter Example | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./Examples/Counter | |
steps: | |
- name: Install Swift | |
uses: vapor/swiftly-action@v0.1 | |
with: | |
toolchain: latest | |
env: | |
SWIFTLY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4.2.0 | |
- name: Resolve Swift dependencies | |
run: swift package resolve | |
- name: Build | |
run: swift build |