Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added test-tube tests #4

Merged
merged 7 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
File renamed without changes.
38 changes: 38 additions & 0 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml

on:
push:
pull_request:
types: [opened]

name: Test tube integration tests

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78.0
target: wasm32-unknown-unknown
override: true
components: llvm-tools-preview
Comment on lines +15 to +25
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update action versions for checkout and Rust toolchain installation.

The configuration for the checkout and Rust toolchain installation steps is correct. However, the action versions should be updated to the latest stable versions for improved security and features:

  1. Update actions/checkout@v2 to actions/checkout@v3.
  2. Update actions-rs/toolchain@v1 to actions-rs/[email protected].

The Rust toolchain setup (version 1.78.0 with wasm32-unknown-unknown target) is appropriate for the project.

Apply this diff to update the action versions:

-        uses: actions/checkout@v2
+        uses: actions/checkout@v3

-        uses: actions-rs/toolchain@v1
+        uses: actions-rs/[email protected]
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout sources
uses: actions/checkout@v2
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78.0
target: wasm32-unknown-unknown
override: true
components: llvm-tools-preview
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
toolchain: 1.78.0
target: wasm32-unknown-unknown
override: true
components: llvm-tools-preview
Tools
actionlint

16-16: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


19-19: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


- name: Compile WASM contracts
uses: actions-rs/cargo@v1
with:
command: build
args: --release --lib --target wasm32-unknown-unknown --locked --workspace --exclude testenv
env:
RUSTFLAGS: "-C link-arg=-s"
Comment on lines +27 to +33
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update action version for WASM contract compilation.

The WASM contract compilation step is well-configured with appropriate compilation flags, target, and workspace exclusion. However, the action version should be updated:

  1. Update actions-rs/cargo@v1 to actions-rs/[email protected].

Apply this diff to update the action version:

-        uses: actions-rs/cargo@v1
+        uses: actions-rs/[email protected]
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Compile WASM contracts
uses: actions-rs/cargo@v1
with:
command: build
args: --release --lib --target wasm32-unknown-unknown --locked --workspace --exclude testenv
env:
RUSTFLAGS: "-C link-arg=-s"
- name: Compile WASM contracts
uses: actions-rs/cargo@v1.0.3
with:
command: build
args: --release --lib --target wasm32-unknown-unknown --locked --workspace --exclude testenv
env:
RUSTFLAGS: "-C link-arg=-s"
Tools
actionlint

28-28: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


- name: Run Integration Tests
uses: actions-rs/cargo@v1
with:
command: test
Comment on lines +35 to +38
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update action version and consider adding 'integration' feature flag for test execution.

The integration test execution step is correctly configured. However, two improvements can be made:

  1. Update actions-rs/cargo@v1 to actions-rs/[email protected].
  2. Consider adding the 'integration' feature flag to specifically run integration tests.

Apply this diff to update the action version and add the 'integration' feature flag:

-        uses: actions-rs/cargo@v1
+        uses: actions-rs/[email protected]
         with:
           command: test
+          args: --features integration

Using the 'integration' feature flag for running integration tests is a good practice for separating different types of tests and ensuring that only the intended tests are run in this workflow.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run Integration Tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Run Integration Tests
uses: actions-rs/[email protected]
with:
command: test
args: --features integration
Tools
actionlint

36-36: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

59 changes: 0 additions & 59 deletions .github/workflows/rust.yaml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml

on:
push:
pull_request:
types: [opened]

name: Unit tests + lints

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78.0
target: wasm32-unknown-unknown
override: true
components: llvm-tools-preview

- name: Compile WASM contracts
uses: actions-rs/cargo@v1
with:
command: build
args: --release --lib --target wasm32-unknown-unknown --locked --workspace --exclude testenv
env:
RUSTFLAGS: "-C link-arg=-s"

- name: Run Integration Tests
uses: actions-rs/cargo@v1
with:
command: test

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

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

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Show Clippy version
run: cargo clippy --version

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests -- -D warnings
Comment on lines +40 to +68
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update action versions in the lints job.

The lints job configuration is well-structured, but please update the action versions as suggested in the test job:

  1. Update the checkout action to v3.
  2. Update the Rust toolchain action to v1.5.0.
  3. Update the cargo action to v1.0.3.

The linting steps (cargo fmt and clippy) are appropriately configured to ensure code quality. Treating clippy warnings as errors (-D warnings) is a good practice for maintaining high code standards.

🧰 Tools
🪛 actionlint

45-45: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


48-48: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


56-56: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


65-65: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +1 to +68
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding caching and result reporting to enhance the workflow.

To further improve the efficiency and usefulness of your CI workflow, consider the following enhancements:

  1. Add caching for Rust dependencies to speed up builds:

    - uses: actions/cache@v3
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  2. Upload test results and code coverage information for better insights:

    • Use a tool like tarpaulin for code coverage.
    • Upload the results using GitHub Actions' built-in features or a third-party service.

Example for tarpaulin (add to the test job):

- name: Run tarpaulin
  uses: actions-rs/[email protected]
  with:
    version: '0.15.0'
    args: '-- --test-threads 1'

- name: Upload to codecov.io
  uses: codecov/codecov-action@v3

These additions will help optimize your CI pipeline and provide more comprehensive information about your project's health.

🧰 Tools
🪛 actionlint

16-16: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


19-19: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


28-28: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


36-36: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


45-45: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


48-48: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


56-56: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


65-65: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Loading
Loading