replacing tek-engineering with tektronix #1
Workflow file for this run
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: Pull Request | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- closed | |
push: | |
tags: | |
- '*' | |
jobs: | |
style: | |
name: Style | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tektronix/tsp-toolkit-build:latest | |
credentials: | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
steps: | |
- name: Tool Versions | |
run: cargo fmt --version | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check Style | |
run: cargo fmt --check --verbose | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tektronix/tsp-toolkit-build:latest | |
credentials: | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
steps: | |
- name: Tool Versions | |
run: cargo clippy --version | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Lint | |
run: cargo clippy | |
sbom: | |
name: Generate CycloneDX | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tektronix/tsp-toolkit-build:latest | |
credentials: | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Generate Rust BOM | |
run: cargo cyclonedx --format json --all --describe crate -vvv | |
- name: Upload Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: software-bom | |
path: | | |
**/*.cdx.json | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tektronix/tsp-toolkit-build:latest | |
credentials: | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
steps: | |
- name: Tool Versions | |
run: | | |
# TODO reinstate after this issue closes: https://github.com/xd009642/tarpaulin/issues/1493 | |
# cargo install cargo-tarpaulin | |
# cargo tarpaulin --version | |
cargo --version | |
grcov --version | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prebuild | |
run: mkdir -p ${{env.CARGO_HOME}}; cargo build --tests | |
env: | |
CARGO_HOME: ".cargo" | |
TEST_DIR: "test-results" | |
- name: Run Tests | |
run: | | |
mkdir -p "${{env.TEST_DIR}}" | |
# TODO reinstate after this issue closes: https://github.com/xd009642/tarpaulin/issues/1493 | |
# cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --engine llvm --out xml --output-dir ${{env.TEST_DIR}} | |
cargo test --all -- -Z unstable-options --format json --report-time > ${{env.TEST_DIR}}/cargo_test.json | |
env: | |
CARGO_HOME: ".cargo" | |
TEST_DIR: "test-results" | |
# - name: Process Test Results | |
# run: | | |
# cat ${{env.TEST_DIR}}/cargo_test.json | cargo2junit > ${{env.TEST_DIR}}/report.xml | |
# env: | |
# CARGO_HOME: ".cargo" | |
# TEST_DIR: "test-results" | |
- name: Upload Results | |
uses: actions/upload-artifact@v3 | |
if: ${{always()}} | |
env: | |
CARGO_HOME: ".cargo" | |
TEST_DIR: "test-results" | |
with: | |
name: unit-test-report | |
path: | | |
${{env.TEST_DIR}} | |
code_coverage: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Download Test Results | |
uses: actions/download-artifact@v3 | |
with: | |
name: unit-test-report | |
path: test-results | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Code Coverage Report | |
uses: irongut/[email protected] | |
continue-on-error: true | |
with: | |
filename: test-results/cobertura.xml | |
badge: true | |
format: markdown | |
hide_branch_rate: true | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: "30 50" | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
continue-on-error: true | |
if: github.event_name == 'pull_request' | |
with: | |
header: Test Coverage | |
path: code-coverage-results.md | |
build: | |
name: Build | |
strategy: | |
matrix: | |
target_triple: | |
- x86_64-pc-windows-gnu | |
- x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tektronix/tsp-toolkit-build:latest | |
credentials: | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
steps: | |
- name: Tool Versions | |
run: rustc --version | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
run: cargo build --target "${{matrix.target_triple}}" --release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: executable | |
path: | | |
target/${{matrix.target_triple}}/release/kic* | |
!target/${{matrix.target_triple}}/**/*.d | |
!target/${{matrix.target_triple}}/**/*.rlib | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
checks: write | |
pull-requests: read | |
needs: | |
- build | |
- lint | |
- style | |
- test | |
- code_coverage | |
- sbom | |
if: ${{ endsWith(github.base_ref, 'main') && contains(github.head_ref, 'release') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Get RC Version | |
id: lasttag | |
run: | | |
COMMIT="${{github.sha}}" | |
V="${{github.head_ref}}" | |
V="${V#release/}" | |
if ${{! github.event.pull_request.merged}}; then | |
V="${V}-$(git tag --list ${V}* | wc -l)" | |
fi | |
CL=${V#v} | |
CL=${CL%-*} | |
echo "version=${V}" >> $GITHUB_OUTPUT | |
echo "cl_version=${CL}" >> $GITHUB_OUTPUT | |
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT | |
- run: 'git tag --list ${V}*' | |
- name: Get SBOM | |
uses: actions/download-artifact@v3 | |
with: | |
name: software-bom | |
path: sbom | |
- name: Get Changelog for this Tag | |
id: changelog | |
uses: coditory/changelog-parser@v1 | |
with: | |
version: ${{steps.lasttag.outputs.cl_version}} | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{steps.lasttag.outputs.version}} | |
artifacts: sbom/**/* | |
body: | | |
## Features Requests / Bugs | |
If you find issues or have a feature request, please enter a [new issue on GitHub](${{github.server_url}}/${{github.repository}}/issues/new). | |
## Installation | |
View the installation instructions in the [README](${{github.server_url}}/${{github.repository}}/blob/main/README.md) | |
## Changelog | |
${{steps.changelog.outputs.description}} | |
prerelease: ${{! github.event.pull_request.merged}} | |
commit: ${{steps.lasttag.outputs.commit}} | |
makeLatest: true | |
tag: ${{steps.lasttag.outputs.version}} | |