Merge pull request #434 from SierraSoftworks/dependabot/cargo/clap-4.… #920
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 Changes | |
on: [push] | |
jobs: | |
test-platforms: | |
name: ${{ matrix.os }}-${{ matrix.arch }}-test | |
runs-on: ${{ matrix.run_on }} | |
continue-on-error: ${{ matrix.experimental || false }} | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
os: windows | |
run_on: windows-latest | |
target: x86_64-pc-windows-msvc | |
- arch: amd64 | |
run_on: ubuntu-20.04 | |
os: linux | |
target: x86_64-unknown-linux-gnu | |
setup: | | |
sudo apt-get update | |
sudo apt-get install -y libdbus-1-3 libdbus-1-dev | |
- arch: amd64 | |
run_on: macos-latest | |
os: darwin | |
target: x86_64-apple-darwin | |
steps: | |
- name: setup dependencies | |
run: ${{ matrix.setup }} | |
if: matrix.setup | |
- uses: actions/checkout@v4.2.1 | |
- name: rustup install nightly | |
uses: actions-rs/toolchain@v1.0.7 | |
with: | |
toolchain: nightly | |
profile: minimal | |
target: ${{ matrix.target }} | |
override: true | |
components: llvm-tools-preview | |
- name: cache ~/.cargo | |
uses: Swatinem/rust-cache@v2 | |
- name: install protoc | |
run: | | |
if ('${{ matrix.os }}' -eq 'windows') { | |
$protoc_arch = 'win64' | |
} elseif ('${{ matrix.os }}' -eq 'darwin') { | |
$protoc_arch = 'osx-x86_64' | |
} else { | |
$protoc_arch = 'linux-x86_64' | |
} | |
$protoc_url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.20.2/protoc-3.20.2-$protoc_arch.zip" | |
Write-Host "Downloading protoc from '$protoc_url'" | |
Invoke-WebRequest -OutFile protoc.zip -Uri $protoc_url | |
Expand-Archive protoc.zip -DestinationPath ../tools | |
Add-Content -Path $env:GITHUB_PATH -Value "$((Get-Item ./).Parent.FullName)/tools/bin" | |
shell: pwsh | |
- name: cargo build | |
uses: actions-rs/cargo@v1.0.3 | |
if: matrix.skiptests | |
with: | |
command: build | |
args: --target ${{ matrix.target }} ${{ matrix.flags }} | |
- name: cargo test | |
uses: actions-rs/cargo@v1.0.3 | |
if: "!matrix.skiptests" | |
with: | |
command: test | |
args: --no-fail-fast --target ${{ matrix.target }} ${{ matrix.flags }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RUSTFLAGS: "-C instrument_coverage" | |
LLVM_PROFILE_FILE: default.profraw | |
- name: install rustfilt | |
uses: actions-rs/cargo@v1.0.3 | |
if: "!matrix.skiptests" | |
with: | |
command: install | |
args: rustfilt | |
- name: prepare coverage output | |
shell: pwsh | |
if: "!matrix.skiptests" | |
run: | | |
Write-Host "Merging raw profile output files" | |
&"$(rustc --print target-libdir)/../bin/llvm-profdata" merge -sparse default.profraw -o default.profdata | |
$latest_asset = Get-ChildItem -Path ./target/${{ matrix.target }}/debug/deps -Filter "buckle-*" -File ` | |
| Where-Object { $_.Name.EndsWith(".exe") -or (-not $_.Name.Contains(".")) } ` | |
| Sort-Object -Top 1 -Property LastWriteTime | |
Write-Host "Latest Asset: $latest_asset" | |
Write-Host "Exporting LCOV coverage report" | |
&"$(rustc --print target-libdir)/../bin/llvm-cov" export -instr-profile default.profdata $latest_asset ` | |
-Xdemangler=rustfilt ` | |
-ignore-filename-regex='.cargo|rustc' ` | |
-compilation-dir=src ` | |
-format=lcov > lcov.info | |
- name: codecov upload | |
uses: codecov/codecov-action@v4 | |
if: "!matrix.skiptests" | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
test-docker: | |
name: Docker Build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4.2.1 | |
- run: | | |
docker build -t buckle:latest -f build/Dockerfile.linux-x86_64 . | |
docker run --rm buckle:latest buckle --version | |
test-done: | |
name: Tests Complete | |
needs: test-platforms | |
runs-on: ubuntu-20.04 | |
steps: | |
- run: echo "Tests Complete for All Platforms" |