Skip to content

Commit

Permalink
Add std default feature (#30)
Browse files Browse the repository at this point in the history
The base types will be used in constrained environments such as WASM.

A no-std build is required to allow these types to be used.
  • Loading branch information
vlopes11 authored and xgreenx committed Dec 20, 2022
1 parent 80d8714 commit a340cd7
Show file tree
Hide file tree
Showing 19 changed files with 574 additions and 479 deletions.
38 changes: 37 additions & 1 deletion fuel-tx/.github/workflows/cargo_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ jobs:
toolchain: stable
override: true


# Using thumbv6m-none-eabi as ARMv6-M arbitrary common choice for a bare-minimum target.
# More info: https://docs.rs/cortex-m-rt/latest/cortex_m_rt/
#
# Can be replaced by other targets that guarantee bare-minimum no-std
- name: Install toolchain no-std
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: thumbv6m-none-eabi
override: true

- name: Install rustfmt
run: rustup component add rustfmt

Expand All @@ -48,13 +60,37 @@ jobs:
command: build
args: --verbose

- name: Build no-std
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target thumbv6m-none-eabi --no-default-features

- name: Build no-std serde
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target thumbv6m-none-eabi --no-default-features --features serde-types-minimal

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose

- name: Run tests
- name: Run tests no-std
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features

- name: Run tests serde no-std
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features --features serde-types-minimal

- name: Run tests serde
uses: actions-rs/cargo@v1
with:
command: test
Expand Down
30 changes: 24 additions & 6 deletions fuel-tx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,29 @@ repository = "https:/FuelLabs/fuel-tx"
description = "FuelVM transaction."

[dependencies]
fuel-asm = { git = "ssh://[email protected]/FuelLabs/fuel-asm.git" }
itertools = "0.10"
rand = "0.8"
serde = { version = "1.0", features = ["derive"], optional = true }
sha2 = "0.9"
fuel-asm = { git = "ssh://[email protected]/FuelLabs/fuel-asm.git", default-features = false }
itertools = { version = "0.10", optional = true }
rand = { version = "0.8", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
sha2 = { version = "0.9", optional = true }

[features]
serde-types = ["serde", "fuel-asm/serde-types"]
default = [ "fuel-asm/default", "std" ]
std = [ "fuel-asm/std", "itertools", "rand", "sha2" ]
serde-types = [ "fuel-asm/serde-types", "serde-types-minimal", "serde/default", "std" ]
serde-types-minimal = [ "fuel-asm/serde-types-minimal", "serde" ]

[[test]]
name = "test-bytes"
path = "tests/bytes.rs"
required-features = ["std"]

[[test]]
name = "test-offsets"
path = "tests/offset.rs"
required-features = ["std"]

[[test]]
name = "test-valid"
path = "tests/valid.rs"
required-features = ["std"]
Loading

0 comments on commit a340cd7

Please sign in to comment.