get the core dump #705
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python wheels | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
pull_request: | |
branches: | |
- "**" | |
concurrency: | |
group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
unit_tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
repeats: | |
[ | |
0, | |
1, | |
2, | |
3, | |
4, | |
5, | |
6, | |
7, | |
8, | |
9, | |
10, | |
11, | |
12, | |
13, | |
14, | |
15, | |
16, | |
17, | |
18, | |
19, | |
20, | |
21, | |
22, | |
23, | |
24, | |
25, | |
26, | |
27, | |
28, | |
29, | |
30, | |
31, | |
32, | |
33, | |
34, | |
35, | |
36, | |
37, | |
38, | |
39, | |
40, | |
41, | |
42, | |
43, | |
44, | |
45, | |
46, | |
47, | |
48, | |
49, | |
] | |
name: Unit tests | |
steps: | |
# the test files are read verbatim, making it problematic if git is | |
# allowed to insert \r when checking out files | |
- name: disable git autocrlf | |
run: | | |
git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- 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: 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 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: executable-${{ matrix.repeats }} | |
path: | | |
venv/bin/python | |
wheel/python/chia_rs/*.so | |
- name: Set cores to get stored in /cores | |
run: | | |
sudo mkdir /cores | |
sudo chmod 777 /cores | |
# Core filenames will be of the form executable.pid.timestamp: | |
sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern' | |
- name: actually test | |
run: | | |
source venv/bin/activate | |
# Allow core dumps | |
ulimit -c unlimited | |
# run pytest in a single process to avoid a race writing the coverage report | |
pytest -n 0 tests | |
- uses: actions/upload-artifact@v4 | |
if: ${{ failure() }} # Run only if something went wrong | |
with: | |
name: cores-${{ matrix.repeats }} | |
path: /cores | |
- name: the rest | |
run: | | |
source venv/bin/activate | |
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)' |