Skip to content

Commit

Permalink
merge and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
borngraced committed May 12, 2024
2 parents d26490f + 7f08cae commit 9ec826a
Show file tree
Hide file tree
Showing 246 changed files with 22,247 additions and 9,679 deletions.
12 changes: 8 additions & 4 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/debian:buster-slim
FROM docker.io/debian:10

MAINTAINER Onur Özkan <[email protected]>

Expand All @@ -10,6 +10,7 @@ RUN apt-get install -y \
ca-certificates \
curl \
wget \
unzip \
gnupg

RUN ln -s /usr/bin/python3 /bin/python
Expand All @@ -26,11 +27,11 @@ RUN ./llvm.sh 16

RUN rm ./llvm.sh

RUN ln -s /usr/bin/clang-16 /usr/bin/clang

ENV AR=/usr/bin/llvm-ar-16
ENV CC=/usr/bin/clang-16

RUN ln -s /usr/bin/clang-16 /usr/bin/clang

RUN mkdir -m 0755 -p /etc/apt/keyrings

RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Expand All @@ -47,6 +48,9 @@ RUN apt-get install -y \
containerd.io \
docker-buildx-plugin

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain nightly-2022-10-29 -y

RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protoc-3.20.1-linux-x86_64.zip
RUN unzip protoc-3.20.1-linux-x86_64.zip && mv ./include/google /usr/include/google

ENV PATH="/root/.cargo/bin:$PATH"
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
50 changes: 46 additions & 4 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 @@ -94,6 +99,12 @@ jobs:
run: |
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
rustup default nightly-2022-10-29
rustup target add x86_64-apple-darwin
- 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'
Expand Down Expand Up @@ -145,6 +156,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 @@ -194,8 +210,14 @@ jobs:
- uses: actions/checkout@v3
- name: Install toolchain
run: |
rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal
rustup default nightly-2022-10-29
rustup toolchain install nightly-2022-10-29-x86_64-apple-darwin --no-self-update --profile=minimal
rustup default nightly-2022-10-29-x86_64-apple-darwin
rustup target add x86_64-apple-darwin
- 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'
Expand Down Expand Up @@ -252,6 +274,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 +339,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 +405,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 +439,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 +476,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 +510,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 9ec826a

Please sign in to comment.