Skip to content

Commit

Permalink
Merge branch 'chore/merge-master-to-develop' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
obycode committed Sep 7, 2023
2 parents edb4b72 + 4c5dc7e commit b791638
Show file tree
Hide file tree
Showing 376 changed files with 47,116 additions and 46,183 deletions.
6 changes: 3 additions & 3 deletions .github/actions/bitcoin-int-tests/Dockerfile.atlas-test
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ COPY . .

RUN cargo test --no-run --workspace

RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

RUN ln -s /bitcoin-0.20.0/bin/bitcoind /bin/
RUN ln -s /bitcoin-25.0/bin/bitcoind /bin/

ENV BITCOIND_TEST 1
WORKDIR /src/testnet/stacks-node
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/bitcoin-int-tests/Dockerfile.bitcoin-tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM stacks-node:integrations AS test
FROM stacks-blockchain:integrations AS test

ARG test_name
ENV BITCOIND_TEST 1
Expand Down
22 changes: 0 additions & 22 deletions .github/actions/bitcoin-int-tests/Dockerfile.code-cov

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ ENV RUSTFLAGS="-Cinstrument-coverage" \
RUN cargo test --no-run && \
cargo build

RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

RUN ln -s /bitcoin-0.20.0/bin/bitcoind /bin/
RUN ln -s /bitcoin-25.0/bin/bitcoind /bin/

ENV BITCOIND_TEST 1
6 changes: 3 additions & 3 deletions .github/actions/bitcoin-int-tests/Dockerfile.large-genesis
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ WORKDIR /src

COPY . .

RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

RUN ln -s /bitcoin-0.20.0/bin/bitcoind /bin/
RUN ln -s /bitcoin-25.0/bin/bitcoind /bin/

RUN rustup component add llvm-tools-preview && \
cargo install grcov
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/bitcoin-int-tests/Dockerfile.net-tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ WORKDIR /src

COPY . .

RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

RUN ln -s /bitcoin-0.20.0/bin/bitcoind /bin/
RUN ln -s /bitcoin-0.20.0/bin/bitcoin-cli /bin/
RUN ln -s /bitcoin-25.0/bin/bitcoind /bin/
RUN ln -s /bitcoin-25.0/bin/bitcoin-cli /bin/

RUN apt-get update
RUN apt-get install -y jq screen net-tools ncat sqlite3 xxd openssl curl
Expand Down
23 changes: 23 additions & 0 deletions .github/actions/dockerfiles/Dockerfile.alpine-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM --platform=${TARGETPLATFORM} alpine as builder
# Use a small image to download and extract the release archive

ARG TAG
ARG BIN_ARCH
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO=stacks-network/stacks-blockchain

RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"*") exit 1 ;; \
esac \
&& 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
COPY --from=builder /out/stacks-node /bin/
CMD ["stacks-node", "mainnet"]
23 changes: 23 additions & 0 deletions .github/actions/dockerfiles/Dockerfile.debian-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM --platform=${TARGETPLATFORM} alpine as builder
# Use a small image to download and extract the release archive

ARG TAG
ARG BIN_ARCH
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO=stacks-network/stacks-blockchain

RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"*") exit 1 ;; \
esac \
&& 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:bullseye
COPY --from=builder /out/stacks-node /bin/
CMD ["stacks-node", "mainnet"]
24 changes: 24 additions & 0 deletions .github/actions/dockerfiles/Dockerfile.debian-source
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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
WORKDIR /src

COPY . .

RUN apt-get update && apt-get install -y git

# Run all the build steps in ramdisk in an attempt to speed things up
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM --platform=${TARGETPLATFORM} debian:bullseye
COPY --from=build /out/stacks-node /bin/
CMD ["stacks-node", "mainnet"]
2 changes: 1 addition & 1 deletion .github/actions/docsgen/Dockerfile.docsgen
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:stretch as build
FROM rust:bullseye as build

WORKDIR /src

Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
##
## Performs an audit for crate advisories against cargo dependencies
##

name: Security Audit

# Only run when:
# - workflow is manually triggered
# - Cargo.toml/lock is changed
# - Daily at 0330 UTC
# Note: this will create issues for any crate advisories unless they already exist

on:
workflow_dispatch:
push:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
schedule:
- cron: 30 03 * * *

jobs:
security_audit:
if: ${{ false }}
name: Crate Vulnerability Check
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Rust Dependency Check
id: rust_dep_check
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
99 changes: 77 additions & 22 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,69 @@
name: stacks-bitcoin-integration-tests
##
## Bitcoin Integration Tests
##

name: Bitcoin Integration Tests

# Only run when:
# - PRs are opened
# - the workflow is started from the UI
# - PRs are (re)opened against master branch

on:
pull_request:
workflow_dispatch:
types:
- opened
- reopened

concurrency:
group: stacks-bitcoin-integration-tests-${{ github.ref }}
# Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
# Create bitcoin image used for later tests
build-integration-image:
name: Build Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3

- name: Reclaim disk space
id: cleanup
run: |
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
docker system prune --force
- name: Build bitcoin integration testing image
id: build_docker_image
env:
DOCKER_BUILDKIT: 1
# Remove .dockerignore file so codecov has access to git info
# Remove .dockerignore file so codecov has access to git info and build the image
run: |
rm .dockerignore
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.generic.bitcoin-tests -t stacks-node:integrations .
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.generic.bitcoin-tests -t stacks-blockchain:integrations .
- name: Export docker image as tarball
run: docker save -o integration-image.tar stacks-node:integrations
id: export_docker_image
run: docker save stacks-blockchain:integrations | gzip > integration-image.tar.gz

- name: Upload built docker image
uses: actions/upload-artifact@v2
id: upload_docker_image
uses: actions/upload-artifact@v3
with:
name: integration-image.tar
path: integration-image.tar
name: integration-image.tar.gz
path: integration-image.tar.gz

# Run integration tests using sampled genesis block
sampled-genesis:
name: Sampled Genesis
runs-on: ubuntu-latest
needs:
- build-integration-image
Expand Down Expand Up @@ -101,28 +132,45 @@ jobs:
- tests::epoch_21::test_v1_unlock_height_with_current_stackers
- tests::epoch_21::test_v1_unlock_height_with_delay_and_current_stackers
- tests::epoch_21::trait_invocation_cross_epoch
- tests::epoch_22::pox_2_unlock_all
- tests::epoch_22::disable_pox
- tests::epoch_22::test_pox_reorg_one_flap
- tests::epoch_23::trait_invocation_behavior
- tests::neon_integrations::bad_microblock_pubkey
- tests::epoch_24::fix_to_pox_contract
- tests::epoch_24::verify_auto_unlock_behavior
- tests::stackerdb::test_stackerdb_load_store
- tests::stackerdb::test_stackerdb_event_observer
steps:
- uses: actions/checkout@v2
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Download docker image
uses: actions/download-artifact@v2
id: download_docker_image
uses: actions/download-artifact@v3
with:
name: integration-image.tar
name: integration-image.tar.gz
- name: Load docker image
run: docker load -i integration-image.tar && rm integration-image.tar
id: load_docker_image
run: docker load -i integration-image.tar.gz && rm integration-image.tar.gz
- name: All integration tests with sampled genesis
id: bitcoin_integration_tests
timeout-minutes: 30
env:
DOCKER_BUILDKIT: 1
TEST_NAME: ${{ matrix.test-name }}
run: docker build -o coverage-output --build-arg test_name=${{ matrix.test-name }} -f ./.github/actions/bitcoin-int-tests/Dockerfile.bitcoin-tests .
- uses: codecov/codecov-action@v2
- name: Code Coverage
id: code_coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage-output/lcov.info
name: ${{ matrix.test-name }}
fail_ci_if_error: false

# Run atlas integration tests
atlas-test:
if: ${{ true }}
name: Atlas Test
runs-on: ubuntu-latest
needs:
- build-integration-image
Expand All @@ -133,20 +181,27 @@ jobs:
- tests::neon_integrations::atlas_integration_test
- tests::neon_integrations::atlas_stress_integration_test
steps:
- uses: actions/checkout@v2
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Download docker image
uses: actions/download-artifact@v2
id: download_docker_image
uses: actions/download-artifact@v3
with:
name: integration-image.tar
name: integration-image.tar.gz
- name: Load docker image
run: docker load -i integration-image.tar && rm integration-image.tar
id: load_docker_image
run: docker load -i integration-image.tar.gz && rm integration-image.tar.gz
- name: Atlas integration tests
id: atlas_integration_tests
timeout-minutes: 40
env:
DOCKER_BUILDKIT: 1
TEST_NAME: ${{ matrix.test-name }}
run: docker build -o coverage-output --build-arg test_name=${{ matrix.test-name }} -f ./.github/actions/bitcoin-int-tests/Dockerfile.bitcoin-tests .
- uses: codecov/codecov-action@v2
- name: Code Coverage
id: code_coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage-output/lcov.info
name: ${{ matrix.test-name }}
Expand Down
Loading

0 comments on commit b791638

Please sign in to comment.