Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev containers & GHA Release Flow #311

Merged
merged 8 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu/.devcontainer/base.Dockerfile

# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

RUN apt-get update && apt-get install -y software-properties-common

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3BC8C2DD662F1C45 && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9692C00E657DDE61 && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88

RUN add-apt-repository "deb https://sovrin.jfrog.io/artifactory/deb focal dev"
RUN add-apt-repository "deb https://hyperledger.jfrog.io/artifactory/indy focal dev rc"

RUN apt-get update

RUN apt-get install -y \
python3-dev \
python3-pip \
indy-plenum=1.13.1~rc2 \
python3-libnacl=1.6.1 \
python3-sortedcontainers=1.5.7 \
python3-ujson=1.33 \
rubygems

RUN gem install fpm
RUN apt-get install sovtoken sovtokenfees indy-node=1.13.2~rc3 -y
RUN pip install /sovtoken /sovtokenfees
RUN apt remove indy-node indy-plenum -y
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
"args": { "VARIANT": "focal" }
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"mhutchie.git-graph",
"eamodio.gitlens",
"ms-python.python",
"cschleiden.vscode-github-actions",
"eamodio.gitlens",
"GitHub.vscode-pull-request-github",
"ms-vscode.makefile-tools",
"littlefoxteam.vscode-python-test-adapter",
"ms-azuretools.vscode-docker"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip install .[tests]",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "root",
"features": {
"docker-from-docker": "latest",
"git": "os-provided"
}
}
103 changes: 103 additions & 0 deletions .github/workflows/PR.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Sovrin PR

on:
pull_request:
paths:
- '**'
- '.github/**'
- "!sovrin/metadata.json"
branches:
- master
- DevContainers

jobs:
workflow-setup:
name: Initialize Workflow
runs-on: ubuntu-latest
outputs:
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@v3
- name: setup
id: setup
uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1
with:
ownerRepo: "sovrin-foundation"
- name: testsNeeded
id: testsNeeded
uses: dorny/paths-filter@v2
with:
filters: |
testsNeeded:
- '**.py'
- 'sovrin/*genesis'
- '.github/**'
extract-information:
name: Extract needed Information for Indy-Test-Automation
needs: [workflow-setup]
if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }}
runs-on: ubuntu-latest
outputs:
indyVersion: ${{ steps.indy-versions.outputs.indyVersion}}
sovtokenVersion: ${{ steps.sovtoken-versions.outputs.sovtokenVersion}}
sovtokenfeesVersion: ${{ steps.sovtoken-versions.outputs.sovtokenfeesVersion}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Set up python
run: |
pip3 install semver
- name: Get Version with UX-timestamp
id: version
run: |
echo "version=$(python3 updateVersion.py --getVersion)" >> $GITHUB_OUTPUT
- name: prepare
run: ./build-scripts/ubuntu-2004/prepare-package.sh ./ ${{ steps.version.outputs.version }}
- name: Extract Indy Versions
id: indy-versions
run: |
echo "indyVersion=$(grep -oP "\d+.\d+.\d+((-|.)?rc\d+)?" <<< $(grep -oP "indy-node==\d+.\d+.\d+((-|.)?rc\d+)?" setup.py))" >>$GITHUB_OUTPUT
- name: Extract sovtoken & sovtokenfees Version
id: sovtoken-versions
run: |
echo "sovtokenVersion=$(grep -oP "\d+.\d+.\d+((-|.)?((rc)|(dev))?\d+)?" <<< $(grep -oP "sovtoken==\d+.\d+.\d+((-|.)?(rc|dev)\d+)?" setup.py))" >>$GITHUB_OUTPUT
echo "sovtokenfeesVersion=$(grep -oP "\d+.\d+.\d+((-|.)?((rc)|(dev))?\d+)?" <<< $(grep -oP "sovtokenfees==\d+.\d+.\d+((-|.)?(rc|dev)\d+)?" setup.py))" >>$GITHUB_OUTPUT

build_sovrin:
name: Build Sovrin Deb
needs: [workflow-setup]
if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }}
uses: ./.github/workflows/reuseable_build_package.yaml
with:
isDev: true

call-indy-test-automation:
name: Indy-Test-Automation
needs: [workflow-setup, extract-information, build_sovrin]
if: ${{ needs.workflow-setup.outputs.testsNeeded == 'true' }}
uses: hyperledger/indy-test-automation/.github/workflows/[email protected]
with:
ubuntuVersion: "ubuntu-2004"
libsovtokenJSON: "{\"install\": \"yes\", \"version\": \"1.0.5\"}"
tokenPluginJSON: "{\"install\":\"yes\", \"sovtokenVersion\": \"${{ needs.extract-information.outputs.sovtokenVersion }}\", \"sovtokenfeesVersion\":\"${{ needs.extract-information.outputs.sovtokenfeesVersion }}\"}"
sovrinJSON: "{ \"install\": \"yes\"}"
indyJSON: "{ \"nodeVersion\": \"${{ needs.extract-information.outputs.indyVersion }}\", \"plenumVersion\" : \"1.13.1~rc2\", \"ursaVersion\": \"0.3.2-1\", \"pyzmqVersion\" : \"22.3.0\"}"
libIndyVersion: "1.15.0~1625-bionic"
includePaymentTests: true
testAutomationBranch: "v0.9"

statusCheck:
name: statusCheck
runs-on: ubuntu-latest
needs: [workflow-setup, call-indy-test-automation]
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)." '
105 changes: 105 additions & 0 deletions .github/workflows/PublishRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Publish Release 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:
- '!**'
- "sovrin/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@v3
- 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
with:
ownerRepo: "sovrin-foundation"

createRelease:
name: Create Release
needs: [release-infos]
if: needs.release-infos.outputs.isVersionBump == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download sovrin 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: sovrin.deb
path: artifacts/sovrin-deb
- name: Download sovrin 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: sovrin-python
path: artifacts/sovrin-python
- name: Upload sovrin-deb
uses: actions/upload-artifact@v3
with:
name: sovrin.deb
path: artifacts/sovrin-deb
- name: Upload sovrin-python
uses: actions/upload-artifact@v3
with:
name: sovrin-python
path: artifacts/sovrin-python
- name: Generate Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-infos.outputs.VERSIONTAG }}
files: |
artifacts/**
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: Sovrin Publish Packages
needs: [release-infos, createRelease]
if: needs.release-infos.outputs.publish == 'true'
uses: ./.github/workflows/reuseable_publish.yaml
with:
GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }}
distribution: ${{ needs.release-infos.outputs.distribution }}
UBUNTU_VERSION: ${{ needs.release-infos.outputs.UBUNTU_VERSION }}
REPO_COMPONENT: ${{ needs.release-infos.outputs.component}}
secrets:
SOVRIN_ARTIFACTORY_REPO_CONFIG: ${{ secrets.SOVRIN_ARTIFACTORY_REPO_CONFIG }}
107 changes: 107 additions & 0 deletions .github/workflows/Push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Sovrin Push

on:
push:
branches:
- master
- DevContainers
paths:
- 'sovrin/*_genesis'
- '.github/**'
- '**.py'

jobs:
workflow-setup:
name: Initialize Workflow
runs-on: ubuntu-latest
outputs:
testsNeeded: ${{ steps.testsNeeded.outputs.testsNeeded }}
steps:
- name: checkout source code
uses: actions/checkout@v3
- name: setup
id: setup
uses: hyperledger/indy-shared-gha/.github/actions/workflow-setup@v1
with:
ownerRepo: "sovrin-foundation"
- name: testsNeeded
id: testsNeeded
uses: dorny/paths-filter@v2
with:
filters: |
testsNeeded:
- '**.py'
- 'sovrin/*genesis'
- '.github/**'

extract-information:
name: Extract needed Information for Indy-Test-Automation
runs-on: ubuntu-latest
outputs:
indyVersion: ${{ steps.indy-versions.outputs.indyVersion}}
sovtokenVersion: ${{ steps.sovtoken-versions.outputs.sovtokenVersion}}
sovtokenfeesVersion: ${{ steps.sovtoken-versions.outputs.sovtokenfeesVersion}}
GITHUB_REPOSITORY_NAME: ${{ steps.repository-name.outputs.lowercase }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Convert the GitHub repository name to lowercase
id: repository-name
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Set up python
run: |
pip3 install semver
- name: Get Version with UX-timestamp
id: version
run: |
echo "version=$(python3 updateVersion.py --getVersion)" >> $GITHUB_OUTPUT
- name: prepare
run: ./build-scripts/ubuntu-2004/prepare-package.sh ./ ${{ steps.version.outputs.version }}
- name: Extract Indy Versions
id: indy-versions
run: |
echo "indyVersion=$(grep -oP "\d+.\d+.\d+((-|.)?rc\d+)?" <<< $(grep -oP "indy-node==\d+.\d+.\d+((-|.)?rc\d+)?" setup.py))" >>$GITHUB_OUTPUT
- name: Extract sovtoken & sovtokenfees Version
id: sovtoken-versions
run: |
echo "sovtokenVersion=$(grep -oP "\d+.\d+.\d+((-|.)?((rc)|(dev))?\d+)?" <<< $(grep -oP "sovtoken==\d+.\d+.\d+((-|.)?(rc|dev)\d+)?" setup.py))" >>$GITHUB_OUTPUT
echo "sovtokenfeesVersion=$(grep -oP "\d+.\d+.\d+((-|.)?((rc)|(dev))?\d+)?" <<< $(grep -oP "sovtokenfees==\d+.\d+.\d+((-|.)?(rc|dev)\d+)?" setup.py))" >>$GITHUB_OUTPUT

build_sovrin:
name: Build Sovrin Deb
uses: ./.github/workflows/reuseable_build_package.yaml
with:
isDev: true

call-indy-test-automation:
name: Indy-Test-Automation
needs: [extract-information,build_sovrin]
uses: hyperledger/indy-test-automation/.github/workflows/[email protected]
with:
ubuntuVersion: "ubuntu-2004"
libsovtokenJSON: "{\"install\": \"yes\", \"version\": \"1.0.5\"}"
tokenPluginJSON: "{\"install\":\"yes\", \"sovtokenVersion\": \"${{ needs.extract-information.outputs.sovtokenVersion }}\", \"sovtokenfeesVersion\":\"${{ needs.extract-information.outputs.sovtokenfeesVersion }}\"}"
sovrinJSON: "{ \"install\": \"yes\"}"
indyJSON: "{ \"nodeVersion\": \"${{ needs.extract-information.outputs.indyVersion }}\", \"plenumVersion\" : \"1.13.1~rc2\", \"ursaVersion\": \"0.3.2-1\", \"pyzmqVersion\" : \"22.3.0\"}"
libIndyVersion: "1.15.0~1625-bionic"
includePaymentTests: true
testAutomationBranch: "v0.9"

publish-package:
name: Sovrin Publish Packages
needs: [workflow-setup, extract-information, call-indy-test-automation]
if: needs.workflow-setup.outputs.publish == 'true'
uses: ./.github/workflows/reuseable_publish.yaml
with:
GITHUB_REPOSITORY_NAME: ${{ needs.release-infos.outputs.GITHUB_REPOSITORY_NAME }}
distribution: focal
UBUNTU_VERSION: ubuntu-2004
REPO_COMPONENT: 'dev'
secrets:
SOVRIN_ARTIFACTORY_REPO_CONFIG: ${{ secrets.SOVRIN_ARTIFACTORY_REPO_CONFIG }}
Loading