name: Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
sonarqube:
name: SonarQube
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
fetch-depth: 0
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
test:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 with:
path: spire/build
key: ${{ runner.os }}-spire-build-${{ hashFiles('spire/Makefile') }}
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 with:
path: spire/bin
key: ${{ runner.os }}-spire-bin-${{ hashFiles('spire/Makefile') }}
- uses: taiki-e/install-action@a79b10393ebff625d820b524ff726bbcc77ac20b - uses: taiki-e/install-action@94a99045a72830168b8eae8bf767ba08abeca856 - name: format
run: cargo fmt --check
- name: lint
run: cargo clippy -- -D warnings
- name: build spire
run: make -C spire SHELL=/bin/bash
- name: start spire
run: make up SHELL=/bin/bash
- name: test
run:
SPIFFE_ENDPOINT_SOCKET=unix:///tmp/spire-agent/public/api.sock
cargo llvm-cov nextest --profile ci
- name: generate coverage report
run: cargo llvm-cov report --codecov --output-path coverage.json
- name: upload codecov test report
if: ${{ !cancelled() }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: upload codecov coverage report
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 with:
token: ${{ secrets.CODECOV_TOKEN }}