Skip to content

Commit

Permalink
Introduce proptesting to more libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
cylewitruk committed Jul 30, 2024
1 parent c6613ae commit 65b85d2
Show file tree
Hide file tree
Showing 262 changed files with 7,942 additions and 26,693 deletions.
11 changes: 7 additions & 4 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
stacks-node = "run --package stacks-node --"
fmt-stacks = "fmt -- --config group_imports=StdExternalCrate,imports_granularity=Module"

# Uncomment to improve performance slightly, at the cost of portability
# * Note that native binaries may not run on CPUs that are different from the build machine
# [build]
# rustflags = ["-Ctarget-cpu=native"]
# For x86_64 CPUs, default to `native` and override in CI for release builds
# This makes it slightly faster for users running locally built binaries.
# This can cause trouble when building "portable" binaries, such as for docker,
# so disable it with the "portable" feature.
# TODO: Same for other targets?
[target.'cfg(all(target_arch = "x86_64", not(feature = portable))']
rustflags = ["-Ctarget-cpu=native"]

# Needed by perf to generate flamegraphs.
#[target.x86_64-unknown-linux-gnu]
Expand Down
19 changes: 8 additions & 11 deletions .github/actions/dockerfiles/Dockerfile.alpine-binary
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO
ARG REPO=stacks-network/stacks-core

RUN case ${TARGETPLATFORM} in \
linux/amd64/v2) BIN_ARCH=linux-glibc-x64-v2 ;; \
linux/amd64*) BIN_ARCH=linux-glibc-x64 ;; \
linux/arm64*) BIN_ARCH=linux-glibc-arm64 ;; \
linux/arm/v7) BIN_ARCH=linux-glibc-armv7 ;; \
*) exit 1 ;; \
RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"arm") BIN_ARCH=linux-musl-armv7 ;; \
"*") exit 1 ;; \
esac \
&& echo "TARGETPLATFORM: $TARGETPLATFORM" \
&& echo "BIN_ARCH: $BIN_ARCH" \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \
&& wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \
&& wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip \
&& unzip ${BIN_ARCH}.zip -d /out

FROM --platform=${TARGETPLATFORM} alpine
Expand Down
19 changes: 8 additions & 11 deletions .github/actions/dockerfiles/Dockerfile.debian-binary
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO
ARG REPO=stacks-network/stacks-core

RUN case ${TARGETPLATFORM} in \
linux/amd64/v2) BIN_ARCH=linux-glibc-x64-v2 ;; \
linux/amd64*) BIN_ARCH=linux-glibc-x64 ;; \
linux/arm64*) BIN_ARCH=linux-glibc-arm64 ;; \
linux/arm/v7) BIN_ARCH=linux-glibc-armv7 ;; \
*) exit 1 ;; \
RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"arm") BIN_ARCH=linux-musl-armv7 ;; \
"*") exit 1 ;; \
esac \
&& echo "TARGETPLATFORM: $TARGETPLATFORM" \
&& echo "BIN_ARCH: $BIN_ARCH" \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \
&& wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \
&& wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip \
&& unzip ${BIN_ARCH}.zip -d /out

FROM --platform=${TARGETPLATFORM} debian:bookworm
Expand Down
7 changes: 2 additions & 5 deletions .github/actions/dockerfiles/Dockerfile.debian-source
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
FROM rust:bookworm as build
FROM rust:bullseye as build

ARG STACKS_NODE_VERSION="No Version Info"
ARG GIT_BRANCH='No Branch Info'
ARG GIT_COMMIT='No Commit Info'
ARG BUILD_DIR=/build
ARG TARGET=x86_64-unknown-linux-gnu
# Allow us to override the default `--target-cpu` for the given target triplet
ARG TARGET_CPU
ENV RUSTFLAGS="${TARGET_CPU:+${RUSTFLAGS} -Ctarget-cpu=${TARGET_CPU}}"
WORKDIR /src

COPY . .
Expand All @@ -19,7 +16,7 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& rustup component add rustfmt \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json,portable --release --workspace --target ${TARGET} \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/atlas-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,3 @@ jobs:
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- atlas-tests
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
27 changes: 2 additions & 25 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
test-name:
- tests::bitcoin_regtest::bitcoind_integration_test
- tests::integrations::integration_test_get_info
- tests::neon_integrations::antientropy_integration_test
- tests::neon_integrations::antientropy_integration_test
- tests::neon_integrations::bad_microblock_pubkey
- tests::neon_integrations::bitcoind_forking_test
- tests::neon_integrations::bitcoind_integration_test
Expand Down Expand Up @@ -59,7 +59,6 @@ jobs:
- tests::neon_integrations::size_overflow_unconfirmed_stream_microblocks_integration_test
- tests::neon_integrations::stx_delegate_btc_integration_test
- tests::neon_integrations::stx_transfer_btc_integration_test
- tests::neon_integrations::stack_stx_burn_op_test
- tests::neon_integrations::test_chainwork_first_intervals
- tests::neon_integrations::test_chainwork_partial_interval
- tests::neon_integrations::test_flash_block_skip_tenure
Expand All @@ -71,33 +70,25 @@ jobs:
- tests::neon_integrations::use_latest_tip_integration_test
- tests::neon_integrations::confirm_unparsed_ongoing_ops
- tests::neon_integrations::min_txs
- tests::neon_integrations::vote_for_aggregate_key_burn_op_test
- tests::epoch_25::microblocks_disabled
- tests::should_succeed_handling_malformed_and_valid_txs
- tests::nakamoto_integrations::simple_neon_integration
- tests::nakamoto_integrations::mine_multiple_per_tenure_integration
- tests::nakamoto_integrations::block_proposal_api_endpoint
- tests::nakamoto_integrations::miner_writes_proposed_block_to_stackerdb
- tests::nakamoto_integrations::correct_burn_outs
- tests::nakamoto_integrations::vote_for_aggregate_key_burn_op
- tests::nakamoto_integrations::follower_bootup
- tests::signer::stackerdb_dkg
- tests::signer::stackerdb_sign
- tests::signer::stackerdb_block_proposal
- tests::signer::stackerdb_filter_bad_transactions
- tests::signer::stackerdb_mine_2_nakamoto_reward_cycles
- tests::signer::stackerdb_sign_after_signer_reboot
- tests::nakamoto_integrations::stack_stx_burn_op_integration_test
# Do not run this one until we figure out why it fails in CI
# - tests::neon_integrations::bitcoin_reorg_flap
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
with:
btc-version: "25.0"

## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
Expand All @@ -114,17 +105,3 @@ jobs:
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- integration-tests
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
86 changes: 53 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ on:
- reopened
- synchronize
- ready_for_review
paths-ignore:
- "**.md"
- "**.yml"
## might be better to use inclusive v exclusive paths here, ex:
# paths:
# - "**.rs"
# - "**.clar"
pull_request_review:
types:
- submitted

defaults:
run:
Expand All @@ -45,6 +55,15 @@ jobs:
## - PR review comment
## - PR change is requested
rustfmt:
if: |
!(
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
(
github.event.review.state == 'commented' ||
github.event.review.state == 'changes_requested'
)
)
name: Rust Format
runs-on: ubuntu-latest
steps:
Expand All @@ -70,9 +89,11 @@ jobs:
##
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
create-release:
if: |
inputs.tag != ''
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Create Release
needs:
- rustfmt
Expand All @@ -85,9 +106,22 @@ jobs:
##
## Runs when:
## - tag is not provided
## and the following are not true:
## - PR review submitted (not approved)
## and any of:
## - PR review comment
## - PR change is requested
docker-image:
if: |
inputs.tag == ''
inputs.tag == '' &&
!(
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
(
github.event.review.state == 'commented' ||
github.event.review.state == 'changes_requested'
)
)
name: Docker Image (Source)
uses: ./.github/workflows/image-build-source.yml
needs:
Expand All @@ -101,13 +135,19 @@ jobs:
## or:
## - no tag provided
## and any of:
## - PR is approved (any approval will trigger)
## - this workflow is called manually
## - PR is opened
## - commit to either (development, master) branch
create-cache:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
(
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
github.event.review.state == 'approved'
) ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
Expand All @@ -130,28 +170,16 @@ jobs:
##
## Runs when:
## - tag is provided
## or:
## - no tag provided
## and any of:
## - this workflow is called manually
## - PR is opened
## - PR added to merge queue
## - commit to either (development, next, master) branch
## either or of the following:
## - tag is not provided
## - PR is approved
stacks-core-tests:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
inputs.tag == '' || (
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
github.event.review.state == 'approved'
)
)
name: Stacks Core Tests
Expand All @@ -163,18 +191,10 @@ jobs:
bitcoin-tests:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
inputs.tag == '' || (
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
github.event.review.state == 'approved'
)
)
name: Bitcoin Tests
Expand Down
Loading

0 comments on commit 65b85d2

Please sign in to comment.