Skip to content

Commit

Permalink
Showing 3 changed files with 85 additions and 16 deletions.
57 changes: 55 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -320,10 +320,50 @@ jobs:
./build-scripts/ubuntu-1604/build-3rd-parties.sh ./cache/3rd-party-dependencies
mv ./build-scripts/ubuntu-1604/cache/* /tmp/third-party-dependencies
build-python-packages:
name: Build Python Packages
runs-on: ubuntu-20.04
needs: [workflow-setup, indy_node_tests, lint]
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: ${{ needs.workflow-setup.outputs.isDev }}
isRC: ${{ needs.workflow-setup.outputs.isRC }}

- name: Prepare package and set version
run: |
# ToDo - Update hard coded 'ubuntu-16-04' tag when integrating these flows with the ubuntu-20.04-upgrade branch.
./build-scripts/ubuntu-1604/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

publish_artifacts:
name: Publish Artifacts
runs-on: ubuntu-20.04
needs: [workflow-setup, build_release, build_3rd_party_dependencies]
needs: [workflow-setup, build_release, build_3rd_party_dependencies, build-python-packages]
if: needs.workflow-setup.outputs.publish == 'true'
env:
GITHUB_REF: ${{ needs.workflow-setup.outputs.GITHUB_REF }}
@@ -367,4 +407,17 @@ jobs:
with:
sourceDirectory: /home/runner/tmp/third-party-dependencies
distribution: xenial
component: ${{ env.GITHUB_REF }}
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
2 changes: 1 addition & 1 deletion build-scripts/ubuntu-1604/build-indy-node.sh
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ cp -r "${INPUT_PATH}/." "${TMP_DIR}"

# prepare the sources
cd "${TMP_DIR}/build-scripts/ubuntu-1604"
./prepare-package.sh "${TMP_DIR}" "${VERSION}"
./prepare-package.sh "${TMP_DIR}" indy_node "${VERSION}" debian-packages


sed -i "s/{package_name}/${PACKAGE_NAME}/" "prerm"
42 changes: 29 additions & 13 deletions build-scripts/ubuntu-1604/prepare-package.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
#!/bin/bash -xe

if [ "$1" = "--help" ] ; then
echo "Usage: $0 <path-to-repo-folder> <release-version-dotted>"
echo "Usage: $0 <path-to-repo-folder> <main-module-name> <release-version-dotted> <distro-packages>"
echo "<distro-packages> - Set to 'debian-packages' when preparing deb packages, and 'python-packages' when preparing PyPi packages."
exit 0
fi

repo="$1"
version_dotted="$2"
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_version.sh $version_dotted
cat indy_node/__version__.json
bash -ex $BUMP_SH_SCRIPT $version_dotted
cat $module_name/__version__.json

echo -e "\nGenerating manifest"
bash -ex ./generate_manifest.sh
cat indy_node/__manifest__.json

echo -e "\n\nPrepares indy-plenum debian package version"
sed -i -r "s~indy-plenum==([0-9\.]+[0-9])(\.)?([a-z]+)~indy-plenum==\1\~\3~" setup.py

echo -e "\nAdapt the dependencies for the Canonical archive"
sed -i "s~timeout-decorator~python3-timeout-decorator~" setup.py
sed -i "s~distro~python3-distro~" setup.py
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"

0 comments on commit 83dc3b5

Please sign in to comment.