From 22a7fd1145fe07f0abf8eb420fc404ecb52a0e69 Mon Sep 17 00:00:00 2001 From: pSchlarb Date: Tue, 14 Jun 2022 13:34:41 +0000 Subject: [PATCH 1/6] added reuseable_build_package,.yaml Signed-off-by: pSchlarb --- .github/workflows/Push.yaml | 16 ++++++-- .../workflows/reuseable_build_package.yaml | 37 +++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/reuseable_build_package.yaml diff --git a/.github/workflows/Push.yaml b/.github/workflows/Push.yaml index 7d3d8357..f73d49a5 100644 --- a/.github/workflows/Push.yaml +++ b/.github/workflows/Push.yaml @@ -48,10 +48,18 @@ jobs: DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} - token-plugin-tests: - name: Token Plugin Tests + # token-plugin-tests: + # name: Token Plugin 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-package: + name: Token Plugin Build package needs: [workflow-setup, build-image] - uses: ./.github/workflows/reuseable_test.yaml + uses: ./.github/workflows/reuseable_build_package.yaml with: GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} - UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} \ No newline at end of file + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} diff --git a/.github/workflows/reuseable_build_package.yaml b/.github/workflows/reuseable_build_package.yaml new file mode 100644 index 00000000..e3bf8863 --- /dev/null +++ b/.github/workflows/reuseable_build_package.yaml @@ -0,0 +1,37 @@ +name: "Build Token Plugin Package" + +on: + workflow_call: + inputs: + GITHUB_REPOSITORY_NAME: + required: true + type: string + UBUNTU_VERSION: + required: true + type: string + +jobs: + build_token_plugin_release: + name: Token Plugin Release + runs-on: ubuntu-20.04 + container: + image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ inputs.UBUNTU_VERSION }} + steps: + - name: adding github workspace as safe directory + run: git config --global --add safe.directory $GITHUB_WORKSPACE + - name: Check out code + uses: actions/checkout@v3 + - name: Build Token Plugin deployment package + run: | + mkdir -p /tmp/build-output + fpm --input-type dir --output-type deb --name sovtoken --version latest --depends "indy-node(=1.13.0~dev1225)" --verbose --no-python-dependencies --force sovtoken/ + fpm --input-type dir --output-type deb --name sovtokenfees --version latest --depends "indy-node(=1.13.0~dev1225)" --verbose --no-python-dependencies --force sovtokenfees/ + mv ./*.deb /tmp/build-output + - uses: actions/upload-artifact@v2 + with: + name: sovtoken-deb + path: /tmp/build-output/sovtoken_*.deb + - uses: actions/upload-artifact@v2 + with: + name: sovtokenfees-deb + path: /tmp/build-output/sovtokenfees_*.deb \ No newline at end of file From 947db3c4bd787ff27a0f4d0a7f43c55bd7e558e9 Mon Sep 17 00:00:00 2001 From: Philipp Schlarb Date: Wed, 15 Jun 2022 15:56:12 +0200 Subject: [PATCH 2/6] Added WIP reuseable publish WF Signed-off-by: Philipp Schlarb --- .github/workflows/Push.yaml | 8 ++++ .../workflows/reuseable_build_package.yaml | 8 ++-- .github/workflows/reuseable_publish.yaml | 40 +++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/reuseable_publish.yaml diff --git a/.github/workflows/Push.yaml b/.github/workflows/Push.yaml index f73d49a5..ba1ae806 100644 --- a/.github/workflows/Push.yaml +++ b/.github/workflows/Push.yaml @@ -63,3 +63,11 @@ jobs: with: GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + publish-package: + name: Token Plugin Publish Packages + needs: [workflow-setup, build-package] + uses: ./.github/workflows/reuseable_publish.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} diff --git a/.github/workflows/reuseable_build_package.yaml b/.github/workflows/reuseable_build_package.yaml index e3bf8863..77d9dacc 100644 --- a/.github/workflows/reuseable_build_package.yaml +++ b/.github/workflows/reuseable_build_package.yaml @@ -12,7 +12,7 @@ on: jobs: build_token_plugin_release: - name: Token Plugin Release + name: Token Plugin Build Packages runs-on: ubuntu-20.04 container: image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ inputs.UBUNTU_VERSION }} @@ -27,11 +27,13 @@ jobs: fpm --input-type dir --output-type deb --name sovtoken --version latest --depends "indy-node(=1.13.0~dev1225)" --verbose --no-python-dependencies --force sovtoken/ fpm --input-type dir --output-type deb --name sovtokenfees --version latest --depends "indy-node(=1.13.0~dev1225)" --verbose --no-python-dependencies --force sovtokenfees/ mv ./*.deb /tmp/build-output - - uses: actions/upload-artifact@v2 + - name: Upload sovtoken-deb + uses: actions/upload-artifact@v2 with: name: sovtoken-deb path: /tmp/build-output/sovtoken_*.deb - - uses: actions/upload-artifact@v2 + - name: Upload sovtokenfees-deb + uses: actions/upload-artifact@v2 with: name: sovtokenfees-deb path: /tmp/build-output/sovtokenfees_*.deb \ No newline at end of file diff --git a/.github/workflows/reuseable_publish.yaml b/.github/workflows/reuseable_publish.yaml new file mode 100644 index 00000000..c4f791aa --- /dev/null +++ b/.github/workflows/reuseable_publish.yaml @@ -0,0 +1,40 @@ +name: "Publish Token Plugin Packages" + +on: + workflow_call: + inputs: + GITHUB_REPOSITORY_NAME: + required: true + type: string + UBUNTU_VERSION: + required: true + type: string + +jobs: + publish_token_plugin: + name: Token Plugin Publish Packages + runs-on: ubuntu-20.04 + steps: + - name: Setup + run: | + sudo apt-get update && sudo apt-get install -y \ + openssh-client \ + python3.5 \ + python3-pip + pip3 install -U pip plumbum==1.6.7 six==1.12.0 deb-pkg-tools + - name: Clone Sovrin Packaging Repo + run: echo "Todo Clone Sovrin Packaging Repo" + - name: Download sovtoken-deb package from GHA + uses: actions/download-artifact@v2 + with: + name: sovtoken-deb + path: ./ + - name: Download sovtokenfees-deb package from GHA + uses: actions/download-artifact@v2 + with: + name: sovtokenfees-deb + path: ./ + - name: Publish Packages + run: | + ls -lisha + echo "Todo Packages with upload_debs.py and secrets" From 36313acdc455bc761746c5ca0b7348f132788b73 Mon Sep 17 00:00:00 2001 From: Philipp Schlarb Date: Mon, 20 Jun 2022 09:35:02 +0000 Subject: [PATCH 3/6] added update version script, tag WF Signed-off-by: Philipp Schlarb --- .github/workflows/reuseable_publish.yaml | 7 +-- .github/workflows/tag.yaml | 59 ++++++++++++++++++++++++ updateVersion.py | 14 ++++++ 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/tag.yaml create mode 100644 updateVersion.py diff --git a/.github/workflows/reuseable_publish.yaml b/.github/workflows/reuseable_publish.yaml index c4f791aa..9d2ad81b 100644 --- a/.github/workflows/reuseable_publish.yaml +++ b/.github/workflows/reuseable_publish.yaml @@ -23,18 +23,19 @@ jobs: python3-pip pip3 install -U pip plumbum==1.6.7 six==1.12.0 deb-pkg-tools - name: Clone Sovrin Packaging Repo - run: echo "Todo Clone Sovrin Packaging Repo" + run: echo "Todo Clone Sovrin Packaging Repo (sovtoken needs to be used and set up)" - name: Download sovtoken-deb package from GHA uses: actions/download-artifact@v2 with: name: sovtoken-deb - path: ./ + path: /tmp/tokendebs/ - name: Download sovtokenfees-deb package from GHA uses: actions/download-artifact@v2 with: name: sovtokenfees-deb - path: ./ + path: /tmp/tokendebs/ - name: Publish Packages run: | ls -lisha echo "Todo Packages with upload_debs.py and secrets" + echo "Something like: ./upload_debs.py /tmp/tokendebs {$repoName} {$repoComponent} --host {$secrets.SOVRIN_REPO_HOST} --ssh-key {$secrets.sovrin_key}" diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 00000000..e25cd546 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,59 @@ +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@v1 + with: + tag: ${{ github.ref }} + - name: get-release-info + id: get-release-info + uses: hyperledger/indy-shared-gha/.github/actions/get-release-info@v1 + 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: Prepare package and set version + run: | + python3 updateVersion.py ${{ 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/updateVersion.py b/updateVersion.py new file mode 100644 index 00000000..d61b5070 --- /dev/null +++ b/updateVersion.py @@ -0,0 +1,14 @@ +import sys +import json + +with open('sovtoken/sovtoken/metadata.json', 'r' ) as f: + data = json.load(f) + data["version"]=sys.argv[1] + json.dump(data, open("sovtoken/sovtoken/metadata.json","w"), indent= 4) + +with open('sovtokenfees/sovtokenfees/metadata.json', 'r' ) as f: + data = json.load(f) + data["version"]=sys.argv[1] + json.dump(data, open("sovtokenfees/sovtokenfees/metadata.json","w"), indent= 4) + +print("Updated version of sovtoken and sovtokenfees metadata.json to: ", sys.argv[1]) \ No newline at end of file From a92bf90d6f15e2e4fd36a447dd9bd4d443f5bff7 Mon Sep 17 00:00:00 2001 From: Philipp Schlarb Date: Mon, 20 Jun 2022 09:56:14 +0000 Subject: [PATCH 4/6] added releasepr.yaml Signed-off-by: Philipp Schlarb --- .github/workflows/Push.yaml | 10 ++--- .github/workflows/releasepr.yaml | 67 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/releasepr.yaml diff --git a/.github/workflows/Push.yaml b/.github/workflows/Push.yaml index ba1ae806..21614753 100644 --- a/.github/workflows/Push.yaml +++ b/.github/workflows/Push.yaml @@ -32,11 +32,11 @@ jobs: id: setup uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1 -# lint: -# name: Lint -# needs: [workflow-setup] -# # if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }} -# uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@v1 + lint: + name: Lint + needs: [workflow-setup] + if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }} + uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@v1 build-image: name: Create Builder Image diff --git a/.github/workflows/releasepr.yaml b/.github/workflows/releasepr.yaml new file mode 100644 index 00000000..8eab156b --- /dev/null +++ b/.github/workflows/releasepr.yaml @@ -0,0 +1,67 @@ +name: Triggered by Version Bump Release PR + +on: + pull_request: + paths: + - '!**' + - "sovtoken/sovtoken/metadata.json" + - "sovtokenfees/sovtokenfees/metadata.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@v1 + with: + versionString: "${{ github.event.pull_request.body }}" + - name: workflow-setup + id: workflow-setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1 + + lint: + name: Lint + needs: [release-infos] +# if: ${{ needs.release-infos.outputs.testsNeeded == 'true' }} + uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@v1 + + build-image: + name: Create Builder Image + needs: [release-infos] + if: ${{ always() }} + uses: hyperledger/indy-shared-gha/.github/workflows/buildimage.yaml@v1 + with: + CACHE_KEY_BUILD: ${{ needs.release-infos.outputs.CACHE_KEY_BUILD }} + DOCKER_IMAGE: ghcr.io/${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} + + token-plugin-tests: + name: Token Plugin 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-package: + name: Token Plugin Build package + needs: [release-infos, build-image] + uses: ./.github/workflows/reuseable_build_package.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} From ec8e6316c9d641dca6a1636105403260e6f89ba2 Mon Sep 17 00:00:00 2001 From: pSchlarb Date: Tue, 21 Jun 2022 13:09:03 +0000 Subject: [PATCH 5/6] Added PR, PublishRelease Workflows Signed-off-by: pSchlarb --- .github/workflows/PR.yaml | 83 +++++++ .github/workflows/Push.yaml | 25 +- .github/workflows/build.yaml | 215 ------------------ .../workflows/lint/Dockerfile.ubuntu-16-04 | 21 -- .../workflows/lint/Dockerfile.ubuntu-20-04 | 19 -- .github/workflows/lint/scripts/clean.sh | 6 - .github/workflows/publishRelease.yaml | 99 ++++++++ .github/workflows/releasepr.yaml | 17 +- .vscode/settings.json | 2 +- sovtoken/sovtoken/metadata.json | 5 +- sovtokenfees/sovtokenfees/metadata.json | 5 +- updateVersion.py | 4 +- 12 files changed, 214 insertions(+), 287 deletions(-) create mode 100644 .github/workflows/PR.yaml delete mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/lint/Dockerfile.ubuntu-16-04 delete mode 100644 .github/workflows/lint/Dockerfile.ubuntu-20-04 delete mode 100644 .github/workflows/lint/scripts/clean.sh create mode 100644 .github/workflows/publishRelease.yaml diff --git a/.github/workflows/PR.yaml b/.github/workflows/PR.yaml new file mode 100644 index 00000000..8f63058c --- /dev/null +++ b/.github/workflows/PR.yaml @@ -0,0 +1,83 @@ +name: token-plugin-pr +on: + pull_request: + branches: + - master + - gha-ubuntu-20.04 + - ubuntu-20.04 + - ubuntu-20.04-upgrade + - Devcontainers + - GHARefactoring + paths: + - '**.py' + - '.github/**' + 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 }} + testsNeeded: ${{ steps.testsNeeded.outputs.testsNeeded }} + steps: + - name: checkout source code + uses: actions/checkout@v2 + - name: setup + id: setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1 + - name: testsNeeded + id: testsNeeded + uses: dorny/paths-filter@v2 + with: + filters: | + testsNeeded: + - '**.py' + - '.github/**' + + lint: + name: Lint + needs: [workflow-setup] + if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }} + uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@v1 + + build-image: + name: Create Builder Image + needs: [workflow-setup, lint] + uses: hyperledger/indy-shared-gha/.github/workflows/buildimage.yaml@v1 + with: + CACHE_KEY_BUILD: ${{ needs.workflow-setup.outputs.CACHE_KEY_BUILD }} + DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + token-plugin-tests: + name: Token Plugin 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: Token Plugin Build package + needs: [workflow-setup, token-plugin-tests] + uses: ./.github/workflows/reuseable_build_package.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} + + statusCheck: + name: statusCheck + runs-on: ubuntu-latest + needs: [workflow-setup, build-packages] + if: ${{ needs.workflow-setup.outputs.testsNeeded == 'false' || success() }} + steps: + - run: 'echo "Just a status Check (Always true, when executed) for branch protection rules(blocks merging while test are running and if tests fail)." ' \ No newline at end of file diff --git a/.github/workflows/Push.yaml b/.github/workflows/Push.yaml index 21614753..1b8c80e5 100644 --- a/.github/workflows/Push.yaml +++ b/.github/workflows/Push.yaml @@ -9,8 +9,10 @@ on: - ubuntu-20.04-upgrade - Devcontainers - GHARefactoring - workflow_dispatch: - + paths: + - '**.py' + - '.github/**' + jobs: workflow-setup: name: Initialize Workflow @@ -32,10 +34,9 @@ jobs: id: setup uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1 - lint: + lint: name: Lint needs: [workflow-setup] - if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }} uses: hyperledger/indy-shared-gha/.github/workflows/lint.yaml@v1 build-image: @@ -48,17 +49,17 @@ jobs: DOCKER_IMAGE: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build UBUNTU_VERSION: ${{ needs.workflow-setup.outputs.UBUNTU_VERSION }} - # token-plugin-tests: - # name: Token Plugin 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 }} + token-plugin-tests: + name: Token Plugin 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-package: name: Token Plugin Build package - needs: [workflow-setup, build-image] + needs: [workflow-setup, token-plugin-tests] uses: ./.github/workflows/reuseable_build_package.yaml with: GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index 0043137c..00000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,215 +0,0 @@ -# name: token-plugin-build -# on: -# workflow_dispatch: -# push: -# branches: -# - master -# - gha-ubuntu-20.04 -# - ubuntu-20.04 -# - ubuntu-20.04-upgrade -# - Devcontainers -# pull_request: -# branches: -# - master -# - gha-ubuntu-20.04 -# - ubuntu-20.04 -# - ubuntu-20.04-upgrade -# - Devcontainers - -# jobs: -# workflow-setup: -# runs-on: ubuntu-latest -# outputs: -# CACHE_KEY_BUILD: ${{ steps.cache.outputs.CACHE_KEY_BUILD }} -# CACHE_KEY_LINT: ${{ steps.cache.outputs.CACHE_KEY_LINT }} -# DOCKER_FILE_POSTFIX: ${{ steps.cache.outputs.DOCKER_FILE_POSTFIX }} -# # 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.cache.outputs.GITHUB_REPOSITORY_NAME }} -# steps: -# - name: Git checkout -# uses: actions/checkout@v2 - -# - name: Set outputs -# id: cache -# run: | -# # Convert the GitHub repository name to lowercase -# echo "::set-output name=GITHUB_REPOSITORY_NAME::$(echo ${GITHUB_REPOSITORY,,})" -# echo "::set-output name=CACHE_KEY_BUILD::${{ hashFiles('.github/workflows/build/Dockerfile.ubuntu-20-04') }}" -# echo "::set-output name=CACHE_KEY_LINT::${{ hashFiles('.github/workflows/lint/Dockerfile.ubuntu-20-04') }}" -# echo "::set-output name=DOCKER_FILE_POSTFIX::ubuntu-20-04" - -# build-image: -# # Reference to workflow-setup job is required to access its various outputs. -# needs: workflow-setup -# runs-on: ubuntu-latest -# env: -# DOCKER_BUILDKIT: 1 -# CACHE_KEY_BUILD: ${{ needs.workflow-setup.outputs.CACHE_KEY_BUILD }} -# GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} -# DOCKER_FILE_POSTFIX: ${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# 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: 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: 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 }}/token-plugin-build -# # ToDo - Update hard coded 'ubuntu-16-04' tag when integrating these flows with the ubuntu-20.04-upgrade branch. -# TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:ubuntu-20.04" -# echo ::set-output name=tags::${TAGS} -# echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - - -# - 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.DOCKER_FILE_POSTFIX }} -# no-cache: true -# push: true -# 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 }} - -# lint-image: -# # Reference to workflow-setup job is required to access its various outputs. -# needs: workflow-setup -# runs-on: ubuntu-latest -# env: -# DOCKER_BUILDKIT: 1 -# CACHE_KEY_LINT: ${{ needs.workflow-setup.outputs.CACHE_KEY_LINT }} -# GITHUB_REPOSITORY_NAME: ${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }} -# DOCKER_FILE_POSTFIX: ${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# 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_LINT}} - -# - name: If NOT found in cache, build and push image. -# if: steps.cache-image.outputs.cache-hit != 'true' -# run: | -# export GITHUB_REPOSITORY_NAME=$(echo ${GITHUB_REPOSITORY,,}) -# echo ${{ secrets.CR_PAT }} | docker login ghcr.io --username ${{ secrets.CR_USER }} --password-stdin -# docker build -f .github/workflows/lint/Dockerfile.${{ env.DOCKER_FILE_POSTFIX }} --no-cache -t ${{ env.GITHUB_REPOSITORY_NAME }}/token-plugin-lint:${{ env.CACHE_KEY_LINT }} . -# docker tag ${{ env.GITHUB_REPOSITORY_NAME }}/token-plugin-lint:${{ env.CACHE_KEY_LINT }} ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/token-plugin-lint:${{ env.DOCKER_FILE_POSTFIX }} -# docker push ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/token-plugin-lint:${{ env.DOCKER_FILE_POSTFIX }} -# mkdir -p ${GITHUB_WORKSPACE}/cache -# touch ${GITHUB_WORKSPACE}/cache/${{ env.CACHE_KEY_LINT }} - -# token_plugin_tests: -# name: Token Plugin Tests -# # Reference to workflow-setup job is required to access the GITHUB_REPOSITORY_NAME output. -# needs: [workflow-setup, build-image] -# runs-on: ubuntu-20.04 -# # Fix for scacap/action-surefire-report out of memory error: -# # - https://github.com/ScaCap/action-surefire-report/issues/17 -# env: -# DOCKER_FILE_POSTFIX: ${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# container: -# image: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# strategy: -# matrix: -# module: [sovtoken, sovtokenfees] -# fail-fast: false -# steps: -# - name: Check out code -# uses: actions/checkout@v2 - -# - name: Install dependencies -# run: | -# pip install -U -e sovtoken -# pip install -U -e sovtokenfees - -# - name: Run Token Plugin ${{ matrix.module }} -# id: token-plugin-test -# run: python3 -m pytest -l -vv --junitxml=test-result-token-plugin-${{ matrix.module }}.xml ${{ matrix.module }} - -# - name: Publish Test Report -# if: success() || failure() -# uses: scacap/action-surefire-report@v1.0.7 -# continue-on-error: true -# with: -# check_name: Token Plugin ${{ matrix.module }} Test Report -# github_token: ${{ secrets.GITHUB_TOKEN }} -# report_paths: test-result-token-plugin-${{ matrix.module }}.xml - -# lint: -# name: Lint -# # Reference to workflow-setup job is required to access the GITHUB_REPOSITORY_NAME output. -# needs: [workflow-setup, lint-image] -# runs-on: ubuntu-20.04 -# env: -# DOCKER_FILE_POSTFIX: ${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# container: -# image: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-lint:${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# steps: -# - name: Check out code -# uses: actions/checkout@v2 - -# - name: flake8 -# run: python3 -m flake8 -# build_token_plugin_release: -# name: Token Plugin Release -# needs: [workflow-setup, build-image, token_plugin_tests] -# runs-on: ubuntu-20.04 -# env: -# DOCKER_FILE_POSTFIX: ${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# container: -# image: ghcr.io/${{ needs.workflow-setup.outputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ needs.workflow-setup.outputs.DOCKER_FILE_POSTFIX }} -# strategy: -# fail-fast: false -# steps: -# - name: Check out code -# uses: actions/checkout@v1 - -# - name: Build Token Plugin deployment package -# run: | -# mkdir -p /tmp/build-output -# cd devops -# make package FPM_P_VERSION=latest -# mv ./*.deb /tmp/build-output -# - uses: actions/upload-artifact@v2 -# with: -# name: token-deb -# path: /tmp/build-output diff --git a/.github/workflows/lint/Dockerfile.ubuntu-16-04 b/.github/workflows/lint/Dockerfile.ubuntu-16-04 deleted file mode 100644 index d1870d40..00000000 --- a/.github/workflows/lint/Dockerfile.ubuntu-16-04 +++ /dev/null @@ -1,21 +0,0 @@ -# Development -FROM ubuntu:18.04 -LABEL maintainer="Kevin Griffin " - -RUN apt-get update && apt-get dist-upgrade -y - -# Install environment -RUN apt-get install -y \ - git \ - wget \ - python3.5 \ - python3-pip \ - python-setuptools \ - python3-nacl - -RUN pip3 install -U \ - 'pip<10.0.0' \ - setuptools \ - pep8==1.7.1 \ - pep8-naming==0.6.1 \ - flake8==3.5.0 diff --git a/.github/workflows/lint/Dockerfile.ubuntu-20-04 b/.github/workflows/lint/Dockerfile.ubuntu-20-04 deleted file mode 100644 index 935e84e5..00000000 --- a/.github/workflows/lint/Dockerfile.ubuntu-20-04 +++ /dev/null @@ -1,19 +0,0 @@ -# Development -FROM ubuntu:20.04 -LABEL maintainer="Robin Klemens " - -RUN apt-get update && apt-get dist-upgrade -y - -# Install environment -RUN apt-get install -y \ - git \ - wget \ - python3-pip \ - python3-nacl - -RUN pip3 install -U \ - 'pip<10.0.0' \ - setuptools==50.3.2 \ - pep8==1.7.1 \ - pep8-naming==0.6.1 \ - flake8==3.8.4 diff --git a/.github/workflows/lint/scripts/clean.sh b/.github/workflows/lint/scripts/clean.sh deleted file mode 100644 index 0794812d..00000000 --- a/.github/workflows/lint/scripts/clean.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -e -set -x - -apt-get -y autoremove -rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/.github/workflows/publishRelease.yaml b/.github/workflows/publishRelease.yaml new file mode 100644 index 00000000..99651c19 --- /dev/null +++ b/.github/workflows/publishRelease.yaml @@ -0,0 +1,99 @@ +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: + - '!**' + - "sovtoken/sovtoken/metadata.json" + - "sovtokenfees/sovtokenfees/metadata.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 }} + version: ${{ steps.get-release-info.outputs.version }} + 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@v1 + with: + versionString: "${{ github.event.head_commit.message }}" + - name: workflow-setup + id: workflow-setup + uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1 + + 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 sovtoken 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: sovtoken-deb + path: artifacts/sovtoken-deb + - name: Download sovtokenfees 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: sovtokenfees-deb + path: artifacts/sovtokenfees-deb + - name: Upload sovtoken-deb + uses: actions/upload-artifact@v2 + with: + name: sovtoken-deb + path: artifacts/sovtoken-deb + - name: Upload sovtokenfees-deb + uses: actions/upload-artifact@v2 + with: + name: sovtokenfees-deb + path: artifacts/sovtokenfees-deb + - name: Generate Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ needs.release-infos.outputs.VERSIONTAG }} + files: | + artifacts/**.deb + 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-package: + name: Token Plugin Publish Packages + needs: [release-infos, build-package] + uses: ./.github/workflows/reuseable_publish.yaml + with: + GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} \ No newline at end of file diff --git a/.github/workflows/releasepr.yaml b/.github/workflows/releasepr.yaml index 8eab156b..ff89115b 100644 --- a/.github/workflows/releasepr.yaml +++ b/.github/workflows/releasepr.yaml @@ -52,16 +52,23 @@ jobs: token-plugin-tests: name: Token Plugin Tests - needs: [workflow-setup, build-image] + needs: [release-infos, 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 }} + GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }} + UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} - build-package: + build-packages: name: Token Plugin Build package - needs: [release-infos, build-image] + needs: [release-infos, token-plugin-tests] uses: ./.github/workflows/reuseable_build_package.yaml with: GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }} UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }} + + statusCheck: + name: statusCheck + runs-on: ubuntu-latest + needs: [build-packages] + steps: + - run: 'echo "Just a status Check (Always true, when executed) for branch protection rules(blocks merging while test are running and if tests fail)." ' \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 913de240..997ef5c1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,6 @@ ], "python.testing.unittestEnabled": false, "yaml.schemas": { - "https://json.schemastore.org/github-workflow.json": "file:///workspace/token-plugin-1/.github/workflows/build.yaml" + "https://json.schemastore.org/github-workflow": "/.github/workflows/**/*.yml" } } \ No newline at end of file diff --git a/sovtoken/sovtoken/metadata.json b/sovtoken/sovtoken/metadata.json index 6684d956..845e77ed 100644 --- a/sovtoken/sovtoken/metadata.json +++ b/sovtoken/sovtoken/metadata.json @@ -1,6 +1,5 @@ { "version": "1.2", "author": "Sovrin", - "license":"Apache 2.0" -} - + "license": "Apache 2.0" +} \ No newline at end of file diff --git a/sovtokenfees/sovtokenfees/metadata.json b/sovtokenfees/sovtokenfees/metadata.json index 6684d956..845e77ed 100644 --- a/sovtokenfees/sovtokenfees/metadata.json +++ b/sovtokenfees/sovtokenfees/metadata.json @@ -1,6 +1,5 @@ { "version": "1.2", "author": "Sovrin", - "license":"Apache 2.0" -} - + "license": "Apache 2.0" +} \ No newline at end of file diff --git a/updateVersion.py b/updateVersion.py index d61b5070..4f34525b 100644 --- a/updateVersion.py +++ b/updateVersion.py @@ -4,11 +4,11 @@ with open('sovtoken/sovtoken/metadata.json', 'r' ) as f: data = json.load(f) data["version"]=sys.argv[1] - json.dump(data, open("sovtoken/sovtoken/metadata.json","w"), indent= 4) + json.dump(data, open("sovtoken/sovtoken/metadata.json","w"), indent= 2) with open('sovtokenfees/sovtokenfees/metadata.json', 'r' ) as f: data = json.load(f) data["version"]=sys.argv[1] - json.dump(data, open("sovtokenfees/sovtokenfees/metadata.json","w"), indent= 4) + json.dump(data, open("sovtokenfees/sovtokenfees/metadata.json","w"), indent= 2) print("Updated version of sovtoken and sovtokenfees metadata.json to: ", sys.argv[1]) \ No newline at end of file From 9d1d2537ca3555597689e946ef63691891765da5 Mon Sep 17 00:00:00 2001 From: pSchlarb Date: Tue, 21 Jun 2022 13:29:28 +0000 Subject: [PATCH 6/6] trigger test on pr Signed-off-by: pSchlarb --- .github/workflows/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 4926405c..528adcd6 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,5 +1,5 @@ # GitHub Actions Workflow - +#should trigger The workflow in the [build.yaml](build.yaml) file replaces the existing [Jenkins.ci](../../devops/aws-codebuilg/Jenkinsfile.ci) build process. The `lint` job replaces the `Static code validation` stage of the Jenkins pipeline, while the remainder of the jobs replace the `Build / Test` stage.