Skip to content

Commit

Permalink
Next steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Jul 15, 2024
1 parent 65327c4 commit 68d01d0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 25 deletions.
23 changes: 1 addition & 22 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,39 +275,18 @@ jobs:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
- name: Prepare for coverage
if: matrix.os == 'ubuntu-latest'
run: |
cargo install grcov --locked
echo "RUSTFLAGS=-Cinstrument-coverage" >> "$GITHUB_ENV"
echo "LLVM_PROFILE_FILE=$(pwd)/target/chia_rs-%p-%m.profraw" >> "$GITHUB_ENV"
echo "CARGO_TARGET_DIR=$(pwd)/target" >> "$GITHUB_ENV"
- name: cargo test
run: cargo test --workspace --all-features
- name: cargo test (release)
run: cargo test --workspace --all-features --release

- name: Continue with coverage
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install lcov -y
rustup component add llvm-tools-preview
python -m venv venv
source venv/bin/activate
git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch
pip install ./clvm_tools
pip install colorama maturin pytest pytest-xdist chia-blockchain==2.1.2 clvm==0.9.8
maturin develop --release -m wheel/Cargo.toml
pytest tests
grcov . --binary-path target -s . --branch --ignore-not-existing --ignore='*/.cargo/*' --ignore='tests/*' --ignore='venv/*' -o rust_cov.info
python -c 'with open("rust_cov.info") as f: lines = [l for l in f if not (l.startswith("DA:") and int(l.split(",")[1].strip()) >= 2**63)]; open("lcov.info", "w").writelines(lines)'
- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
if: matrix.os == 'ubuntu-latest'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
path-to-lcov: "./lcov.info"
upload:
name: Upload to PyPI - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
Expand Down
50 changes: 47 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ on:
branches:
- "**"

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true

jobs:
build_crate:
name: Tests
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -34,8 +39,47 @@ jobs:
- name: Audit
run: cargo audit --ignore RUSTSEC-2023-0071

test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.5

- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin --locked

- name: Tests
run: cargo test --workspace --all-features --release
run: cargo tarpaulin --workspace --all-features --release --out lcov

- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
if: matrix.os == 'ubuntu-latest'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
path-to-lcov: "./lcov.info"

publish:
name: Publish
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.5

- name: Build
run: cargo build --release
Expand Down

0 comments on commit 68d01d0

Please sign in to comment.