-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move udev discovery handler from core Akri repo
Signed-off-by: Kate Goldenring <[email protected]>
- Loading branch information
1 parent
d6d906b
commit 2cf1e49
Showing
32 changed files
with
8,743 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Thank you for contributing to the Akri Udev Discovery Handler repo! Before submitting this PR, please make sure: | ||
1. Read the Contributing Guide before submitting your PR: https://docs.akri.sh/community/contributing | ||
1. If this PR closes another issue, add 'closes #<issue number>' somewhere in the PR summary. GitHub will automatically close that issue when this PR gets merged. Alternatively, adding 'refs #<issue number>' will not close the issue, but help provide the reviewer more context. --> | ||
|
||
**What this PR does / why we need it**: | ||
|
||
**Special notes for your reviewer**: | ||
|
||
**If applicable**: | ||
- [ ] this PR has an associated PR with documentation in [akri-docs](https://github.com/project-akri/akri-docs) | ||
- [ ] this PR contains unit tests | ||
- [ ] added code adheres to standard Rust formatting (`cargo fmt`) | ||
- [ ] code builds properly (`cargo build`) | ||
- [ ] code is free of common mistakes (`cargo clippy`) | ||
- [ ] all tests succeed (`cargo test`) | ||
- [ ] inline documentation builds (`cargo doc`) | ||
- [ ] all commits pass the [DCO bot check](https://probot.github.io/apps/dco/) by being signed off -- see the failing DCO check for instructions on how to retroactively sign commits |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build and Push Production Udev Discovery Handler Container | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- .github/workflows/build-rust-code.yml | ||
- build/Dockerfile.rust | ||
- '**.rs' | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
- version.txt | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 50 | ||
env: | ||
AKRI_COMPONENT: "udev-discovery-handler" | ||
|
||
steps: | ||
- name: Checkout the head commit of the branch | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Get discovery handler version | ||
id: version-string | ||
run: | | ||
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker meta | ||
uses: docker/metadata-action@v5 | ||
id: meta | ||
with: | ||
images: ghcr.io/project-akri/akri/${{ env.AKRI_COMPONENT }} | ||
labels: | | ||
org.opencontainers.image.title=akri-${{env.AKRI_COMPONENT}} | ||
tags: | | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build-args: | | ||
AKRI_COMPONENT=${{env.AKRI_COMPONENT}} | ||
EXTRA_CARGO_ARGS=--release | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
file: build/Dockerfile.rust | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Check Rust | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- .github/workflows/check-rust.yml | ||
- '**.rs' | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- .github/workflows/check-rust.yml | ||
- '**.rs' | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- name: Checkout the head commit of the branch | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Rust install | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: 1.68.1 | ||
components: clippy, rustfmt | ||
- name: Install Linux requirements | ||
run: | | ||
apt_dependencies="git curl libssl-dev pkg-config libudev-dev" | ||
echo "Run apt update and apt install the following dependencies: $apt_dependencies" | ||
sudo apt update | ||
sudo apt install -y $apt_dependencies | ||
- name: Check rust format | ||
run: cargo fmt --all -- --check | ||
- name: Check clippy | ||
run: cargo clippy --all | ||
- name: Check clippy for tests | ||
run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::derive_partial_eq_without_eq | ||
- name: Run check | ||
run: cargo check | ||
- name: Run tests | ||
run: cargo test --workspace | ||
- name: Run doc | ||
run: export RUSTDOCFLAGS="-Dwarnings" && cargo doc --no-deps |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Tarpaulin Code Coverage | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- .github/workflows/run-tarpaulin.yml | ||
- '**.rs' | ||
- '**/Cargo.toml' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- .github/workflows/run-tarpaulin.yml | ||
- '**.rs' | ||
- '**/Cargo.toml' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_VERSION: 1.68.1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
# There is a second, hidden timeout in this workflow. When the tarpaulin container is created, | ||
# it is created with a CMD that sleeps for 600 minutes. A more reasonable value could be selected, | ||
# but it seems easier to make it SOOOO big that timeout-minutes is likely to never be impacted by | ||
# it. | ||
# | ||
# But, if this workflow is mysteriously timing out after 600 minutes, make changes to the docker | ||
# create command in the Create tarpaulin instance step. | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- name: Checkout the head commit of the branch | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Create tarpaulin instance | ||
run: docker create --network host --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin:0.25.1 bash -c "echo 'sleep 600m; echo bye' > /tmp/keep_alive.sh; chmod 777 /tmp/keep_alive.sh; /tmp/keep_alive.sh" > container_id.txt | ||
- name: Start tarpaulin instance | ||
run: docker start $(cat container_id.txt) | ||
- name: Install linux requirement in tarpaulin instance | ||
run: docker exec $(cat container_id.txt) sh -c "echo Run apt update and apt install the following dependencies - git curl libssl-dev pkg-config libudev-dev ; apt update ; apt install -y git curl libssl-dev pkg-config libudev-dev" | ||
- name: Install desired rust version | ||
run: docker exec $(cat container_id.txt) sh -c "rustup install $CARGO_VERSION" | ||
- name: Tell cargo to use desired rust version | ||
run: docker exec $(cat container_id.txt) sh -c "rustup override set $CARGO_VERSION" | ||
- name: Install rust requirements in tarpaulin instance | ||
run: docker exec $(cat container_id.txt) sh -c "rustup component add rustfmt" | ||
- name: Run tarpaulin | ||
run: docker exec $(cat container_id.txt) sh -c "RUST_LOG=trace cargo tarpaulin -v --all-features --out Xml" | ||
|
||
- name: Upload report to codecov for push | ||
if: (!(startsWith(github.event_name, 'pull_request'))) | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
fail_ci_if_error: true | ||
verbose: true | ||
|
||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: code-coverage-report | ||
path: cobertura.xml |
Oops, something went wrong.