Skip to content

Commit

Permalink
Add std feature for std use (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored May 4, 2022
1 parent 05a9a13 commit 1fa7c3e
Show file tree
Hide file tree
Showing 5 changed files with 17,467 additions and 16,812 deletions.
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

0 comments on commit 1fa7c3e

Please sign in to comment.