Skip to content

Commit

Permalink
Merge branch 'dev' into eip1559-gas-fee-estimate
Browse files Browse the repository at this point in the history
* dev:
  fix(tests): fix failing tests (KomodoPlatform#2085)
  fix(wasm): websocket url validation (KomodoPlatform#2096)
  deps(zcoin): use librustzcash that uses the same `aes` version as mm2 (KomodoPlatform#2095)
  • Loading branch information
dimxy committed Apr 16, 2024
2 parents 54b60a6 + ee3c418 commit 898a89d
Show file tree
Hide file tree
Showing 65 changed files with 5,079 additions and 4,731 deletions.
50 changes: 50 additions & 0 deletions .github/actions/deps-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Install Dependencies
description: Install non-cargo dependencies in an OS-agnostic way

inputs:
deps:
description: "Dependencies to install (format: ('list' 'of' 'dependencies'))."
required: true
temp:
description: "A temporary directory path that can be used to store the installed binaries if needed."

# NOTE: Don't install binaries in the project directory because the directory might be checked out later.
runs:
using: 'composite'
steps:
- name: Install protoc (Linux)
env:
TMP: ${{ inputs.temp || runner.temp }}
if: runner.os == 'Linux' && contains(inputs.deps, 'protoc')
shell: bash
run: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-linux-x86_64.zip
unzip protoc-25.3-linux-x86_64 -d "$TMP/protobuf"
echo "$TMP/protobuf/bin" >> $GITHUB_PATH
- name: Install protoc (MacOS)
env:
TMP: ${{ inputs.temp || runner.temp }}
if: runner.os == 'macOS' && contains(inputs.deps, 'protoc')
shell: bash
run: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-osx-x86_64.zip
unzip protoc-25.3-osx-x86_64.zip -d "$TMP/protobuf"
echo "$TMP/protobuf/bin" >> $GITHUB_PATH
- name: Install protoc (Windows)
env:
TMP: ${{ inputs.temp || runner.temp }}
if: runner.os == 'Windows' && contains(inputs.deps, 'protoc')
shell: powershell
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-win64.zip -OutFile protoc-25.3-win64.zip
7z x protoc-25.3-win64.zip -o"$TMP\protobuf"
echo "$TMP\protobuf\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install libudev (Linux)
if: runner.os == 'Linux' && contains(inputs.deps, 'libudev')
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y libudev-dev
77 changes: 5 additions & 72 deletions .github/workflows/adex-cli.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: adex-cli
name: Adex CLI
on: [push]

concurrency:
Expand All @@ -10,6 +10,7 @@ env:

jobs:
code-check:
name: Code Checks
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -18,87 +19,19 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: pre scripts for ci container
run: |
git config --global --add safe.directory /__w/komodo-defi-framework/komodo-defi-framework
echo "/bin" >> $GITHUB_PATH
echo "/usr/bin" >> $GITHUB_PATH
echo "/root/.cargo/bin" >> $GITHUB_PATH
- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV

- name: Calculate commit hash for merge commit
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache

- name: Start checking code format and lint
continue-on-error: true
run: |
cargo fmt --manifest-path ./mm2src/adex_cli/Cargo.toml --all -- --check
cargo clippy --manifest-path ./mm2src/adex_cli/Cargo.toml --all-targets --all-features -- --D warnings
test:
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3

- name: pre scripts for ci container
- name: Start building
run: |
git config --global --add safe.directory /__w/komodo-defi-framework/komodo-defi-framework
echo "/bin" >> $GITHUB_PATH
echo "/usr/bin" >> $GITHUB_PATH
echo "/root/.cargo/bin" >> $GITHUB_PATH
- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV

- name: Calculate commit hash for merge commit
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
cargo build --manifest-path ./mm2src/adex_cli/Cargo.toml
- name: Start testing
run: |
cargo test --manifest-path ./mm2src/adex_cli/Cargo.toml --no-fail-fast
build:
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3

- name: pre scripts for ci container
run: |
git config --global --add safe.directory /__w/komodo-defi-framework/komodo-defi-framework
echo "/bin" >> $GITHUB_PATH
echo "/usr/bin" >> $GITHUB_PATH
echo "/root/.cargo/bin" >> $GITHUB_PATH
- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV

- name: Calculate commit hash for merge commit
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache

- name: Start building
run: |
cargo build --manifest-path ./mm2src/adex_cli/Cargo.toml
44 changes: 42 additions & 2 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
rustup default nightly-2022-10-29
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
Expand Down Expand Up @@ -95,6 +100,11 @@ jobs:
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
rustup default nightly-2022-10-29
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
Expand Down Expand Up @@ -145,6 +155,11 @@ jobs:
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
rustup default nightly-2022-10-29
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $Env:GITHUB_ENV
Expand Down Expand Up @@ -197,6 +212,11 @@ jobs:
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
rustup default nightly-2022-10-29
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
Expand Down Expand Up @@ -252,6 +272,11 @@ jobs:
echo "/usr/bin" >> $GITHUB_PATH
echo "/root/.cargo/bin" >> $GITHUB_PATH
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Install toolchain
run: |
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
Expand Down Expand Up @@ -312,6 +337,11 @@ jobs:
rustup default nightly-2022-10-29
rustup target add aarch64-apple-ios
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
Expand Down Expand Up @@ -373,6 +403,11 @@ jobs:
rustup default nightly-2022-10-29
rustup target add aarch64-linux-android
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Setup NDK
run: ./scripts/ci/android-ndk.sh x86 23

Expand Down Expand Up @@ -402,7 +437,7 @@ jobs:
run: |
NAME="mm2_$COMMIT_HASH-android-aarch64.zip"
mv target/aarch64-linux-android/release/libmm2lib.a target/aarch64-linux-android/release/libmm2.a
zip $NAME target/aarch64-linux-android/release/libmm2.a -j
zip $NAME target/aarch64-linux-android/release/libmm2.a -j
mkdir $BRANCH_NAME
mv $NAME ./$BRANCH_NAME/
Expand Down Expand Up @@ -439,6 +474,11 @@ jobs:
rustup default nightly-2022-10-29
rustup target add armv7-linux-androideabi
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Setup NDK
run: ./scripts/ci/android-ndk.sh x86 23

Expand Down Expand Up @@ -468,7 +508,7 @@ jobs:
run: |
NAME="mm2_$COMMIT_HASH-android-armv7.zip"
mv target/armv7-linux-androideabi/release/libmm2lib.a target/armv7-linux-androideabi/release/libmm2.a
zip $NAME target/armv7-linux-androideabi/release/libmm2.a -j
zip $NAME target/armv7-linux-androideabi/release/libmm2.a -j
mkdir $BRANCH_NAME
mv $NAME ./$BRANCH_NAME/
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/fmt-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,38 @@ concurrency:

jobs:
fmt-and-lint:
name: x86 Format and Lint Checks
timeout-minutes: 45
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3

- name: Install toolchain
run: |
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal --component rustfmt clippy
rustup default nightly-2022-10-29
- name: Install OS dependencies
run: |
sudo apt-get update
sudo apt-get -y install libudev-dev
if: matrix.os == 'ubuntu-latest'
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc' 'libudev-dev')

- name: Cargo cache
uses: ./.github/actions/cargo-cache

- name: fmt check
# Format checks aren't OS dependant.
if: matrix.os == 'ubuntu-latest'
run: cargo fmt -- --check

- name: x86-64 code lint
- name: clippy lint
run: cargo clippy --all-targets --all-features -- --D warnings

wasm-lint:
name: Wasm Lint Checks
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
Expand All @@ -45,8 +49,13 @@ jobs:
rustup default nightly-2022-10-29
rustup target add wasm32-unknown-unknown
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache

- name: wasm code lint
- name: clippy lint
run: cargo clippy --target wasm32-unknown-unknown -- --D warnings
12 changes: 5 additions & 7 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "PR Lint"
name: PR Lint

on:
pull_request:
Expand Down Expand Up @@ -45,11 +45,9 @@ jobs:
fi
- name: Check PR labels
if: >
(contains(toJson(github.event.pull_request.labels.*.name), 'under review') == false &&
contains(toJson(github.event.pull_request.labels.*.name), 'in progress') == false) ||
(contains(toJson(github.event.pull_request.labels.*.name), 'under review') == true &&
contains(toJson(github.event.pull_request.labels.*.name), 'in progress') == true)
env:
LABEL_NAMES: ${{ toJson(github.event.pull_request.labels.*.name) }}
if: contains(env.LABEL_NAMES, 'under review') == contains(env.LABEL_NAMES, 'in progress')
run: |
echo "PR must have "exactly one" of these labels: [ 'under review', 'in progress' ]."
echo "PR must have "exactly one" of these labels: ['under review', 'in progress']."
exit 1
Loading

0 comments on commit 898a89d

Please sign in to comment.