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

Add std feature for std use #40

Merged
merged 4 commits into from
May 4, 2022
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
18 changes: 17 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,29 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
profile: dev
features: std
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
profile: release
features: std
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
profile: dev
features:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
profile: release
features:
- os: ubuntu-latest
target: wasm32-unknown-unknown
profile: release
features:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: rustup update stable && rustup default stable
- run: cargo build --verbose --profile ${{ matrix.profile }} --target ${{ matrix.target }}
- run: rustup target add ${{ matrix.target }}
- run: cargo build --verbose --profile ${{ matrix.profile }} --target ${{ matrix.target }} --no-default-features --features='${{ matrix.features }}'

test:
strategy:
Expand All @@ -44,4 +59,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: rustup update stable && rustup default stable
- run: rustup target add ${{ matrix.target }}
- run: cargo test --verbose --profile ${{ matrix.profile }} --target ${{ matrix.target }}
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ edition = "2021"

[dependencies]
base64 = "0.13.0"

[features]
default = ["std"]
std = ["base64/std"]
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ test: build
cargo test

build: src/xdr.rs
cargo build --profile dev
cargo build --profile release
cargo build --no-default-features --features 'std'
cargo build --no-default-features --features ''
cargo build --target wasm32-unknown-unknown --no-default-features --features ''

src/xdr.rs: $(XDR_FILES)
docker run -it --rm -v $$PWD:/wd -w /wd ruby /bin/bash -c '\
gem install specific_install -v 0.3.7 && \
gem specific_install https://github.com/leighmcculloch/stellar--xdrgen.git -b rust-no-deps && \
xdrgen \
--language rust \
--namespace xdr \
--namespace lib \
--output src/ \
$(XDR_FILES) \
'
rustfmt src/xdr.rs
rustfmt src/lib.rs

$(XDR_FILES):
curl -L -o $@ $(XDR_BASE_URL)/$@
Expand Down
Loading