Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/calimero-network/core int…
Browse files Browse the repository at this point in the history
…o feat--add-endpoint-for-deleting-identity-keys
  • Loading branch information
MatejVukosav committed Jun 24, 2024
2 parents 021ccb8 + 0f0b644 commit bdb5d3c
Show file tree
Hide file tree
Showing 309 changed files with 4,285 additions and 34,246 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ env:
es6: true
node: true
extends:
- 'eslint:recommended'
- "eslint:recommended"
parserOptions:
ecmaVersion: 2018
ecmaVersion: 2020
sourceType: module
rules:
indent:
- error
Expand All @@ -23,4 +24,4 @@ globals:
window: true
fetch: true
Headers: true
document: true
document: true
17 changes: 10 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +25,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
208 changes: 208 additions & 0 deletions .github/workflows/calimero_node_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
name: Build and Upload Binary for Linux

on:
push:
branches:
- "**"
paths:
- Cargo.toml
- Cargo.lock
- "crates/**"
pull_request:
types: [closed]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]

outputs:
artifact_path: ${{ steps.compress.outputs.artifact_path }}
target: ${{ matrix.target }}
version: ${{ steps.extract_version.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup rust toolchain
run: rustup toolchain install stable --profile minimal

- name: Setup rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-calimero-node-${{ matrix.target }}

- name: Install target for ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}

- name: Install dependencies for cross-compilation
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
libssl-dev pkg-config
- name: Download and set up OpenSSL for cross-compilation
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar -xzf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k
./Configure linux-aarch64 --prefix=$HOME/openssl-aarch64 --cross-compile-prefix=aarch64-linux-gnu-
make -j$(nproc)
make install_sw
cd ..
echo "OPENSSL_DIR=$HOME/openssl-aarch64" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$HOME/openssl-aarch64/lib/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV
- name: Build the crate for AArch64
if: matrix.target == 'aarch64-unknown-linux-gnu'
env:
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}
PKG_CONFIG_ALLOW_CROSS: ${{ env.PKG_CONFIG_ALLOW_CROSS }}
PKG_CONFIG_SYSROOT_DIR: ${{ env.PKG_CONFIG_SYSROOT_DIR }}
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
AR: aarch64-linux-gnu-ar
RANLIB: aarch64-linux-gnu-ranlib
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: cargo build -p calimero-node --release --target ${{ matrix.target }}

- name: Build the crate for x86_64
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: cargo build -p calimero-node --release --target ${{ matrix.target }}

- name: Extract version
id: extract_version
run: |
VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "calimero-node") | .version')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Compress artifact using gzip
id: compress
run: |
tar -czf calimero-node_${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release calimero-node
echo "artifact_path=calimero-node_${{ matrix.target }}.tar.gz" >> $GITHUB_OUTPUT
echo "target=${{ matrix.target }}" >> $GITHUB_OUTPUT
- name: Cache build artifact
uses: actions/cache@v4
with:
path: calimero-node_${{ matrix.target }}.tar.gz
key: build-artifact-${{ matrix.target }}-${{ github.sha }}
restore-keys: |
build-artifact-${{ matrix.target }}
upload_branch_artifact:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
if: ${{ github.ref != 'refs/heads/master' }}

steps:
- name: Restore build artifact
uses: actions/cache@v4
with:
path: calimero-node_${{ matrix.target }}.tar.gz
key: build-artifact-${{ matrix.target }}-${{ github.sha }}
restore-keys: |
build-artifact-${{ matrix.target }}
- name: Sanitize ref name
id: sanitize
run: |
sanitized_ref_name=$(echo "${GITHUB_REF_NAME}" | sed 's/[^a-zA-Z0-9_-]/-/g; s/^-*//; s/-*$//')
echo "sanitized_ref_name=${sanitized_ref_name}" >> $GITHUB_OUTPUT
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: calimero-node_${{ steps.sanitize.outputs.sanitized_ref_name }}_${{ matrix.target }}.tar.gz
path: calimero-node_${{ matrix.target }}.tar.gz
retention-days: 2

create_release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/master' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') }}
outputs:
release_exists: ${{ steps.check_release.outputs.release_exists }}
version: ${{ needs.build.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check if release exists
id: check_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ needs.build.outputs.version }}
if gh release view "v$VERSION" >/dev/null 2>&1; then
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "release_exists=false" >> $GITHUB_OUTPUT
fi
- name: Create release if it does not exist
if: steps.check_release.outputs.release_exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ needs.build.outputs.version }}
gh release create "v$VERSION" --title "Release v$VERSION" --notes "Release for version $VERSION"
upload_release_artifact:
runs-on: ubuntu-latest
needs: [build, create_release]
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
if: ${{ github.ref == 'refs/heads/master' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore build artifact
uses: actions/cache@v4
with:
path: calimero-node_${{ matrix.target }}.tar.gz
key: build-artifact-${{ matrix.target }}-${{ github.sha }}
restore-keys: |
build-artifact-${{ matrix.target }}
- name: Check if artifact exists in release
id: check_artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ needs.build.outputs.version }}
TARGET=${{ matrix.target }}
ARTIFACT_NAME="calimero-node_${TARGET}.tar.gz"
ASSET_ID=$(gh api \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
/repos/${{ github.repository }}/releases/tags/v$VERSION \
| jq -r ".assets[] | select(.name == \"$ARTIFACT_NAME\") | .id")
if [[ -n "$ASSET_ID" ]]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Upload artifact to release
if: steps.check_artifact.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ needs.build.outputs.version }}
TARGET=${{ matrix.target }}
gh release upload "v$VERSION" calimero-node_${TARGET}.tar.gz
Loading

0 comments on commit bdb5d3c

Please sign in to comment.