Skip to content

Commit

Permalink
Merge sync-node with node commands
Browse files Browse the repository at this point in the history
  • Loading branch information
badrogger committed Mar 6, 2024
1 parent 5ba27d2 commit 73c6062
Show file tree
Hide file tree
Showing 144 changed files with 10,225 additions and 2,641 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests
helper-scripts
dist
build
.github
.gitmodules
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
max-line-length = 100
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,venv
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,venv,helper-scripts
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: saturday
open-pull-requests-limit: 10
19 changes: 19 additions & 0 deletions .github/workflows/issue_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Get linked issues
on:
pull_request:
types: [ edited, synchronize, opened, reopened ]

jobs:
check-linked-issues:
name: Check if pull request has linked issues
runs-on: ubuntu-latest
steps:
- name: Get issues
id: get-issues
uses: mondeja/pr-linked-issues-action@v2
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: PR has not linked issues
if: join(steps.get-issues.outputs.issues) == ''
run:
exit 1
179 changes: 179 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Build and publish
on:
pull_request:
types: [closed]
branches:
- master
- develop
- beta
- stable
- v*.*.*

jobs:
create_release:
if: github.event.pull_request.merged
name: Create release
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.export_outputs.outputs.version }}
branch: ${{ steps.export_outputs.outputs.branch }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

- name: Checkout submodules
run: git submodule update --init
- name: Install ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install python-setuptools
- name: Set Versions
run: |
bash ./scripts/set_versions_ga.sh
- name: Set release
run: |
if [[ "$BRANCH" == "stable" ]]; then
export PRERELEASE=false
else
export PRERELEASE=true
fi
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: false
prerelease: ${{ env.PRERELEASE }}
- name: Export outputs
id: export_outputs
run: |
echo "::set-output name=version::$VERSION"
echo "::set-output name=branch::$BRANCH"
build_and_publish_normal:
if: github.event.pull_request.merged
needs: create_release
name: Build and publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11

- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
- name: Checkout submodules
run: git submodule update --init

- name: Build normal binary
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} normal
ls -altr /home/ubuntu/dist/
docker rm -f $(docker ps -aq)
- name: Save sha512sum
run: |
sudo sha512sum /home/ubuntu/dist/${{ matrix.asset_name }} | sudo tee > /dev/null /home/ubuntu/dist/sha512sum
- name: Upload release binary
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream

- name: Upload release checksum
id: upload-release-checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/sha512sum
asset_name: ${{ matrix.asset_name }}.sha512
asset_content_type: text/plain

build_and_publish_sync:
if: github.event.pull_request.merged
needs: create_release
name: Build and publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64-sync
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11

- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
- name: Checkout submodules
run: git submodule update --init

- name: Build sync release binary
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} sync
ls -altr /home/ubuntu/dist/
docker rm -f $(docker ps -aq)
- name: Save sha512sum
run: |
sudo sha512sum /home/ubuntu/dist/${{ matrix.asset_name }} | sudo tee > /dev/null /home/ubuntu/dist/sha512sum
- name: Upload release sync CLI
id: upload-sync-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream

- name: Upload release sync CLI checksum
id: upload-sync-release-checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/sha512sum
asset_name: ${{ matrix.asset_name }}.sha512
asset_content_type: text/plain
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Test
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Checkout submodules
run: git submodule update --init

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install python-setuptools iptables
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e .[dev]
pip install --upgrade 'setuptools<45.0.0'
- name: Lint with flake8
run: |
flake8 .
- name: Build binary in Ubuntu 18.04 environment - normal
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh test test normal
docker rm -f $(docker ps -aq)
- name: Check build - normal
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64

- name: Build binary in Ubuntu 20.04 environment - normal
run: |
scripts/build.sh test test normal
- name: Check build - sync
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64
- name: Build sync binary in Ubuntu 18.04 environment
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh test test sync
docker rm -f $(docker ps -aq)
- name: Check build - sync
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync

- name: Build sync binary in Ubuntu 20.04 environment
run: |
scripts/build.sh test test sync
- name: Check build - sync
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync

- name: Run tests
run: bash ./scripts/run_tests.sh
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,14 @@ venv.bak/
.DS_Store

# info.py file generated automatically during package build
cli/info.py
node_cli/cli/info.py

meta.json

disk_mountpoint.txt
sgx_server_url.txt
resource_allocation.json
conf.json
test-env

nginx.conf
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "helper-scripts"]
path = helper-scripts
url = https://github.com/skalenetwork/helper-scripts.git
branch = develop

[submodule "lvmpy"]
path = lvmpy
url = https://github.com/skalenetwork/docker-lvmpy
branch = develop
69 changes: 0 additions & 69 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 73c6062

Please sign in to comment.