Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration ci #303

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 66 additions & 45 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Pull Request
on:
pull_request:
branches: "main"
paths-ignore: ['**.md']
paths-ignore: ["**.md"]
push:
branches: "main"
paths-ignore: ['**.md']
paths-ignore: ["**.md"]

env:
CARGO_TERM_COLOR: always
Expand All @@ -15,62 +15,62 @@ jobs:
generate-lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo generate-lockfile -v
- uses: actions/upload-artifact@v3
with:
name: Cargo.lock
path: Cargo.lock
- uses: actions/checkout@v3
- name: Build
run: cargo generate-lockfile -v
- uses: actions/upload-artifact@v3
with:
name: Cargo.lock
path: Cargo.lock

linter:
needs: generate-lockfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy

- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"
- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"

- name: Lint
run: cargo make --profile github-actions format
- name: Lint
run: cargo make --profile github-actions format

coverage:
needs: clarinet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"
- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"

- name: Coverage
run: cargo make --profile github-actions coverage-lcov
- name: Coverage
run: cargo make --profile github-actions coverage-lcov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
fail_ci_if_error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
fail_ci_if_error: true

clarinet:
needs: linter
Expand Down Expand Up @@ -120,14 +120,20 @@ jobs:
filters: |
devenv:
- 'devenv/**'

- uses: actions/upload-artifact@v3
with:
name: docker-images
path: /tmp/images
- name: Checkout
if: steps.changes.outputs.devenv == 'true'
uses: actions/checkout@v3

- name: Build devenv containers
if: steps.changes.outputs.devenv == 'true'
run: ./devenv/build.sh
run: |
./devenv/build.sh
mkdir /tmp/images
docker save -o /tmp/images/bulk.tar $(docker images -q)

vitest:
runs-on: ubuntu-latest
Expand All @@ -139,11 +145,26 @@ jobs:
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
node-version: "20"
cache: "npm"
cache-dependency-path: ./romeo/asset-contract/package-lock.json
- run: npm ci
working-directory: ./romeo/asset-contract
- run: npm run test
working-directory: ./romeo/asset-contract

integretion:
runs-on: ubuntu-latest
needs: ["linter", "devenv"]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: docker-images
path: /tmp/images
- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"

- run: "docker load --input /tmp/images/bulk.tar"
#- run: "cargo make integration"
84 changes: 51 additions & 33 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TEST_FRAMEWORK = "nextest"
[env.github-actions]
# TODO: use nexttest when testing becomes too much to do in series.
# Installing nexttest takes > 5 minutes on github workflow machines.
TEST_FRAMEWORK = "test"
TEST_FRAMEWORK = "nextest"

# Installations
# --------------
Expand All @@ -28,15 +28,24 @@ TEST_FRAMEWORK = "test"
[tasks._install-test-framework]
private = true
condition = { env = { "TEST_FRAMEWORK" = "nextest" } }
install_crate = { crate_name = "cargo-nextest", version = "0.9.57", binary = "cargo", "test_arg" = ["nextest" , "--help"]}
install_crate = { crate_name = "cargo-nextest", version = "0.9.57", binary = "cargo", "test_arg" = [
"nextest",
"--help",
] }

[tasks._install-llvm-cov]
private = true
install_crate = { crate_name = "cargo-llvm-cov", version = "0.5.25", binary = "cargo", "test_arg" = ["llvm-cov" , "--help"]}
install_crate = { crate_name = "cargo-llvm-cov", version = "0.5.25", binary = "cargo", "test_arg" = [
"llvm-cov",
"--help",
] }

[tasks._install-audit]
private = true
install_crate = { crate_name = "cargo-audit", version = "0.18.1", binary = "cargo", "test_arg" = ["audit" , "--help"]}
install_crate = { crate_name = "cargo-audit", version = "0.18.1", binary = "cargo", "test_arg" = [
"audit",
"--help",
] }

[tasks.install]
dependencies = [
Expand All @@ -49,14 +58,24 @@ dependencies = [
# -----------

[tasks.format-fmt]
install_crate = "rustfmt" # uses the stable version.
# uses the stable version.
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--check", "--verbose"]

[tasks.format-clippy]
install_crate = "clippy" # uses the stable version.
command = "cargo"
args = ["clippy","--all-features", "--all-targets", "--", "-D", "warnings", "-W", "clippy::all"]
args = [
"clippy",
"--all-features",
"--all-targets",
"--",
"-D",
"warnings",
"-W",
"clippy::all",
]

[tasks.format]
dependencies = ["format-clippy", "format-fmt"]
Expand All @@ -77,16 +96,15 @@ args = ["-p", "${COVERAGE_DIRECTORY}"]

[tasks._calculate-coverage]
private = true
dependencies = [
"_install-llvm-cov",
"_install-test-framework",
]
dependencies = ["_install-llvm-cov", "_install-test-framework"]
command = "cargo"
args = [
"llvm-cov",
"${TEST_FRAMEWORK}",
"--all-features",
"--no-report"
"--no-report",
"-E",
"not (kind(test))",
]

[tasks._calculated-coverage-clean]
Expand All @@ -97,37 +115,27 @@ args = ["llvm-cov", "clean"]
# Public tasks ----------------------------------------------------------------
[tasks.coverage-clean]
workspace = false
dependencies = [ "_calculated-coverage-clean", "_coverage-output-clean" ]
dependencies = ["_calculated-coverage-clean", "_coverage-output-clean"]

[tasks.coverage-lcov]
workspace = false
dependencies = [
"_install-llvm-cov",
"_calculate-coverage",
"_make-coverage-output-directory"
"_make-coverage-output-directory",
]
command = "cargo"
args = [
"llvm-cov",
"report",
"--output-path=${COVERAGE_LCOV}",
"--lcov",
]
args = ["llvm-cov", "report", "--output-path=${COVERAGE_LCOV}", "--lcov"]

[tasks.coverage-html]
workspace = false
dependencies = [
"_install-llvm-cov",
"_calculate-coverage",
"_make-coverage-output-directory"
"_make-coverage-output-directory",
]
command = "cargo"
args = [
"llvm-cov",
"report",
"--output-dir=${COVERAGE_HTML_DIR}",
"--html",
]
args = ["llvm-cov", "report", "--output-dir=${COVERAGE_HTML_DIR}", "--html"]

[tasks.coverage-all]
workspace = false
Expand Down Expand Up @@ -162,7 +170,8 @@ args = ["doc"]
# ------

[tasks.audit]
workspace = false # Audit must run in workspace root.
# Audit must run in workspace root.
workspace = false
dependencies = ["_install-audit"]
command = "cargo"
args = ["audit", "-D", "warnings"]
Expand All @@ -174,12 +183,21 @@ args = ["audit", "-D", "warnings"]
dependencies = ["coverage-clean", "cargo-clean"]

[tasks.pr-validation]
dependencies = [
"clean",
"format",
"coverage",
"release",
]
dependencies = ["clean", "format", "coverage", "release"]

[tasks.default]
run_task = "pr-validation"

# Integration
# ----------
#[tasks.build-devenv]
#command = "./build.sh"

[tasks.build-testbed]
command = "pushd integration && ./bin/build && popd"


[tasks.integration]
#dependencies = ["build-devenv", "build-testbed"]
dependencies = ["build-testbed"]
command = "./integration/bin/test"
2 changes: 1 addition & 1 deletion devenv/bitcoin/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG VERSION=25.0
RUN apt-get update && apt-get install -y \
wget \
file \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

RUN file /bin/bash | grep -q x86-64 && echo x86_64-linux-gnu > /tmp/arch || true
RUN file /bin/bash | grep -q aarch64 && echo aarch64-linux-gnu > /tmp/arch || true
Expand Down
5 changes: 0 additions & 5 deletions devenv/bitcoin/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@

set -x

#-rpcuser=${BTC_RPCUSER} -rpcpassword=${BTC_RPCPASSWORD}

# bitcoind needs creds set in the conf file for remote RPC auth
#echo '[regtest]' > ${BITCOIN_CONF}

nginx
bitcoind -chain=${BTC_NETWORK} -txindex=${BTC_TXINDEX} -rpcuser=${BTC_RPCUSER} -rpcpassword=${BTC_RPCPASSWORD} -printtoconsole=${BTC_PRINTTOCONSOLE} -disablewallet=${BTC_DISABLEWALLET} -rpcbind=${BTC_RPCBIND} -rpcallowip=${BTC_RPCALLOWIP}
Loading
Loading