Skip to content

Fixed build with relative path #293

Fixed build with relative path

Fixed build with relative path #293

name: Cargo build and test
on:
push:
branches: [ develop, main, release/**, hotfix/** ]
pull_request:
branches: [ develop, main, release/**, hotfix/** ]
jobs:
build_and_test:
name: Build and test Stellar SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crusty-pie/toolchain@v1
with:
toolchain: stable
targets: x86_64-unknown-linux-musl
override: true
components: llvm-tools-preview
- name: Download grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: cargo update
run: cargo update --manifest-path=stellar_rust_sdk/Cargo.toml
- name: cargo test
run: |
mkdir -p ./coverage
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test --manifest-path=stellar_rust_sdk/Cargo.toml
grcov . --binary-path ./stellar_rust_sdk/target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o ./coverage/tests.lcov
- name: Check test coverage
uses: tluijken/code-coverage-threshold@v1
with:
coverage-file: ./coverage/tests.lcov
minimum-coverage: 90
publish_to_crates_io:
name: "Publish to crates.io"
runs-on: ubuntu-latest
needs: build_and_test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: "Overwrite version numbers"
run: |
awk 'NR==1,/version = "0.1.0"/{sub(/version = "0.1.0"/, "version = \"'$GitVersion_SemVer'\"")} 1' stellar_rust_sdk/stellar_rust_sdk_derive/Cargo.toml > stellar_rust_sdk/stellar_rust_sdk_derive/Cargo.tmp && mv stellar_rust_sdk/stellar_rust_sdk_derive/Cargo.tmp stellar_rust_sdk/stellar_rust_sdk_derive/Cargo.toml
awk 'NR==1,/version = "0.1.0"/{sub(/version = "0.1.0"/, "version = \"'$GitVersion_SemVer'\"")} 1' stellar_rust_sdk/Cargo.toml > stellar_rust_sdk/Cargo.tmp && mv stellar_rust_sdk/Cargo.tmp stellar_rust_sdk/Cargo.toml
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
args: --allow-dirty
path: stellar_rust_sdk