Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tasks": {
"build": "cargo build --release"
}
}
25 changes: 12 additions & 13 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -36,22 +36,19 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install cargo-criterion
uses: actions-rs/[email protected]
with:
crate: cargo-criterion
version: latest
use-tool-cache: true
run: cargo install cargo-criterion
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Evaluate caching for cargo-criterion installation.

Similar to other installation steps, running cargo install for cargo-criterion on each workflow execution may slow down builds. Consider whether caching the result of this installation could lead to overall performance improvements.

Suggested implementation:

      - name: Cache dependencies

      - name: Cache cargo-criterion
        id: cache-cargo-criterion
        uses: actions/cache@v2
        with:
          path: ~/.cargo/bin/cargo-criterion
          key: ${{ runner.os }}-cargo-criterion-${{ hashFiles('**/Cargo.lock') }}

      - name: Install cargo-criterion
        if: steps.cache-cargo-criterion.outputs.cache-hit != 'true'
        run: cargo install cargo-criterion
        working-directory: .

Ensure that the cache key is appropriate for your project. If you later add custom flags or the version of cargo-criterion changes, update the key to force cache refresh.

working-directory: .

- name: Run benchmarks
uses: actions-rs/cargo@v1
with:
command: criterion
run: cargo criterion
working-directory: .

- name: Create benchmark results directory
run: mkdir -p target/criterion
working-directory: .

- name: Upload benchmark results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: target/criterion
Expand All @@ -65,9 +62,10 @@ jobs:
echo "Generated on $(date)" >> benchmark-report/README.md
echo "## Summary" >> benchmark-report/README.md
find target/criterion -name "*/new/estimates.json" -exec cat {} \; | jq -r '.mean | { command: .point_estimate, lower_bound: .confidence_interval.lower_bound, upper_bound: .confidence_interval.upper_bound }' >> benchmark-report/README.md || echo "No benchmark results found" >> benchmark-report/README.md
working-directory: .

- name: Upload benchmark report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: benchmark-report
path: benchmark-report
Expand All @@ -81,3 +79,4 @@ jobs:
cargo criterion --baseline main
git checkout ${{ github.sha }}
cargo criterion --baseline main
working-directory: .
69 changes: 27 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
name: Sanity Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -35,33 +35,29 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check
working-directory: .

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
run: cargo clippy -- -D warnings
working-directory: .

unit-tests:
name: Unit Tests
needs: sanity-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -70,27 +66,25 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --bins
run: cargo test --lib --bins
working-directory: .

e2e-tests:
name: End-to-End Tests
needs: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -99,46 +93,37 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release
run: cargo build --release
working-directory: .

- name: Run e2e tests
uses: actions-rs/cargo@v1
with:
command: test
args: --test main
run: cargo test --test main
working-directory: .

code-coverage:
name: Code Coverage
needs: [unit-tests, e2e-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Install cargo-tarpaulin
uses: actions-rs/[email protected]
with:
crate: cargo-tarpaulin
version: latest
use-tool-cache: true
run: cargo install cargo-tarpaulin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Consider caching the installation for cargo-tarpaulin.

Replacing the actions-based install with a direct cargo command improves simplicity, but installing cargo-tarpaulin every run could impact performance. Evaluate if caching the installed binary is feasible to reduce CI time.

Suggested implementation:

      - name: Cache cargo-tarpaulin
        id: cache-cargo-tarpaulin
        uses: actions/cache@v2
        with:
          path: ~/.cargo/bin/cargo-tarpaulin
          key: ${{ runner.os }}-cargo-tarpaulin

      - name: Install cargo-tarpaulin
        if: steps.cache-cargo-tarpaulin.outputs.cache-hit != 'true'
        run: cargo install cargo-tarpaulin
        working-directory: .

Ensure that the cache key is updated if you ever change the version of cargo-tarpaulin being installed,
so that a new version is installed when needed.
Also, verify the order of steps in your workflow so that the caching step runs before the installation.

working-directory: .

- name: Generate coverage report
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --out Xml --output-dir coverage
run: cargo tarpaulin --out Xml --output-dir coverage
working-directory: .

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
directory: ./coverage/
fail_ci_if_error: true
fail_ci_if_error: true
23 changes: 9 additions & 14 deletions .github/workflows/cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -37,19 +37,14 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build
working-directory: .

- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --bins
run: cargo test --lib --bins
working-directory: .

- name: Run e2e tests
uses: actions-rs/cargo@v1
with:
command: test
args: --test "*"
run: cargo test --test "*"
working-directory: .
continue-on-error: true
40 changes: 18 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,21 @@ jobs:
name: Build Release Binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Build release binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release
run: cargo build --release
working-directory: .

- name: Upload binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osvm-binary
path: target/release/osvm
Expand All @@ -40,10 +38,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Download binary
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: osvm-binary
path: ./
Expand All @@ -67,10 +65,10 @@ jobs:
needs: create-github-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Download binary
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: osvm-binary
path: ./
Expand All @@ -94,7 +92,7 @@ jobs:
dpkg-buildpackage -us -uc

- name: Upload Debian package
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osvm-deb-package
path: ../osvm_*.deb
Expand All @@ -112,7 +110,7 @@ jobs:
needs: create-github-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
Expand Down Expand Up @@ -144,7 +142,7 @@ jobs:
EOF

- name: Upload Homebrew formula
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osvm-homebrew-formula
path: ./osvm.rb
Expand All @@ -161,28 +159,26 @@ jobs:
needs: create-github-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- name: Generate documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --document-private-items
run: cargo doc --no-deps --document-private-items
working-directory: .

- name: Create index.html
run: |
echo '<meta http-equiv="refresh" content="0; url=osvm/index.html">' > target/doc/index.html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
force_orphan: true
force_orphan: true
Loading
Loading