Skip to content

Commit

Permalink
Merge branch 'dev' - release v0.1.1
Browse files Browse the repository at this point in the history
Signed-off-by: mimir-d <[email protected]>
  • Loading branch information
mimir-d committed Oct 14, 2024
2 parents 32fa142 + 2d6bb74 commit 659d015
Show file tree
Hide file tree
Showing 51 changed files with 10,472 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
range: 95..98
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 1%
patch:
default:
informational: true

comment:
layout: "condensed_header, condensed_files"
require_changes: true
76 changes: 76 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: check

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:
fmt:
runs-on: ubuntu-latest
name: stable / fmt
steps:
- uses: actions/checkout@v4
- name: Install stable rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check

clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
# Get early warning of new lints which are regularly introduced in beta channels.
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.toolchain }} rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-check'
github_token: ${{ secrets.GITHUB_TOKEN }}

hack:
runs-on: ubuntu-latest
name: ubuntu / stable / features
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: cargo hack
run: cargo hack --feature-powerset --no-dev-deps check

doc:
runs-on: ubuntu-latest
name: nightly / doc
steps:
- uses: actions/checkout@v4
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-docs-rs
uses: dtolnay/install@cargo-docs-rs
- name: cargo docs-rs
run: cargo docs-rs
54 changes: 54 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: publish

on:
push:
branches: [main]

# only read-only for GITHUB_TOKEN
permissions:
contents: read

jobs:
publish_audit:
name: audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

publish_test:
name: test on ${{ matrix.os }} / stable
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo test --locked
run: cargo test --locked --all-features

publish:
name: publish to crates.io
needs:
- publish_audit
- publish_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: release
- name: cargo login
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
- name: Publish
run: |-
cargo release \
publish \
--all-features \
--allow-branch HEAD \
--no-confirm \
--execute
96 changes: 96 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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 -
"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
.vscode
Loading

0 comments on commit 659d015

Please sign in to comment.