-
Notifications
You must be signed in to change notification settings - Fork 5
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
Changes from 4 commits
ab4cd9f
1f3766f
7372546
7aefb9a
40ee93c
c0bf3df
65872d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,39 @@ | ||||||||||||||||||||||||||||||
# 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 | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
- 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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:
Apply this diff to update the action version: - uses: actions-rs/cargo@v1
+ uses: actions-rs/[email protected] Committable suggestion
Suggested change
Toolsactionlint
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
- name: Run Integration Tests | ||||||||||||||||||||||||||||||
uses: actions-rs/cargo@v1 | ||||||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||||||
command: test | ||||||||||||||||||||||||||||||
Comment on lines
+35
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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:
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
Suggested change
Toolsactionlint
|
||||||||||||||||||||||||||||||
args: --features integration | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update action version and approve integration test setup. The integration test execution step is well-configured, but the action version should be updated:
Using the 'integration' feature flag for running integration tests is a good practice for separating different types of tests. Apply this diff to update the action version: - uses: actions-rs/cargo@v1
+ uses: actions-rs/[email protected] Committable suggestion
Suggested change
Toolsactionlint
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# 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: Run Integration Tests | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Update Rust toolchain version to the latest stable release. The current Rust toolchain version specified ( - name: Install Rust Toolchain
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: 1.81.0
target: wasm32-unknown-unknown
override: true
components: llvm-tools-preview Analysis chainUpdate action versions and verify Rust toolchain version. While the test job configuration is generally correct, there are some improvements to be made:
To verify the latest Rust version, you can run: Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
curl -s https://static.rust-lang.org/dist/channel-rust-stable.toml | grep -m 1 "version ="
Length of output: 115 Script: #!/bin/bash
# Fetch the latest Rust stable version from channel-rust-stable.toml
curl -s https://static.rust-lang.org/dist/channel-rust-stable.toml | grep '^version =' | head -n 1 | awk -F '"' '{print $2}'
Length of output: 156 Script: #!/bin/bash
# Fetch the channel-rust-stable.toml and display lines containing 'version ='
curl -s https://static.rust-lang.org/dist/channel-rust-stable.toml | grep 'version ='
Length of output: 797 Toolsactionlint
|
||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
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. Toolsactionlint
Comment on lines
+40
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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:
The linting steps (cargo fmt and clippy) are appropriately configured to ensure code quality. Treating clippy warnings as errors ( 🧰 Tools🪛 actionlint
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
actions/checkout@v2
toactions/checkout@v3
.actions-rs/toolchain@v1
toactions-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:
Committable suggestion
Tools
actionlint