v0.19.5 #85
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: Rust Unit Tests | |
on: [push, pull_request] | |
permissions: | |
checks: write | |
pull-requests: write | |
jobs: | |
unit-tests: | |
name: Internal Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Install cargo2junit | |
run: cargo install cargo2junit | |
- name: Install cargo-audit | |
run: cargo install cargo-audit | |
- name: Run cargo audit | |
run: cargo audit | |
- name: Run Clippy | |
uses: clechasseur/rs-clippy-check@v3 | |
with: | |
args: --all-features | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: RUSTC_BOOTSTRAP=1 cargo test -- -Z unstable-options --format json --report-time | tee results.json | |
- name: Convert to JUnit | |
run: cat results.json | cargo2junit > results.xml | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
id: test-results | |
if: always() | |
with: | |
files: results.xml | |
- name: Set badge color | |
shell: bash | |
run: | | |
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in | |
success) | |
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV | |
;; | |
failure) | |
echo "BADGE_COLOR=800000" >> $GITHUB_ENV | |
;; | |
neutral) | |
echo "BADGE_COLOR=696969" >> $GITHUB_ENV | |
;; | |
esac | |
- name: Create badge | |
uses: emibcn/[email protected] | |
with: | |
label: Tests | |
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}' | |
color: ${{ env.BADGE_COLOR }} | |
path: badge.svg | |
- name: Upload badge to Gist | |
# Upload only for master branch | |
if: > | |
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' || | |
github.event_name != 'workflow_run' && github.ref == 'refs/heads/main' | |
uses: andymckay/[email protected] | |
with: | |
token: ${{ secrets.GIST_TOKEN }} | |
gistURL: https://gist.github.com/Danconnolly/9154c08943fa65569d4307fd1a2ab461 | |
file: badge.svg | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: [stable] | |
bsvversion: | |
[ | |
"1.0.16", | |
] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Running test script | |
env: | |
BSVVERSION: ${{ matrix.bsvversion }} | |
run: ./integration_test/test_all.sh |