diff --git a/.github/actions/getNewNodeVersion/action.yaml b/.github/actions/getNewNodeVersion/action.yaml new file mode 100644 index 000000000..1a8b1d073 --- /dev/null +++ b/.github/actions/getNewNodeVersion/action.yaml @@ -0,0 +1,34 @@ +name: "Get New NodeVersion" +description: "Sets version parameters and makes them available as outputs for subsequent processes." + +inputs: + isRC: + description: "A flag indicating whether or not this is a release candidate build; set to either 'true' or 'false'." + required: true + default: "true" + +outputs: + nodeVersion: + description: "The new Version. (Bumped Patch by 1)" + value: ${{ steps.versions.outputs.nodeVersion }} + +runs: + using: "composite" + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Get Versions + id: versions + shell: bash + run: | + major=$(python3 -c "from indy_node import load_version; patch = load_version().parts[0]; print('' if patch is None else patch)") + minor=$(python3 -c "from indy_node import load_version; patch = load_version().parts[1]; print('' if patch is None else patch)") + patch=$(python3 -c "from indy_node import load_version; patch = load_version().parts[2]; patch+=1; print('' if patch is None else patch)") + if [[ "${{ inputs.isRC }}" == "true" ]]; then + echo ::set-output\ name=nodeVersion::${major}.${minor}.${patch}rc1 + else + echo ::set-output\ name=nodeVersion::${major}.${minor}.${patch} + fi \ No newline at end of file diff --git a/.github/actions/publish-deb/action.yaml b/.github/actions/publish-deb/action.yaml deleted file mode 100644 index 6b8c56d74..000000000 --- a/.github/actions/publish-deb/action.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: "Publish Debian Packages" -description: > - Publish debian packages to artifactory using the jfrog cli. - This action wraps a script that performs organized publishing of debian packages. - -inputs: - sourceDirectory: - description: "The directory containing the packages to be published." - required: true - distribution: - description: "The distribution supported by the package. i.e xenial, focal, etc." - required: true - component: - description: "The component type. i.e. stable, rc, dev, etc." - required: true - -runs: - using: "composite" - steps: - - name: Publish - shell: bash - run: | - ${{ github.action_path }}/publishPackages "${{ inputs.sourceDirectory }}" "${{ inputs.distribution }}" "${{ inputs.component }}" diff --git a/.github/actions/publish-deb/publishPackages b/.github/actions/publish-deb/publishPackages deleted file mode 100755 index 76d7fe868..000000000 --- a/.github/actions/publish-deb/publishPackages +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -SCRIPT_HOME="$( cd "$( dirname "$0" )" && pwd )" - -sourceDirectory=${1} -distribution=${2} -component=${3} -uploadSpec=${UPLOAD_SPEC:-${4:-"${SCRIPT_HOME}/upload-spec.json"}} - -export CI=true - -fileList=$(find "${sourceDirectory}" -type f -name '*.deb' -mindepth 1 -maxdepth 1 -printf "%f\n" 2>/dev/null) -for name in ${fileList}; do - shortName=$(echo "${name}" | sed -rn 's~^(python3-)?([^.]*)_.*.deb~\2~p') - architecture=$(echo "${name}" | sed -rn 's~^.*_(.*).deb~\1~p') - startingLetter=$(echo "${shortName}" | sed -rn 's~^(.).*~\1~p') - - echo "=====================================================================================================================" - echo "name: ${name}" - echo "shortName: ${shortName}" - echo "architecture: ${architecture}" - echo "startingLetter: ${startingLetter}" - echo "distribution: ${distribution}" - echo "component: ${component}" - echo "uploadSpec: ${uploadSpec}" - echo "---------------------------------------------------------------------------------------------------------------------" - jfrog rt u \ - --deb ${distribution}/${component}/${architecture} \ - --spec ${uploadSpec}\ - --spec-vars "SOURCE_DIR=${sourceDirectory};PACKAGE_NAME=${name};COMPONENT=${component};PACKAGE_STARTING_LETTER=${startingLetter};PACKAGE_SHORT_NAME=${shortName};DISTRIBUTION=${distribution}" \ - --detailed-summary - echo "=====================================================================================================================" - echo -done \ No newline at end of file diff --git a/.github/actions/publish-deb/upload-spec.json b/.github/actions/publish-deb/upload-spec.json deleted file mode 100644 index d98c56a72..000000000 --- a/.github/actions/publish-deb/upload-spec.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files": [ - { - "pattern": "${SOURCE_DIR}/${PACKAGE_NAME}", - "target": "indy/pool/${DISTRIBUTION}/${COMPONENT}/${PACKAGE_STARTING_LETTER}/${PACKAGE_SHORT_NAME}/" - } - ] -} \ No newline at end of file diff --git a/.github/actions/set-version/action.yaml b/.github/actions/set-version/action.yaml deleted file mode 100644 index ceef38bdd..000000000 --- a/.github/actions/set-version/action.yaml +++ /dev/null @@ -1,63 +0,0 @@ -name: "Set Version" -description: "Sets version parameters and makes them available as outputs for subsequent processes." - -inputs: - moduleName: - description: "The name of the module containing the version management APIs for the project; i.e. load_version and set_version" - required: true - default: "indy_node" - isDev: - description: "A flag indicating whether or not this is a dev build; set to either 'true' or 'false'." - required: true - default: false - isRC: - description: "A flag indicating whether or not this is a release candidate build; set to either 'true' or 'false'." - required: true - default: false - -outputs: - targetReleaseVer: - description: "The target release version." - value: ${{ steps.versions.outputs.targetReleaseVer }} - upstreamVer: - description: "The version number to use with Python packages." - value: ${{ steps.versions.outputs.upstreamVer }} - pkgVer: - description: "The version number to use with Debian packages." - value: ${{ steps.versions.outputs.pkgVer }} - -runs: - using: "composite" - steps: - - name: Set Versions - id: versions - shell: bash - run: | - fullVersion=$(python3 -c "from ${{ inputs.moduleName }} import load_version; print(load_version().full)") - release=$(python3 -c "from ${{ inputs.moduleName }} import load_version; print(load_version().release)") - pre=$(python3 -c "from ${{ inputs.moduleName }} import load_version; pre = load_version().parts[-2]; print('' if pre is None else pre)") - revision=$(python3 -c "from ${{ inputs.moduleName }} import load_version; rev = load_version().parts[-1]; print('' if rev is None else rev)") - - targetReleaseVer=${release} - upstreamVer=${targetReleaseVer} - pkgVer=${upstreamVer} - - if [ ${{ inputs.isDev }} == "true" ] || [ ${{ inputs.isRC }} == "true" ]; then - if [ ${{ inputs.isDev }} == "true" ]; then - rev=${{ github.run_number }} - else - rev=${revision} - fi - - upstreamVer+=".${pre}${rev}" - pkgVer+="~${pre}${rev}" - fi - - # Set Outputs ... - echo "::set-output name=targetReleaseVer::${targetReleaseVer}" - echo "::set-output name=upstreamVer::${upstreamVer}" - echo "::set-output name=pkgVer::${pkgVer}" - - echo "Target Release version: ${targetReleaseVer}" - echo "PyPI Release version: ${upstreamVer}" - echo "Debian Release version: ${pkgVer}" \ No newline at end of file diff --git a/.github/workflows/PR.yaml b/.github/workflows/PR.yaml new file mode 100644 index 000000000..feaa70c97 --- /dev/null +++ b/.github/workflows/PR.yaml @@ -0,0 +1,65 @@ +name: Indy Node - PR Workflow +on: + pull_request: + branches: + - ubuntu-20.04-upgrade + - feature/did-indy* + paths: + - '**.py' + - '.github/**' + - 'build-scripts/**' + - 'bump_version.sh' + workflow_dispatch: + +jobs: + workflow-setup: + name: Initialize Workflow + runs-on: ubuntu-latest + outputs: + CACHE_KEY_BUILD: ${{ steps.setup.outputs.CACHE_KEY_BUILD }} + UBUNTU_VERSION: ${{ steps.setup.outputs.UBUNTU_VERSION }} + # Expose the lowercase version of the GitHub repository name + # to all subsequent jobs that reference image repositories + # as the push and pull operations require the URL of the repository + # to be in lowercase. + GITHUB_REPOSITORY_NAME: ${{ steps.setup.outputs.GITHUB_REPOSITORY_NAME }} + distribution: ${{ steps.setup.outputs.distribution }} + publish: ${{ steps.setup.outputs.publish }} + steps: + - name: checkout source code + uses: actions/checkout@v2 + - name: setup + id: setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@main + + lint: + name: Lint + uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@main + + build-image: + name: Create Builder Image + needs: [workflow-setup, lint] + uses: hyperledger/indy-shared-gha/.github/workflows/buildimage.yaml@main + with: + CACHE_KEY_BUILD: ${{ needs.workflow-setup.outputs.CACHE_KEY_BUILD }} + DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/node-build + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + indy_node_tests: + name: Indy Node Tests + needs: [workflow-setup, build-image] + uses: ./.github/workflows/reuseable_test.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + build_packages: + name: Build Packages + needs: [workflow-setup, indy_node_tests] + uses: hyperledger/indy-shared-gha/.github/workflows/buildpackages.yaml@main + with: + DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/node-build:${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + isDev: true + isRC: false + moduleName: indy_node diff --git a/.github/workflows/Push.yaml b/.github/workflows/Push.yaml new file mode 100644 index 000000000..87d40ac58 --- /dev/null +++ b/.github/workflows/Push.yaml @@ -0,0 +1,78 @@ +name: Indy Node - Push Workflow +on: + push: + branches: + - ubuntu-20.04-upgrade + - feature/did-indy* + paths: + - '**.py' + - '.github/**' + - 'build-scripts/**' + - 'bump_version.sh' + +jobs: + workflow-setup: + name: Initialize Workflow + runs-on: ubuntu-latest + outputs: + CACHE_KEY_BUILD: ${{ steps.setup.outputs.CACHE_KEY_BUILD }} + UBUNTU_VERSION: ${{ steps.setup.outputs.UBUNTU_VERSION }} + # Expose the lowercase version of the GitHub repository name + # to all subsequent jobs that reference image repositories + # as the push and pull operations require the URL of the repository + # to be in lowercase. + GITHUB_REPOSITORY_NAME: ${{ steps.setup.outputs.GITHUB_REPOSITORY_NAME }} + distribution: ${{ steps.setup.outputs.distribution }} + publish: ${{ steps.setup.outputs.publish }} + steps: + - name: checkout source code + uses: actions/checkout@v2 + - name: setup + id: setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@main + + lint: + name: Lint + uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@main + + build-image: + name: Create Builder Image + needs: [workflow-setup, lint] + uses: hyperledger/indy-shared-gha/.github/workflows/buildimage.yaml@main + with: + CACHE_KEY_BUILD: ${{ needs.workflow-setup.outputs.CACHE_KEY_BUILD }} + DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/node-build + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + indy_node_tests: + name: Indy Node Tests + needs: [workflow-setup, build-image] + uses: ./.github/workflows/reuseable_test.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + build_packages: + name: Build Packages + needs: [workflow-setup, indy_node_tests] + uses: hyperledger/indy-shared-gha/.github/workflows/buildpackages.yaml@main + with: + DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/node-build:${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + isDev: true + isRC: false + moduleName: indy_node + + publish_artifacts: + name: Publish Artifacts + needs: [workflow-setup, build_packages] + if: needs.workflow-setup.outputs.publish == 'true' + uses: hyperledger/indy-shared-gha/.github/workflows/publish_artifacts.yaml@main + with: + COMPONENT: 'dev' + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + distribution: ${{ needs.workflow-setup.outputs.distribution }} + moduleName: indy_node + secrets: + INDY_ARTIFACTORY_REPO_CONFIG: ${{ secrets.INDY_ARTIFACTORY_REPO_CONFIG }} + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 05c141f22..adddac7af 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,13 +1,11 @@ -# GitHub Actions Workflow +# GitHub Actions Workflows -The workflow in the [push_pr.yaml](push_pr.yaml) file runs on push and pull requests to the ubuntu-20-04-upgrade branch. -It uses the following reusable workflows in this folder. +The [PR](PR.yaml) workflow runs on Pull Requests to the ubuntu-20.04-upgrade branch, +which only contain changes to python files. If no python file is affected it doesn't run. +The same applies to the [Push](Push.yaml) workflow respectively for pushes. -+ [buildimage.yaml](buildimage.yaml) - This workflow builds the dockerimages and pushes them to the GHCR. -+ [test.yaml](test.yaml) - This workflow runs the tests inside the uploaded docker images. -+ [buildpackages.yaml](buildpackages.yaml) - This workflows builds the python and debian packages. It also uploads them to the workflow. -+ [publish_artifacts.yaml](publish_artifacts.yaml) - This workflow uploads the packages to PYPI and Artifactory. \ No newline at end of file +The [tag](tag.yaml), [releasepr](releasepr.yaml) and [publishRelease](publishRelease.yaml) workflows are used for the new [Release Workflow](../../docs/release-workflow.png). +They use reuseable workflows from the [indy-shared-gha](https://github.com/hyperledger/indy-shared-gha) repository and the following workflow in this folder. + ++ [reuseable_test.yaml](reuseable_test.yaml) + This workflow runs the tests inside the uploaded docker images. \ No newline at end of file diff --git a/.github/workflows/WIPupdatePlenumDependency b/.github/workflows/WIPupdatePlenumDependency new file mode 100644 index 000000000..1cac61b41 --- /dev/null +++ b/.github/workflows/WIPupdatePlenumDependency @@ -0,0 +1,83 @@ +# WIP to Update node after a plenum update has occured +# name: Update Plenum Dependency + +# on: +# push: +# tags: +# - setPlenum-v** + +# jobs: +# taginfos: +# name: get Tag infos +# runs-on: ubuntu-latest +# outputs: +# version: ${{ steps.get-release-info.outputs.version }} +# isPreRelease: ${{ steps.get-release-info.outputs.isRC }} +# Branch: ${{ steps.setPRBranch.outputs.prBranch }} +# BASE: ${{ steps.branch.outputs.BASE}} +# nodeVersion: ${{ steps.nodeVersion.outputs.nodeVersion}} +# steps: +# - name: checkout source code +# uses: actions/checkout@v3 +# - name: extract branch +# id: branch +# run: | +# raw=$(git branch -r --contains ${{ github.ref }}) +# branch=${raw/origin\/} +# echo ::set-output\ name=BASE::$branch +# echo "::debug::BASE is being set to $branch" +# - name: get-release-info +# id: get-release-info +# uses: hyperledger/indy-shared-gha/.github/actions/get-release-info@main +# with: +# versionString: "${{ github.ref }}" +# - name: setPRBranch +# id: setPRBranch +# run: | +# if [[ "${{ steps.get-release-info.outputs.isRC }}" == "true" ]]; then +# echo ::set-output\ name=prBranch::update-plenum-rc-version +# else +# echo ::set-output\ name=prBranch::update-plenum-version +# fi +# # - name: Set up Python +# # uses: actions/setup-python@v2 +# # with: +# # python-version: '3.8' +# # - name: Get New Node Version +# # id: nodeVersion +# # run: | +# # major=$(python3 -c "from indy_node import load_version; patch = load_version().parts[0]; print('' if patch is None else patch)") +# # minor=$(python3 -c "from indy_node import load_version; patch = load_version().parts[1]; print('' if patch is None else patch)") +# # patch=$(python3 -c "from indy_node import load_version; patch = load_version().parts[2]; patch+=1; print('' if patch is None else patch)") +# # if [[ "${{ inputs.isRC }}" == "true" ]]; then +# # echo ::set-output\ name=nodeVersion::${major}.${minor}.${patch}rc1 +# # else +# # echo ::set-output\ name=nodeVersion::${major}.${minor}.${patch} +# # fi +# - name: Get new Node Version +# id: nodeVersion +# uses: ./.github/actions/getNewNodeVersion +# with: +# isRC: ${{ steps.get-release-info.outputs.isRC }} + +# updateAndCommit: +# runs-on: ubuntu-latest +# needs: taginfos +# steps: +# - name: checkout source code +# uses: actions/checkout@v3 +# with: +# token: ${{ secrets.BOT_PR_PAT }} +# - name: Update Setup.py +# run: | +# sed -E -i 's/indy-plenum==[[:digit:]]+.[[:digit:]]+.[[:digit:]]+(.(dev|rc)[[:digit:]]+)?/indy-plenum==${{needs.taginfos.outputs.version}}/g' setup.py +# - name: CommitAndTag +# uses: EndBug/add-and-commit@v9 +# with: +# author_name: ${{ github.actor }} +# author_email: ${{ github.event.pusher.email }} +# commit: --signoff +# message: 'Update Plenum Dependency to ${{needs.taginfos.outputs.version}}' +# push: "origin ${{ needs.taginfos.outputs.Branch}} --set-upstream --force" +# new_branch: ${{ needs.taginfos.outputs.Branch}} +# tag: "setRelease-v${{needs.taginfos.outputs.nodeVersion}}" \ No newline at end of file diff --git a/.github/workflows/build/Dockerfile.ubuntu-1604 b/.github/workflows/build/Dockerfile.ubuntu-1604 deleted file mode 100644 index 898d7b430..000000000 --- a/.github/workflows/build/Dockerfile.ubuntu-1604 +++ /dev/null @@ -1,30 +0,0 @@ -FROM hyperledger/indy-core-baseci:0.0.4 - -LABEL maintainer="Hyperledger " - -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ - && apt-get update -y \ - && apt-get install -y \ - python3-nacl \ - libindy-crypto=0.4.5 \ - libindy=1.15.0~1625-xenial \ -# rocksdb python wrapper - libbz2-dev \ - zlib1g-dev \ - liblz4-dev \ - libsnappy-dev \ - rocksdb=5.8.8 \ - ursa=0.3.2-2 \ -# Build dependencies - ruby \ - ruby-dev \ - rubygems \ - gcc \ - make \ -# zstd is needed for caching in github actions pipeline - zstd - -# install fpm -RUN gem install --no-ri --no-rdoc rake fpm - -RUN indy_image_clean \ No newline at end of file diff --git a/.github/workflows/buildimage.yaml b/.github/workflows/buildimage.yaml deleted file mode 100644 index 9b4b110c2..000000000 --- a/.github/workflows/buildimage.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: "Build Docker Image" - -on: - workflow_call: - inputs: - CACHE_KEY_BUILD: - required: true - type: string - GITHUB_REPOSITORY_NAME: - required: true - type: string - UBUNTU_VERSION: - required: true - type: string - -jobs: - build-image: - name: Create Builder Image - runs-on: ubuntu-latest - env: - CACHE_KEY_BUILD: ${{ inputs.CACHE_KEY_BUILD }} - GITHUB_REPOSITORY_NAME: ${{ inputs.GITHUB_REPOSITORY_NAME }} - UBUNTU_VERSION: ${{ inputs.UBUNTU_VERSION }} - steps: - - name: Git checkout - uses: actions/checkout@v2 - - - name: Try load from cache - id: cache-image - uses: actions/cache@v2 - with: - path: ${GITHUB_WORKSPACE}/cache - key: ${{ env.CACHE_KEY_BUILD}} - - - name: Prepare image labels and tags - if: steps.cache-image.outputs.cache-hit != 'true' - id: prep - shell: bash - run: | - DOCKER_IMAGE=ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/node-build - TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${{ env.UBUNTU_VERSION }}" - echo ::set-output name=tags::${TAGS} - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - - - name: Log into the GitHub Container Registry - if: steps.cache-image.outputs.cache-hit != 'true' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - if: steps.cache-image.outputs.cache-hit != 'true' - uses: docker/setup-buildx-action@v1 - - - name: Build and push image - if: steps.cache-image.outputs.cache-hit != 'true' - uses: docker/build-push-action@v2 - with: - context: . - file: .github/workflows/build/Dockerfile.${{ env.UBUNTU_VERSION }} - no-cache: true - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.prep.outputs.tags }} - labels: | - org.opencontainers.image.source=${{ github.event.repository.html_url }} - org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.revision=${{ github.sha }} - - - name: Touch Cache - if: steps.cache-image.outputs.cache-hit != 'true' - run: | - mkdir -p ${GITHUB_WORKSPACE}/cache - touch ${GITHUB_WORKSPACE}/cache/${{ env.CACHE_KEY_BUILD }} \ No newline at end of file diff --git a/.github/workflows/buildpackages.yaml b/.github/workflows/buildpackages.yaml deleted file mode 100644 index a5e82d926..000000000 --- a/.github/workflows/buildpackages.yaml +++ /dev/null @@ -1,111 +0,0 @@ -name: "Build Node Packages" - -on: - workflow_call: - inputs: - GITHUB_REPOSITORY_NAME: - required: true - type: string - UBUNTU_VERSION: - required: true - type: string - isDev: - required: true - type: string - isRC: - required: true - type: string - -jobs: - build_release: - name: Build Release - runs-on: ubuntu-20.04 - env: - UBUNTU_VERSION: ${{ inputs.UBUNTU_VERSION }} - container: - image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/node-build:${{ inputs.UBUNTU_VERSION }} - steps: - - name: Check out code - uses: actions/checkout@v1 - - - name: Set Build Version - id: version - uses: ./.github/actions/set-version - with: - moduleName: indy_node - isDev: ${{ inputs.isDev }} - isRC: ${{ inputs.isRC }} - - - name: Build Deployment Package - run: | - mkdir -p /tmp/node-build - ./build-scripts/${{ env.UBUNTU_VERSION }}/build-indy-node.sh "/__w/indy-node/indy-node" "${{ steps.version.outputs.upstreamVer }}" "/tmp/node-build" "${{ steps.version.outputs.pkgVer }}" - - - uses: actions/upload-artifact@v2 - with: - name: node-deb - path: /tmp/node-build - retention-days: 5 - - build_3rd_party_dependencies: - name: Build 3rd Party Dependencies - runs-on: ubuntu-20.04 - env: - UBUNTU_VERSION: ${{ inputs.UBUNTU_VERSION }} - container: - image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/node-build:${{ inputs.UBUNTU_VERSION }} - steps: - - name: Check out code - uses: actions/checkout@v1 - - - name: Try load from cache. - id: third-party-dependencies - uses: actions/cache@v2 - with: - path: /tmp/third-party-dependencies - key: ${{ format('third-party-dependencies-{0}', hashFiles(format('./build-scripts/{0}/build-3rd-parties.sh', inputs.UBUNTU_VERSION ))) }} - - - name: Build 3rd party deployment packages - if: steps.third-party-dependencies.outputs.cache-hit != 'true' - run: | - mkdir -p ./build-scripts/${{ env.UBUNTU_VERSION }}/cache/3rd-party-dependencies/ - ./build-scripts/${{ env.UBUNTU_VERSION }}/build-3rd-parties.sh ./cache/3rd-party-dependencies - mv ./build-scripts/${{ env.UBUNTU_VERSION }}/cache/* /tmp/third-party-dependencies - - build-python-packages: - name: Build Python Packages - runs-on: ubuntu-20.04 - steps: - - name: Check out code - uses: actions/checkout@v1 - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install required packages via pip - run: | - python3 -m pip install pytest-runner wheel - - - name: Set Build Version - id: version - uses: ./.github/actions/set-version - with: - moduleName: indy_node - isDev: ${{ inputs.isDev }} - isRC: ${{ inputs.isRC }} - - - name: Prepare package and set version - run: | - ./build-scripts/${{ inputs.UBUNTU_VERSION }}/prepare-package.sh . indy_node "${{ steps.version.outputs.upstreamVer }}" python-packages - - - name: Building python package - run: | - python3 setup.py sdist --dist-dir /tmp/dist bdist_wheel --dist-dir /tmp/dist - - - uses: actions/upload-artifact@v2 - with: - name: node-python - path: /tmp/dist - retention-days: 5 diff --git a/.github/workflows/publishRelease.yaml b/.github/workflows/publishRelease.yaml new file mode 100644 index 000000000..14d790daf --- /dev/null +++ b/.github/workflows/publishRelease.yaml @@ -0,0 +1,121 @@ +name: Triggered by Version Bump merged + +#disable all tags and enable all brannches and only version file +on: + push: + branches-ignore: + - update-rc-version + - update-version + paths: + - '!**' + - "indy_node/__version__.json" + +jobs: + release-infos: + name: release-infos + runs-on: ubuntu-latest + outputs: + isVersionBump: ${{ steps.get-release-info.outputs.isVersionBump }} + isPreRelease: ${{ steps.get-release-info.outputs.isRC }} + versionTag: ${{ steps.get-release-info.outputs.versionTag }} + component: ${{ steps.get-release-info.outputs.component}} + CACHE_KEY_BUILD: ${{ steps.workflow-setup.outputs.CACHE_KEY_BUILD }} + UBUNTU_VERSION: ${{ steps.workflow-setup.outputs.UBUNTU_VERSION }} + # Expose the lowercase version of the GitHub repository name + # to all subsequent jobs that reference image repositories + # as the push and pull operations require the URL of the repository + # to be in lowercase. + GITHUB_REPOSITORY_NAME: ${{ steps.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + distribution: ${{ steps.workflow-setup.outputs.distribution }} + publish: ${{ steps.workflow-setup.outputs.publish}} + steps: + - name: checkout source code + uses: actions/checkout@v2 + - name: get-release-info + id: get-release-info + uses: hyperledger/indy-shared-gha/.github/actions/get-release-info@main + with: + versionString: "${{ github.event.head_commit.message }}" + - name: workflow-setup + id: workflow-setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@main + + createRelease: + name: Create Release + needs: [release-infos] + if: needs.release-infos.outputs.isVersionBump == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download Node deb Artifacts from Github Action Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: releasepr.yaml + workflow_conclusion: success + name: indy_node-deb + path: artifacts/indy_node-deb + - name: Download Node python Artifacts from Github Action Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: releasepr.yaml + workflow_conclusion: success + name: indy_node-python + path: artifacts/indy_node-python + - name: Download Node third party dependency Artifacts from Github Action Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: releasepr.yaml + workflow_conclusion: success + name: third-party-dependencies + path: artifacts/third-party-dependencies + - uses: actions/upload-artifact@v2 + with: + name: third-party-dependencies + path: artifacts/third-party-dependencies + retention-days: 5 + - uses: actions/upload-artifact@v2 + with: + name: indy_node-deb + path: artifacts/indy_node-deb + retention-days: 5 + - uses: actions/upload-artifact@v2 + with: + name: indy_node-python + path: artifacts/indy_node-python + retention-days: 5 + - name: Zip Files for Release + run: | + zip -r artifacts/indy_node-deb.zip artifacts/indy_node-deb + zip -r artifacts/indy_node-python.zip artifacts/indy_node-python + zip -r artifacts/third-party-dependencies.zip artifacts/third-party-dependencies + - name: Generate Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ needs.release-infos.outputs.VERSIONTAG }} + files: | + artifacts/**.zip + generate_release_notes: true + body: "[${{ needs.release-infos.outputs.VERSIONTAG }}] " + prerelease: ${{ needs.release-infos.outputs.isPreRelease }} + target_commitish: ${{github.event.ref}} + name: "${{ needs.release-infos.outputs.VERSIONTAG }}" + token: ${{ secrets.BOT_PR_PAT }} + + publish_artifacts: + name: Publish Artifacts + needs: [release-infos, createRelease] + if: needs.release-infos.outputs.isVersionBump == 'true' && needs.release-infos.outputs.publish == 'true' + uses: hyperledger/indy-shared-gha/.github/workflows/publish_artifacts.yaml@main + with: + COMPONENT: ${{ needs.release-infos.component }} + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} + distribution: ${{ needs.release-infos.outputs.distribution }} + moduleName: indy_node + secrets: + INDY_ARTIFACTORY_REPO_CONFIG: ${{ secrets.INDY_ARTIFACTORY_REPO_CONFIG }} + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/publish_artifacts.yaml b/.github/workflows/publish_artifacts.yaml deleted file mode 100644 index cb7aa2c4c..000000000 --- a/.github/workflows/publish_artifacts.yaml +++ /dev/null @@ -1,83 +0,0 @@ -name: "Publish Artifacts" - -on: - workflow_call: - inputs: - GITHUB_REF: - required: true - type: string - UBUNTU_VERSION: - required: true - type: string - distribution: - required: true - type: string - secrets: - INDY_ARTIFACTORY_REPO_CONFIG: - required: true - PYPI_API_TOKEN: - required: true - - -jobs: - publish_artifacts: - name: Publish Artifacts - runs-on: ubuntu-20.04 - env: - GITHUB_REF: ${{ inputs.GITHUB_REF }} - distribution: ${{ inputs.distribution }} - steps: - - name: Check out code - uses: actions/checkout@v1 - - - name: Setup JFrog CLI - uses: jfrog/setup-jfrog-cli@v2 - env: - JF_ARTIFACTORY_1: ${{ secrets.INDY_ARTIFACTORY_REPO_CONFIG }} - - - name: Ping Artifactory - run: | - # Test the connection to Ping the Hyperledger Artifactory server - # to ensure everything has been setup correctly. - jfrog rt ping - - - name: Download Node Artifacts from Pipeline Artifacts - uses: actions/download-artifact@v2 - with: - name: node-deb - path: to_publish - - - name: Publish Node Artifacts - uses: ./.github/actions/publish-deb - with: - sourceDirectory: /home/runner/work/indy-node/indy-node/to_publish - distribution: ${{ env.distribution }} - component: ${{ env.GITHUB_REF }} - - - name: Download 3rd Party Artifacts Dependencies from Cache - id: third-party-dependencies - uses: actions/cache@v2 - with: - path: /tmp/third-party-dependencies - key: ${{ format('third-party-dependencies-{0}', hashFiles(format('./build-scripts/{0}/build-3rd-parties.sh', inputs.UBUNTU_VERSION ))) }} - - - name: Publish 3rd Party Dependencies - uses: ./.github/actions/publish-deb - with: - sourceDirectory: /home/runner/tmp/third-party-dependencies - distribution: ${{ env.distribution }} - component: ${{ env.GITHUB_REF }} - - - name: Download Python Packages from Pipeline Artifacts - uses: actions/download-artifact@v2 - with: - name: node-python - path: dist - - - name: Publish Python Package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - skip_existing: true - \ No newline at end of file diff --git a/.github/workflows/push_pr.yaml b/.github/workflows/push_pr.yaml deleted file mode 100644 index 6cd230ab2..000000000 --- a/.github/workflows/push_pr.yaml +++ /dev/null @@ -1,156 +0,0 @@ -name: Indy Node - Push and PR Workflow -on: - push: - branches: - - ubuntu-20.04-upgrade - - feature/did-indy* - - pull_request: - branches: - - ubuntu-20.04-upgrade - - feature/did-indy* - workflow_dispatch: - -jobs: - workflow-setup: - name: Initialize Workflow - runs-on: ubuntu-latest - outputs: - CACHE_KEY_BUILD: ${{ steps.cache.outputs.CACHE_KEY_BUILD }} - UBUNTU_VERSION: ${{ steps.cache.outputs.UBUNTU_VERSION }} - # Expose the lowercase version of the GitHub repository name - # to all subsequent jobs that reference image repositories - # as the push and pull operations require the URL of the repository - # to be in lowercase. - GITHUB_REPOSITORY_NAME: ${{ steps.repository-name.outputs.lowercase }} - GITHUB_REF: ${{ steps.cache.outputs.GITHUB_REF }} - distribution: ${{ steps.cache.outputs.distribution }} - isDev: ${{ steps.build-flags.outputs.isDev }} - isRC: ${{ steps.build-flags.outputs.isRC }} - publish: ${{ steps.build-flags.outputs.publish }} - steps: - - name: Git checkout - uses: actions/checkout@v2 - - - name: Convert the GitHub repository name to lowercase - id: repository-name - uses: ASzc/change-string-case-action@v1 - with: - string: ${{ github.repository }} - - - name: Set outputs - id: cache - run: | - # Set variables according to version of ubuntu - if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then - echo "::set-output name=CACHE_KEY_BUILD::${{ hashFiles('.github/workflows/build/Dockerfile.ubuntu-1604') }}" - echo "::set-output name=UBUNTU_VERSION::ubuntu-1604" - echo "::set-output name=distribution::xenial" - fi - if [[ "${{github.base_ref}}" == "ubuntu-20.04-upgrade" || "${{github.ref}}" == "refs/heads/ubuntu-20.04-upgrade" ]]; then - echo "::set-output name=CACHE_KEY_BUILD::${{ hashFiles('.github/workflows/build/Dockerfile.ubuntu-2004') }}" - echo "::set-output name=UBUNTU_VERSION::ubuntu-2004" - echo "::set-output name=distribution::focal" - fi - if [[ "${{github.base_ref}}" == "feature/did-indy-new" || "${{github.ref}}" == "refs/heads/feature/did-indy-new" ]]; then - echo "::set-output name=CACHE_KEY_BUILD::${{ hashFiles('.github/workflows/build/Dockerfile.ubuntu-2004') }}-0" - echo "::set-output name=UBUNTU_VERSION::ubuntu-2004" - echo "::set-output name=distribution::focal" - fi - - - if [[ "${{github.base_ref}}" == 'master' || "${{github.ref}}" == 'refs/heads/master' || "${{github.base_ref}}" == 'main' || "${{github.ref}}" == 'refs/heads/main' ]]; then - echo "::set-output name=GITHUB_REF::main" - elif [[ "${{github.base_ref}}" == 'release*' || "${{github.ref}}" == 'refs/heads/release*' ]]; then - echo "::set-output name=GITHUB_REF::rc" - elif [[ "${{github.base_ref}}" == 'stable' || "${{github.ref}}" == 'refs/heads/stable' ]]; then - echo "::set-output name=GITHUB_REF::stable" - else - echo "::set-output name=GITHUB_REF::dev" - fi - - - name: Set build flags - id: build-flags - run: | - - if [[ "${{steps.cache.outputs.GITHUB_REF}}" == 'dev' || "${{steps.cache.outputs.GITHUB_REF}}" == 'main' ]]; then - echo "::set-output name=isDev::true" - else - echo "::set-output name=isDev::false" - fi - - if [[ "${{steps.cache.outputs.GITHUB_REF}}" == 'rc' ]]; then - echo "::set-output name=isRC::true" - else - echo "::set-output name=isRC::false" - fi - - # Ensure publishing is only performed when the build is executed from the main (hyperledger/indy-node) repository. - if [[ ${{github.event.repository.full_name}} == 'hyperledger/indy-node' && ${{github.event_name}} == 'push' && ( ${{steps.cache.outputs.GITHUB_REF}} == 'main' || ${{steps.cache.outputs.GITHUB_REF}} == 'rc' || ${{steps.cache.outputs.GITHUB_REF}} == 'stable' || ${{steps.cache.outputs.GITHUB_REF}} == 'dev' ) ]]; then - echo "::set-output name=publish::true" - else - echo "::set-output name=publish::false" - fi - - lint: - name: Lint - # Reference to workflow-setup job is required to access the GITHUB_REPOSITORY_NAME output. - needs: [workflow-setup] - runs-on: ubuntu-20.04 - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-lint - restore-keys: | - ${{ runner.os }}-pip-lint - - name: Install flake8 - run: pip install flake8==3.8.4 pep8==1.7.1 pep8-naming==0.6.1 - - name: Lint with flake8 - run: python3 -m flake8 . - - build-image: - name: Create Builder Image - needs: [workflow-setup, lint] - uses: ./.github/workflows/buildimage.yaml - with: - CACHE_KEY_BUILD: ${{ needs.workflow-setup.outputs.CACHE_KEY_BUILD }} - GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} - UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} - - indy_node_tests: - name: Indy Node Tests - needs: [workflow-setup, build-image] - uses: ./.github/workflows/test.yaml - with: - GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} - UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} - - build_packages: - name: Build Packages - needs: [workflow-setup, indy_node_tests] - uses: ./.github/workflows/buildpackages.yaml - with: - GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} - UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} - isDev: ${{ needs.workflow-setup.outputs.isDev }} - isRC: ${{ needs.workflow-setup.outputs.isRC }} - - publish_artifacts: - name: Publish Artifacts - needs: [workflow-setup, build_packages] - if: needs.workflow-setup.outputs.publish == 'true' - uses: ./.github/workflows/publish_artifacts.yaml - with: - GITHUB_REF: ${{ needs.workflow-setup.outputs.GITHUB_REF }} - UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} - distribution: ${{ needs.workflow-setup.outputs.distribution }} - secrets: - INDY_ARTIFACTORY_REPO_CONFIG: ${{ secrets.INDY_ARTIFACTORY_REPO_CONFIG }} - PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/releasepr.yaml b/.github/workflows/releasepr.yaml new file mode 100644 index 000000000..0cab3bd0b --- /dev/null +++ b/.github/workflows/releasepr.yaml @@ -0,0 +1,73 @@ +name: Triggered by Version Bump Release PR + +on: + pull_request: + paths: + - '!**' + - "indy_node/__version__.json" + +jobs: + release-infos: + name: infos + runs-on: ubuntu-latest + outputs: + isVersionBump: ${{ steps.get-release-info.outputs.isVersionBump }} + isPreRelease: ${{ steps.get-release-info.outputs.isRC }} + CACHE_KEY_BUILD: ${{ steps.workflow-setup.outputs.CACHE_KEY_BUILD }} + UBUNTU_VERSION: ${{ steps.workflow-setup.outputs.UBUNTU_VERSION }} + # Expose the lowercase version of the GitHub repository name + # to all subsequent jobs that reference image repositories + # as the push and pull operations require the URL of the repository + # to be in lowercase. + GITHUB_REPOSITORY_NAME: ${{ steps.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + distribution: ${{ steps.workflow-setup.outputs.distribution }} + steps: + - name: checkout source code + uses: actions/checkout@v2 + - name: get-release-info + id: get-release-info + uses: hyperledger/indy-shared-gha/.github/actions/get-release-info@main + with: + versionString: "${{ github.event.pull_request.body }}" + - name: workflow-setup + id: workflow-setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@main + + lint: + name: Lint + needs: [release-infos] + if: needs.release-infos.outputs.isVersionBump == 'true' + uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@main + + build-docker-image: + name: Create Builder Image + needs: [release-infos, lint] + if: needs.release-infos.outputs.isVersionBump == 'true' + uses: hyperledger/indy-shared-gha/.github/workflows/buildimage.yaml@main + with: + CACHE_KEY_BUILD: ${{ needs.release-infos.outputs.CACHE_KEY_BUILD }} + DOCKER_IMAGE: ghcr.io/${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }}/node-build + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} + + + indy_node_tests: + name: Indy Node Tests + needs: [release-infos, build-docker-image] + if: needs.release-infos.outputs.isVersionBump == 'true' + uses: ./.github/workflows/reuseable_test.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} + + + build_packages: + name: Build Packages + needs: [release-infos, indy_node_tests] + if: needs.release-infos.outputs.isVersionBump == 'true' + uses: hyperledger/indy-shared-gha/.github/workflows/buildpackages.yaml@main + with: + DOCKER_IMAGE: ghcr.io/${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }}/node-build:${{ needs.release-infos.outputs.UBUNTU_VERSION }} + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} + isDev: 'false' + isRC: '${{ needs.release-infos.outputs.isPreRelease }}' + moduleName: indy_node diff --git a/.github/workflows/test.yaml b/.github/workflows/reuseable_test.yaml similarity index 100% rename from .github/workflows/test.yaml rename to .github/workflows/reuseable_test.yaml diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 000000000..6c2bdf82c --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,75 @@ +name: Triggered by set Tag + +on: + push: + tags: + - setRelease-v** + +jobs: + taginfos: + name: get Tag infos + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get-release-info.outputs.version }} + versionTag: ${{ steps.get-release-info.outputs.versionTag }} + prBranch: ${{ steps.get-release-info.outputs.prBranch }} + BASE: ${{ steps.get-branch.outputs.branch}} + steps: + - name: checkout source code + uses: actions/checkout@v1 + - name: extract branch + id: get-branch + uses: hyperledger/indy-shared-gha/.github/actions/branch-from-tag@main + with: + tag: ${{ github.ref }} + - name: get-release-info + id: get-release-info + uses: hyperledger/indy-shared-gha/.github/actions/get-release-info@main + with: + versionString: "${{ github.ref }}" + + bump_version: + name: Bump Version Number + needs: taginfos + runs-on: ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Install deps for version change + run: | + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9692C00E657DDE61 + sudo add-apt-repository 'deb https://hyperledger.jfrog.io/artifactory/indy focal dev' + sudo apt-get update -y && sudo apt-get install -y \ + rocksdb=5.8.8 \ + libgflags-dev \ + libsnappy-dev \ + zlib1g-dev \ + libbz2-dev \ + liblz4-dev \ + libgflags-dev + pip install packaging \ + importlib_metadata==3.10.1 \ + indy-plenum==1.13.0.dev14 \ + pyzmq==22.3.0 + - name: Prepare package and set version + run: | + ./bump_version.sh ${{ needs.taginfos.outputs.VERSION }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + author: ${{ github.actor }} <${{ github.event.pusher.email }}> + committer: ${{ github.actor }} <${{ github.event.pusher.email }}> + signoff: true + commit-message: Update Version number for v${{ needs.taginfos.outputs.version }} + base: ${{ needs.taginfos.outputs.BASE }} + branch: ${{ needs.taginfos.outputs.prBranch }} + title: "[${{ needs.taginfos.outputs.versionTag }}] - Update Version Number for Release" + body: "[${{ needs.taginfos.outputs.versionTag }}] - Update Version number for Release" + delete-branch: true + token: ${{ secrets.BOT_PR_PAT }} + \ No newline at end of file diff --git a/build-scripts/ubuntu-1604/Dockerfile b/build-scripts/ubuntu-1604/Dockerfile deleted file mode 100644 index 1c9f348eb..000000000 --- a/build-scripts/ubuntu-1604/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update -y && apt-get install -y \ - # common stuff - git \ - wget \ - unzip \ - python3.5 \ - python3-pip \ - python3-venv \ - # fmp - ruby \ - ruby-dev \ - rubygems \ - gcc \ - make \ - && rm -rf /var/lib/apt/lists/* - -# issues with pip>=10: -# https://github.com/pypa/pip/issues/5240 -# https://github.com/pypa/pip/issues/5221 -RUN python3 -m pip install -U pip setuptools \ - && pip3 list - -# install fpm -RUN gem install --no-ri --no-rdoc rake fpm - -WORKDIR /root - -ADD . /root diff --git a/build-scripts/ubuntu-1604/README.md b/build-scripts/ubuntu-1604/README.md deleted file mode 100644 index d972042dc..000000000 --- a/build-scripts/ubuntu-1604/README.md +++ /dev/null @@ -1,30 +0,0 @@ -### Build indy-node using docker - -``` -./build-indy-node-docker.sh -``` -Built package is placed in a docker volume `indy-node-deb-u1604`. - -### Build indy-node - -``` -./build-indy-node.sh -``` - -Built package is placed in the `output-path` folder. - -### Build 3rd-party dependencies using docker - -``` -./build-3rd-parties-docker.sh -``` - -Built packages are placed in a docker volume `indy-node-deb-u1604`. - -### Build 3rd-party dependencies - -``` -./build-3rd-parties-docker.sh -``` - -Built packages are placed in the `output-path` folder. diff --git a/build-scripts/ubuntu-1604/build-3rd-parties-docker.sh b/build-scripts/ubuntu-1604/build-3rd-parties-docker.sh deleted file mode 100755 index e333bd28a..000000000 --- a/build-scripts/ubuntu-1604/build-3rd-parties-docker.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -x -set -e - -if [ -z "$2" ]; then - CMD="/root/build-3rd-parties.sh /output" -else - CMD="$2" -fi - -PKG_NAME=indy-node -IMAGE_NAME="${PKG_NAME}-build-u1604" -OUTPUT_VOLUME_NAME="${1:-"${PKG_NAME}-deb-u1604"}" - -docker build -t "${PKG_NAME}-build-u1604" -f Dockerfile . -docker volume create --name "${OUTPUT_VOLUME_NAME}" - -docker run \ - -i \ - --rm \ - -v "${OUTPUT_VOLUME_NAME}:/output" \ - "${IMAGE_NAME}" \ - $CMD diff --git a/build-scripts/ubuntu-1604/build-3rd-parties.sh b/build-scripts/ubuntu-1604/build-3rd-parties.sh deleted file mode 100755 index 4b7311b73..000000000 --- a/build-scripts/ubuntu-1604/build-3rd-parties.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x - -OUTPUT_PATH="${1:-.}" - -function build_from_pypi { - PACKAGE_NAME="$1" - - if [ -z "$2" ]; then - PACKAGE_VERSION="" - else - PACKAGE_VERSION="==$2" - fi - POSTINST_TMP="postinst-${PACKAGE_NAME}" - PREREM_TMP="prerm-${PACKAGE_NAME}" - cp postinst "${POSTINST_TMP}" - cp prerm "${PREREM_TMP}" - sed -i "s/{package_name}/python3-${PACKAGE_NAME}/" "${POSTINST_TMP}" - sed -i "s/{package_name}/python3-${PACKAGE_NAME}/" "${PREREM_TMP}" - - fpm --input-type "python" \ - --output-type "deb" \ - --architecture "amd64" \ - --verbose \ - --python-package-name-prefix "python3"\ - --python-bin "/usr/bin/python3" \ - --exclude "*.pyc" \ - --exclude "*.pyo" \ - --maintainer "Hyperledger " \ - --after-install "${POSTINST_TMP}" \ - --before-remove "${PREREM_TMP}" \ - --package "${OUTPUT_PATH}" \ - "${PACKAGE_NAME}${PACKAGE_VERSION}" - - rm "${POSTINST_TMP}" - rm "${PREREM_TMP}" -} - -# build 3rd parties: -# build_from_pypi -# TODO duplicates list from Jenkinsfile.cd - -SCRIPT_PATH="${BASH_SOURCE[0]}" -pushd `dirname ${SCRIPT_PATH}` >/dev/null - -build_from_pypi timeout-decorator 0.4.0 -build_from_pypi distro 1.3.0 - -popd >/dev/null \ No newline at end of file diff --git a/build-scripts/ubuntu-1604/build-indy-node-docker.sh b/build-scripts/ubuntu-1604/build-indy-node-docker.sh deleted file mode 100755 index f27b9bff6..000000000 --- a/build-scripts/ubuntu-1604/build-indy-node-docker.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -xe - -PKG_SOURCE_PATH="$1" -VERSION="$2" -PKG_NAME=indy-node -IMAGE_NAME="${PKG_NAME}-build-u1604" -OUTPUT_VOLUME_NAME="${3:-"${PKG_NAME}-deb-u1604"}" -PACKAGE_VERSION="${4:-$VERSION}" - -if [[ (-z "${PKG_SOURCE_PATH}") || (-z "${VERSION}") ]]; then - echo "Usage: $0 [ [package-version]]" - exit 1; -fi - -if [ -z "$5" ]; then - CMD="/root/build-${PKG_NAME}.sh /input ${VERSION} /output ${PACKAGE_VERSION}" -else - CMD="$5" -fi - -docker build -t "${IMAGE_NAME}" -f Dockerfile . -docker volume create --name "${OUTPUT_VOLUME_NAME}" - -docker run \ - -i \ - --rm \ - -v "${PKG_SOURCE_PATH}:/input" \ - -v "${OUTPUT_VOLUME_NAME}:/output" \ - -e PKG_NAME="${PKG_NAME}" \ - "${IMAGE_NAME}" \ - $CMD diff --git a/build-scripts/ubuntu-1604/build-indy-node.sh b/build-scripts/ubuntu-1604/build-indy-node.sh deleted file mode 100755 index 5ac86fc2f..000000000 --- a/build-scripts/ubuntu-1604/build-indy-node.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -xe - -INPUT_PATH="$1" -VERSION="$2" -OUTPUT_PATH="${3:-.}" -PACKAGE_VERSION=${4:-$VERSION} - -PACKAGE_NAME=indy-node - -# copy the sources to a temporary folder -TMP_DIR="$(mktemp -d)" -cp -r "${INPUT_PATH}/." "${TMP_DIR}" - -# prepare the sources -cd "${TMP_DIR}/build-scripts/ubuntu-1604" -./prepare-package.sh "${TMP_DIR}" indy_node "${VERSION}" debian-packages - - -sed -i "s/{package_name}/${PACKAGE_NAME}/" "prerm" - -fpm --input-type "python" \ - --output-type "deb" \ - --architecture "amd64" \ - --verbose \ - --python-package-name-prefix "python3" \ - --python-bin "/usr/bin/python3" \ - --exclude "*.pyc" \ - --exclude "*.pyo" \ - --depends at \ - --depends iptables \ - --depends libsodium18 \ - --no-python-fix-dependencies \ - --maintainer "Hyperledger " \ - --before-install "preinst_node" \ - --after-install "postinst_node" \ - --before-remove "prerm" \ - --name "${PACKAGE_NAME}" \ - --version ${PACKAGE_VERSION} \ - --package "${OUTPUT_PATH}" \ - "${TMP_DIR}" - -rm -rf "${TMP_DIR}" diff --git a/build-scripts/ubuntu-1604/postinst b/build-scripts/ubuntu-1604/postinst deleted file mode 100755 index cf749a657..000000000 --- a/build-scripts/ubuntu-1604/postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Automatically added from template: -if which py3compile >/dev/null 2>&1; then - py3compile -O -p {package_name} /usr/local/lib/python3.5/dist-packages/ -fi - -# End automatically added section diff --git a/build-scripts/ubuntu-1604/postinst_node b/build-scripts/ubuntu-1604/postinst_node deleted file mode 100755 index a13ddcad6..000000000 --- a/build-scripts/ubuntu-1604/postinst_node +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/bash - -# it should be fixed -ENABLE_STDOUT_LOGGING="enableStdOutLogging" -GENERAL_CONFIG_DIR="/etc/indy" -GENERAL_DATA_DIR="/var/lib/indy" -GENERAL_LOG_DIR="/var/log/indy" - -INSTALL_DIR='/usr/local/lib/python3.5/dist-packages' - -NOFILES_SOFT_LIMIT=65536 -NOFILES_HARD_LIMIT=131072 - -CLIENT_CONNECTIONS_LIMIT=500 - - -# create general indy config folder if does not exist -mkdir -p $GENERAL_CONFIG_DIR -# create general indy data folder if does not exist -mkdir -p $GENERAL_DATA_DIR -# create general indy log folder if does not exist -mkdir -p $GENERAL_LOG_DIR - -# create indy node config if does not exist -if [ ! -f $GENERAL_CONFIG_DIR/indy_config.py ]; then - cp $INSTALL_DIR/indy_node/general_config/indy_config.py $GENERAL_CONFIG_DIR -else - if [ -z "$(grep $ENABLE_STDOUT_LOGGING $GENERAL_CONFIG_DIR/indy_config.py)" ]; then - printf "\n%s\n%s\n" "# Disable stdout logging" "$ENABLE_STDOUT_LOGGING = False" >> $GENERAL_CONFIG_DIR/indy_config.py - fi -fi - -chmod -R ug+rwx $GENERAL_CONFIG_DIR -chmod -R ug+rwx $GENERAL_DATA_DIR -chmod -R ug+rwx $GENERAL_LOG_DIR - - -# init_indy_node script -cat < /usr/local/bin/init_indy_node -#!/bin/bash - -if [ \$# -lt 5 ]; then - echo "" - echo "Usage: \$0 name ip port client_ip client_port [seed]"; - echo " name - node name"; - echo " ip - node IP"; - echo " port - node port"; - echo " client_ip - node client IP"; - echo " client_port - node client port"; - echo " seed - node seed"; - echo "" - exit 1; -fi - -echo "NODE_NAME=\$1" > $GENERAL_CONFIG_DIR/indy.env -echo "NODE_IP=\$2" >> $GENERAL_CONFIG_DIR/indy.env -echo "NODE_PORT=\$3" >> $GENERAL_CONFIG_DIR/indy.env -echo "NODE_CLIENT_IP=\$4" >> $GENERAL_CONFIG_DIR/indy.env -echo "NODE_CLIENT_PORT=\$5" >> $GENERAL_CONFIG_DIR/indy.env -echo "CLIENT_CONNECTIONS_LIMIT=$CLIENT_CONNECTIONS_LIMIT" >> $GENERAL_CONFIG_DIR/indy.env - -if [ -z \$6 ]; then - init_indy_keys --name \$1 -else - init_indy_keys --name \$1 --seed \$6 -fi -EOF - -chmod +x /usr/local/bin/init_indy_node - -# add systemd script -cat < /etc/systemd/system/indy-node.service -[Unit] -Description=Indy Node -Requires=indy-node-control.service - -[Service] -EnvironmentFile=$GENERAL_CONFIG_DIR/indy.env -ExecStart=/usr/bin/env python3 -O /usr/local/bin/start_indy_node \${NODE_NAME} \${NODE_IP} \${NODE_PORT} \${NODE_CLIENT_IP} \${NODE_CLIENT_PORT} -User=indy -Group=indy -Restart=on-failure -RestartSec=10 -StartLimitBurst=10 -StartLimitInterval=200 -TimeoutSec=300 -LimitNOFILE=$NOFILES_SOFT_LIMIT:$NOFILES_HARD_LIMIT - -[Install] -WantedBy=multi-user.target -EOF - - -cat < /etc/systemd/system/indy-node-control.service -[Unit] -Description=Service for upgrade of existing Indy Node and other operations -#Requires=indy.service -#After=indy.service -After=network.target - -[Service] -Type=simple -EnvironmentFile=$GENERAL_CONFIG_DIR/node_control.conf -ExecStart=/usr/bin/env python3 -O /usr/local/bin/start_node_control_tool \$TEST_MODE --hold-ext \${HOLD_EXT} -Restart=on-failure -RestartSec=10 -StartLimitBurst=10 -StartLimitInterval=200 -TimeoutSec=300 - -[Install] -WantedBy=multi-user.target -EOF - -# add supervisord script -cat < /etc/supervisor/indy-node.conf -[supervisord] -nodaemon=true -logfile=/var/log/indy/supervisord.log -logfile_maxbytes=10MB -loglevel=critical - -[supervisorctl] -serverurl=http://127.0.0.1:9001 - -[inet_http_server] -port = 127.0.0.1:9001 - -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[program:indy-node] -command=sh -ac '. $GENERAL_CONFIG_DIR/indy.env;/usr/bin/env python3 -O /usr/local/bin/start_indy_node \${NODE_NAME} \${NODE_IP} \${NODE_PORT} \${NODE_CLIENT_IP} \${NODE_CLIENT_PORT}' -user=indy -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=true -startsecs=15 -startretries=6 -stopasgroup=true -killasgroup=true - -[program:indy-node-control] -command=sh -ac '. $GENERAL_CONFIG_DIR/node_control.conf;/usr/bin/env python3 -O /usr/local/bin/start_node_control_tool \${TEST_MODE} --hold-ext "\${HOLD_EXT}"' -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=true -startsecs=15 -startretries=6 -stopasgroup=true -killasgroup=true -EOF - -HOLD_EXT_ADDED=$(grep HOLD_EXT /etc/indy/node_control.conf) -if [ ! -f $GENERAL_CONFIG_DIR/node_control.conf ] || [ -z "${HOLD_EXT_ADDED}" ]; then - cat < $GENERAL_CONFIG_DIR/node_control.conf -# Uncomment this to run agent in test mode: -#TEST_MODE=--test - -TEST_MODE= -HOLD_EXT= -EOF -fi -sed -ie '/HOLD_EXT/{ s/\\//g}' $GENERAL_CONFIG_DIR/node_control.conf - -mv /usr/local/bin/upgrade_indy_node_ubuntu1604.sh /usr/local/bin/upgrade_indy_node -mv /usr/local/bin/upgrade_indy_node_ubuntu1604_test.sh /usr/local/bin/upgrade_indy_node_test -mv /usr/local/bin/restart_indy_node_ubuntu1604.sh /usr/local/bin/restart_indy_node -mv /usr/local/bin/restart_sovrin_node_ubuntu1604.sh /usr/local/bin/restart_sovrin_node -mv /usr/local/bin/complete_rebranding_upgrade_ubuntu1604.sh /usr/local/bin/complete_rebranding_upgrade - -chmod +x /usr/local/bin/upgrade_indy_node -chmod +x /usr/local/bin/upgrade_indy_node_test -chmod +x /usr/local/bin/restart_indy_node -chmod +x /usr/local/bin/restart_sovrin_node -chmod +x /usr/local/bin/complete_rebranding_upgrade - -rm -f /usr/local/bin/delete_indy_node.bat /usr/local/bin/upgrade_indy_node_test.bat \ - /usr/local/bin/restart_indy_node.bat /usr/local/bin/install_nssm.bat /usr/local/bin/upgrade_indy_node.bat \ - /usr/local/bin/install_indy_node.bat /usr/local/bin/restart_upgrade_agent.bat - -chown -R indy:indy $GENERAL_CONFIG_DIR -chown -R indy:indy $GENERAL_DATA_DIR -chown -R indy:indy $GENERAL_LOG_DIR -chmod -R ug+rw $GENERAL_CONFIG_DIR -chmod -R ug+rw $GENERAL_DATA_DIR -chmod -R ug+rw $GENERAL_LOG_DIR - -# Automatically added from template: -if which py3compile >/dev/null 2>&1; then - py3compile -O -p indy-node $INSTALL_DIR -fi - -# End automatically added section diff --git a/build-scripts/ubuntu-1604/preinst_node b/build-scripts/ubuntu-1604/preinst_node deleted file mode 100755 index 4e1addfb6..000000000 --- a/build-scripts/ubuntu-1604/preinst_node +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if ! id -u indy > /dev/null 2>&1; then - useradd -r -m -s /bin/bash -U indy -fi diff --git a/build-scripts/ubuntu-1604/prepare-package.sh b/build-scripts/ubuntu-1604/prepare-package.sh deleted file mode 100755 index 50d827506..000000000 --- a/build-scripts/ubuntu-1604/prepare-package.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -xe - -if [ "$1" = "--help" ] ; then - echo "Usage: $0 " - echo " - Set to 'debian-packages' when preparing deb packages, and 'python-packages' when preparing PyPi packages." - exit 0 -fi - -repo="$1" -module_name="$2" -version_dotted="$3" -distro_packages="$4" - -BUMP_SH_SCRIPT="bump_version.sh" -GENERATE_MANIFEST_SCRIPT="generate_manifest.sh" - -pushd $repo - -echo -e "\nSetting version to $version_dotted" -bash -ex $BUMP_SH_SCRIPT $version_dotted -cat $module_name/__version__.json - -echo -e "\nGenerating manifest" -bash -ex $GENERATE_MANIFEST_SCRIPT -cat $module_name/__manifest__.json - -echo -e "\n\nPrepares indy-node debian package version" -sed -i -r "s~indy-node==([0-9\.]+[0-9])(\.)?([a-z]+)~indy-node==\1\~\3~" setup.py - -if [ "$distro_packages" = "debian-packages" ]; then - # Only used for the deb package builds, NOT for the PyPi package builds. - # Update the package names to match the versions that are pre-installed on the os. - echo -e "\nAdapt the dependencies for the Canonical archive" - #### ToDo adjust packages for the Cannonical archive for Ubuntu 20.04 (focal) - # sed -i "s~timeout-decorator~python3-timeout-decorator~" setup.py - # sed -i "s~distro~python3-distro~" setup.py -elif [ "$distro_packages" = "python-packages" ]; then - echo -e "\nNo adaption of dependencies for python packages" -else - echo -e "\nNo distribution specified. Please, specify distribution as 'debian-packages' or 'python-packages'." - exit 1 -fi - -echo "Preparing config files" -GENERAL_CONFIG_DIR="\/etc\/indy" -REPO_GENERAL_CONFIG_DIR="indy_node/general_config" -# Define user config directory -sed -i "s/^\(GENERAL_CONFIG_DIR\s*=\s*\).*\$/\1\"$GENERAL_CONFIG_DIR\"/" indy_common/config.py -# Create user config -cp $REPO_GENERAL_CONFIG_DIR/general_config.py $REPO_GENERAL_CONFIG_DIR/indy_config.py -cat $REPO_GENERAL_CONFIG_DIR/ubuntu_platform_config.py >> $REPO_GENERAL_CONFIG_DIR/indy_config.py -rm -f $REPO_GENERAL_CONFIG_DIR/general_config.py -rm -f $REPO_GENERAL_CONFIG_DIR/ubuntu_platform_config.py -rm -f $REPO_GENERAL_CONFIG_DIR/windows_platform_config.py - -popd - -echo -e "\nFinished preparing $repo for publishing\n" diff --git a/build-scripts/ubuntu-1604/prerm b/build-scripts/ubuntu-1604/prerm deleted file mode 100755 index 40af9b22a..000000000 --- a/build-scripts/ubuntu-1604/prerm +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Automatically added from template: - -dpkg -L {package_name} | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)' - -# End automatically added section \ No newline at end of file diff --git a/build-scripts/ubuntu-2004/build-indy-node.sh b/build-scripts/ubuntu-2004/build-indy_node.sh similarity index 100% rename from build-scripts/ubuntu-2004/build-indy-node.sh rename to build-scripts/ubuntu-2004/build-indy_node.sh diff --git a/docs/source/release-workflow.png b/docs/source/release-workflow.png new file mode 100644 index 000000000..352718881 Binary files /dev/null and b/docs/source/release-workflow.png differ diff --git a/docs/source/release-workflow.puml b/docs/source/release-workflow.puml new file mode 100644 index 000000000..79d17610e --- /dev/null +++ b/docs/source/release-workflow.puml @@ -0,0 +1,81 @@ +@startuml + +:**Tag Triggered - Release Workflow**; +start + +:Create a tag on the branch and commit on which the release +is to be based. + +The tag must be in the following format: + - ""setRelease-v..[-rc]"" + +Examples: + - To generate an RC Release (marked as a pre-release) + - ""setRelease-v1.12.6-rc0"" + - To generate an official Release + - ""setRelease-v1.12.6""; + +partition "**Workflow**: tag.yaml" { + floating note left + Workflow triggered + by the ""setRelease"" + tag being pushed. + end note + + :Extract information; + note left:Extract version number from tag + :Bump version number; + :Create Pull Request to the branch, where the tag was set on; +} + +partition "**Workflow**: releasepr.yaml" { + floating note left + Workflow triggered + by Pull Request affecting + **ONLY** ""indy_node/_version_.json"". + end note + + :Extract information; + if (isVersionBump) then (yes) + :Lint using ""indy-shared-gha""; + :build Docker-images using ""indy-shared-gha""; + :Execute tests (""reuseable_tests.yaml""); + :Esecute ""indy-test-automation""; + note left: WIP + :build packages using ""indy-shared-gha""; + note left: packages published to workflow + else (no) + endif +} + +if (**Review PR** - All tests passed?) then (Merge PR) + partition "**Workflow**: publishRelease.yaml" { + floating note right + Workflow triggered by + pushes affecting + **ONLY** + ""indy_node/_version_.json"". + end note + + :Extract version number from the commit message; + if (isVersionBump) then (yes) + :Download artifacts from last successfull ""releasepr"" run; + :Create a GitHub Release; + :Set tag and title to match release version; + + if (is RC Release) then (yes) + :Set pre-release checkbox; + else (no) + endif + :Publish GitHub Release + - Containing the artifacts; + :Publish Packages using ""indy-shared-gha""; + else (no) + endif + } +else (Close PR without Merging) + :Release process aborted; +endif + +stop +@enduml