Skip to content

Merge branch 'dev' - release v0.1.3 #86

Merge branch 'dev' - release v0.1.3

Merge branch 'dev' - release v0.1.3 #86

Workflow file for this run

name: test
on:
push:
branches: [dev, main]
pull_request:
# only read-only for GITHUB_TOKEN
permissions:
contents: read
# cancel old jobs since their results will be discarded anyway
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
required:
runs-on: ubuntu-latest
name: ubuntu / ${{ matrix.toolchain }}
strategy:
matrix:
# run on stable and beta to ensure that tests won't break on the next version of the rust
# toolchain
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: cargo test --locked
run: cargo test --locked --all-features
os-check:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / stable
strategy:
fail-fast: false
matrix:
# ubuntu-latest is covered in `required`
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo test
run: cargo test --locked --all-features --all-targets
coverage:
runs-on: ubuntu-latest
name: ubuntu / stable / coverage
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo llvm-cov
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
- name: Record Rust version
run: echo "RUSTVER=$(rustc --version)" >> "$GITHUB_ENV"
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,RUSTVER
spec:
runs-on: ubuntu-latest
name: examples / spec validation
steps:
- uses: actions/checkout@v4
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
- name: pull validator
run: git clone https://github.com/opencomputeproject/ocp-diag-core.git --depth=1
- name: Install go
uses: actions/setup-go@v2
with:
go-version: "1.17.6"
- name: run validator against examples
run: |
ROOT="$(pwd)"
cd ocp-diag-core/validators/spec_validator
cargo metadata --manifest-path $ROOT/Cargo.toml --format-version 1 |
jq -r '.["packages"][] | select(.name == "ocptv") | .targets[] | select(.kind[0] == "example") | .name' |
xargs -I{} bash -c "
echo validating output of example {}... &&
cargo run --manifest-path $ROOT/Cargo.toml --example {} |
tee /dev/stderr |
go run . -schema ../../json_spec/output/root.json -
"