diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..11dc374 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,124 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +--- +name: CI +on: + push: + branches: + - "*" + tags: + - "v*.*.*" + pull_request: + branches: + - "main" + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: psf/black@stable + with: + options: "--check -l 119" + src: "." + + audit: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install pip-audit + run: pip install --upgrade pip pip-audit + + - name: Install dependencies + run: pip install . + + - name: Create requirements.txt + run: pip freeze > requirements.txt + + - name: Audit dependencies + run: pip-audit + + test: + needs: lint, audit + runs-on: ubuntu-latest + env: + PLANETMINT_DATABASE_BACKEND: tarantool_db + PLANETMINT_DATABASE_HOST: localhost + PLANETMINT_DATABASE_PORT: 3303 + PLANETMINT_SERVER_BIND: 0.0.0.0:9984 + PLANETMINT_WSSERVER_HOST: 0.0.0.0 + PLANETMINT_WSSERVER_ADVERTISED_HOST: localhost + PLANETMINT_TENDERMINT_HOST: localhost + PLANETMINT_TENDERMINT_PORT: 26657 + + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Prepare OS + run: sudo apt-get update && sudo apt-get install -y git zsh curl tarantool-common vim build-essential cmake + + - name: Get Tendermint + run: wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_0.34.15_linux_amd64.tar.gz && tar zxf tendermint_0.34.15_linux_amd64.tar.gz + + - name: Install Planetmint + run: pip install -e '.[dev]' + + + - name: Execute Tests + run: make test + + release: + needs: test + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Setup poetry + uses: Gr1N/setup-poetry@v7 + + - name: Install dependencies + run: pip install -e '.[dev]' && pip install wheel && python setup.py bdist_wheel sdist + #run: poetry install --with dev + + - name: Upload to PyPI + run: | + twine check dist/* + twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + #run: | + # poetry build + # poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} + + - name: Upload to GitHub + uses: softprops/action-gh-release@v1 + with: + files: dist/* + + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 43eaa30..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright © 2020 Interplanetary Database Association e.V., -# Planetmint and IPDB software contributors. -# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) -# Code is Apache-2.0 and docs are CC-BY-4.0 - -name: Lint -on: [push, pull_request] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: psf/black@stable - with: - options: "--check -l 119" - src: "." diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml deleted file mode 100644 index f5a1fdc..0000000 --- a/.github/workflows/tag-release.yml +++ /dev/null @@ -1,30 +0,0 @@ - -name: Deploy packages -on: - push: - tags: - - '*' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Setup python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install dependencies - run: pip install -e '.[dev]' && pip install wheel && python setup.py bdist_wheel sdist - - - name: Upload to TestPyPI - run: | - twine check dist/* - twine upload dist/* - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml deleted file mode 100644 index dcf51ce..0000000 --- a/.github/workflows/unit-tests.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright © 2020 Interplanetary Database Association e.V., -# Planetmint and IPDB software contributors. -# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) -# Code is Apache-2.0 and docs are CC-BY-4.0 - -name: Unit tests -on: [push, pull_request] - -jobs: - unified-unit-tests: - runs-on: ubuntu-latest - env: - PLANETMINT_DATABASE_BACKEND: tarantool_db - PLANETMINT_DATABASE_HOST: localhost - PLANETMINT_DATABASE_PORT: 3303 - PLANETMINT_SERVER_BIND: 0.0.0.0:9984 - PLANETMINT_WSSERVER_HOST: 0.0.0.0 - PLANETMINT_WSSERVER_ADVERTISED_HOST: localhost - PLANETMINT_TENDERMINT_HOST: localhost - PLANETMINT_TENDERMINT_PORT: 26657 - - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Setup python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Prepare OS - run: sudo apt-get update && sudo apt-get install -y git zsh curl tarantool-common vim build-essential cmake - - - name: Get Tendermint - run: wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_0.34.15_linux_amd64.tar.gz && tar zxf tendermint_0.34.15_linux_amd64.tar.gz - - - name: Install Planetmint - run: pip install -e '.[dev]' - - - - name: Execute Tests - run: make test