Skip to content

test commit

test commit #23

Workflow file for this run

name: "CI"
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- "LICENSE"
push:
paths-ignore:
- "docs/**"
- "**.md"
- "LICENSE"
branches:
- main
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1
CLICOLOR_FORCE: 1
permissions:
actions: read
contents: read
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Enable cargo cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-binstall
uses: cargo-bins/[email protected]
- name: Build
run: cargo build --release
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: llvm-tools-preview
- name: Enable cargo cache
uses: Swatinem/rust-cache@v2
with:
# Needed to make sure cargo-deny is correctly cached.
cache-all-crates: true
- name: Install cargo-binstall
uses: cargo-bins/[email protected]
- name: Install cargo-llvm-cov
run: cargo binstall --no-confirm --force cargo-llvm-cov
- name: Test
run: |
set -euxo pipefail
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
result=0
RUSTC_BOOTSTRAP=1 BRUSH_TEST_REPORT=0 cargo test --workspace -- -Z unstable-options --format junit >raw-test-output.txt 2>test-errors.txt || result=$?
if [[ -f test-errors.txt ]]; then
cat test-errors.txt
fi
cargo llvm-cov report --cobertura --output-path ./codecov.xml
# Process raw test output
n=1
while IFS= read -r line
do
if [[ ${line} == "<?xml"* ]]; then
((n++))
fi
echo "${line}" >>"test-results-${n}.xml"
done <raw-test-output.txt
exit ${result}
# - name: "Publish test results"
# uses: EnricoMi/publish-unit-test-result-action@v2
# if: always()
# with:
# files: |
# test-results-*.xml
- name: "Generate code coverage report"
uses: clearlyip/code-coverage-report-action@v4
id: "code_coverage_report"
if: ${{ github.actor != 'dependabot[bot]' }}
with:
artifact_download_workflow_names: "CI"
filename: "codecov.xml"
- name: "Upload code coverage report"
uses: actions/upload-artifact@v4
with:
name: codecov-reports
path: code-coverage-results.md
- name: "Upload event file"
uses: actions/upload-artifact@v4
with:
name: event-file
path: ${{ github.event_path }}
# - name: "Publish code coverage data to PR"
# uses: marocchino/sticky-pull-request-comment@v2
# if: ${{ github.actor != 'dependabot[bot]' && steps.code_coverage_report.outputs.file != '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
# with:
# path: code-coverage-results.md
check:
name: "Source code checks"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Enable cargo cache
uses: Swatinem/rust-cache@v2
with:
# Needed to make sure cargo-deny is correctly cached.
cache-all-crates: true
- name: Install cargo-binstall
uses: cargo-bins/[email protected]
- name: Format check
run: cargo fmt --check --all
- name: Check
run: cargo check --all-targets
- name: Deny check
run: |
set -euo pipefail
cargo binstall --no-confirm --force cargo-deny
cargo deny check
- name: Clippy check
run: cargo clippy --all-targets
benchmark:
if: github.event_name == 'pull_request'
name: "Benchmarks"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: pr
- name: Checkout
uses: actions/checkout@v4
with:
path: main
ref: main
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Enable cargo cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
./pr
./main
- name: Install cargo-binstall
uses: cargo-bins/[email protected]
- name: Performance analysis on PR
run: cargo bench --workspace -- --output-format bencher | tee benchmarks.txt
working-directory: pr
- name: Performance analysis on main
run: cargo bench --workspace -- --output-format bencher | tee benchmarks.txt
working-directory: main
- name: Upload performance results
uses: actions/upload-artifact@v4
with:
name: perf-reports
path: |
pr/benchmarks.txt
main/benchmarks.txt
# - name: Compare benchmark results
# uses: openpgpjs/github-action-pull-request-benchmark@v1
# if: ${{ github.actor != 'dependabot[bot]' }}
# with:
# name: "Time benchmark"
# tool: "cargo"
# pr-benchmark-file-path: pr/benchmarks.txt
# base-benchmark-file-path: main/benchmarks.txt
# comment-always: true
# alert-threshold: "130%"
# fail-on-alert: false
# fail-threshold: "150%"
# # A token is needed to leave commit comments
# github-token: ${{ secrets.GITHUB_TOKEN }}