diff --git a/.github/actions/publish-android/action.yml b/.github/actions/publish-android/action.yml new file mode 100644 index 0000000000..12000db1f5 --- /dev/null +++ b/.github/actions/publish-android/action.yml @@ -0,0 +1,33 @@ +name: 'Publish android image' + +inputs: + abis: + description: 'A space separated list of ABIs to create an artifact for' + default: 'armv7 arm64 x86 x86_64' + docker-img-name: + description: 'Name of the android image' + required: true + full-version-name: + description: 'Name of the resulting artifact' + required: true + +env: + DOCKER_BUILDKIT: 1 + +runs: + using: "composite" + steps: + - name: Build, run android wrapper tests, and publish artifacts + run: | + docker run --name publish-android-wrapper -v $PWD:/root/indy-sdk \ + -e ABIS="${{ inputs.abis }}" \ + -e FULL_VERSION_NAME="${{ inputs.full-version-name }}" \ + ${{ inputs.docker-img-name }} \ + bash -c '(cd $HOME/indy-sdk/libindy/ci/ && ./android.prepare.sh $ABIS && cd $HOME/indy-sdk/libindy && ./ga-android.build.sh $ABIS)' + docker_id=$(docker ps -a | grep android | grep Exited | tail -n 1 | cut -d ' ' -f 1) + docker_image_id=$(docker images | grep android | perl -pe 's/\s+/ /g' | cut -d ' ' -f 3) + mkdir -p /tmp/artifacts + docker cp ${docker_id}:/tmp/artifacts/libindy /tmp/artifacts + docker rm ${docker_id} > /dev/null + docker rmi ${docker_image_id} > /dev/null + shell: bash diff --git a/.github/actions/test-android/action.yml b/.github/actions/test-android/action.yml new file mode 100644 index 0000000000..7ce518ef9f --- /dev/null +++ b/.github/actions/test-android/action.yml @@ -0,0 +1,35 @@ +name: 'Publish android image' + +inputs: + abi: + description: 'ABI to run tests for' + default: 'armv7 arm64 x86 x86_64' + pool_ip: + description: 'IP the indy pool run on' + default: "127.0.0.1" + required: true + android-docker-img-name: + description: 'Name of the android image' + required: true + pool-docker-img-name: + description: 'Name of the pool image' + required: true + +env: + DOCKER_BUILDKIT: 1 + +runs: + using: "composite" + steps: + - name: Run wrapper tests + run: | + sudo rm -rf "/usr/local/share/boost" "$AGENT_TOOLSDIRECTORY" "/usr/local/lib/android" "/usr/share/dotnet" + # sleep 15 && docker rmi ${{ inputs.pool-docker-img-name }} {{ inputs.android-docker-img-name }} & + docker run --rm -d --name indypool --network host ${{ inputs.pool-docker-img-name }} + docker run --rm -i --name android --network host -v $PWD:/root/indy-sdk \ + -e ABI="${{ inputs.abi }}" \ + -e TEST_POOL_IP="${{ inputs.pool_ip }}" \ + ${{ inputs.android-docker-img-name }} \ + bash -c '(cd $HOME/indy-sdk/libindy/ci/ && ./android.prepare.sh $ABI && cd $HOME/indy-sdk/libindy && ./android.test.sh $ABI)' + + shell: bash diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000000..60dd723eca --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,18 @@ +# +# SPDX-License-Identifier: CC-BY-4.0 +# + +repository: + name: indy-sdk + description: indy-sdk + homepage: https://wiki.hyperledger.org/display/indy + default_branch: master + has_downloads: false + has_issues: true + has_projects: false + has_wiki: false + archived: false + private: false + allow_squash_merge: true + allow_merge_commit: false + allow_rebase_merge: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..fc76f9add1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,1119 @@ +name: indy-sdk-build + +on: + push: + branches: + - master + pull_request: + branches: + - "**" + +env: + RUST_VER: 1.45.2 + POOL_IP: "127.0.0.1" + DEVICE_ABIS: "arm arm64" + EMULATOR_ABIS: "x86 x86_64" + +jobs: + + #################################################### + # INITIALIZATION + #################################################### + + workflow-setup: + runs-on: ubuntu-latest + outputs: + CACHE_KEY_POOL: ${{ steps.mainstep.outputs.CACHE_KEY_POOL }} + CACHE_KEY_LIBINDY: ${{ steps.mainstep.outputs.CACHE_KEY_LIBINDY }} + CACHE_KEY_ANDROID: ${{ steps.mainstep.outputs.CACHE_KEY_ANDROID }} + CACHE_KEY_PYTHON: ${{ steps.mainstep.outputs.CACHE_KEY_PYTHON }} + CACHE_KEY_WRAPPER_BASE: ${{ steps.mainstep.outputs.CACHE_KEY_WRAPPER_BASE }} + DOCKER_IMG_NAME_POOL: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_POOL }} + DOCKER_IMG_NAME_LIBINDY: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_LIBINDY }} + DOCKER_IMG_NAME_ANDROID: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_ANDROID }} + DOCKER_IMG_NAME_PYTHON: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_PYTHON }} + DOCKER_IMG_NAME_WRAPPER_BASE: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_WRAPPER_BASE }} + PUBLISH_VERSION: ${{ steps.mainstep.outputs.PUBLISH_VERSION }} + RELEASE: ${{ steps.mainstep.outputs.RELEASE }} + PRERELEASE: ${{ steps.mainstep.outputs.PRERELEASE }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_VER }} + - name: Set outputs + id: mainstep + run: | + if [[ -z "$GITHUB_HEAD_REF" ]]; then # is set only if pipeline run is triggered as pull request + BRANCH_NAME="${GITHUB_REF#refs/heads/}" + echo "Setting BRANCH_NAME=$BRANCH_NAME because this pipeline is run as Push" + else + BRANCH_NAME=$GITHUB_HEAD_REF + echo "Setting BRANCH_NAME=$BRANCH_NAME because this pipeline is run as Pull Request" + fi + + BRANCH_NAME=`echo $BRANCH_NAME | sed "s/[^[:alnum:]-]//g" | tr '[:upper:]' '[:lower:]'` # lowercase, only alphanumeric and dash + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "PR Labels: ${{ toJson(github.event.pull_request.labels.*.name) }}" + + REPO_HEAD="${{ github.event.pull_request.head.repo.full_name }}" # source repository + REPO_BASE="${{ github.event.pull_request.head.base.full_name }}" # target repository + echo "This is pull request from $REPO_HEAD to $REPO_BASE" + + if [[ "$REPO_HEAD" == "${{ github.repository }}" ]]; then + echo "This CI run is PR from non-forked repository." + IS_FORK="false"; + else + echo "This is fork." + IS_FORK="true"; + fi; + else + echo "Not PR so this is not fork." + IS_FORK="false"; + fi; + + REPO_VERSION_MOST_RECENT=$(git describe --tags --always --abbrev=0) + REPO_VERSION_MOST_RECENT=${REPO_VERSION_MOST_RECENT:1} # The tags start as v1.2.3 + REPO_VERSION_DESIRED=$(cargo pkgid --manifest-path libindy/Cargo.toml | cut -d# -f2 | cut -d: -f2) + echo "Highest released version was: $REPO_VERSION_MOST_RECENT, desired version (specified in libindy/Cargo.toml) is $REPO_VERSION_DESIRED" + + RELEASE="false" + PRERELEASE="false" + + if [[ "$IS_FORK" == "false" ]]; then + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'pre-release') }}" == "true" ]]; then + PRERELEASE="true" + fi; + elif [[ "${{ github.event_name }}" == "push" ]]; then + if [[ "$BRANCH_NAME" == "master" && "$REPO_VERSION_DESIRED" != "$REPO_VERSION_MOST_RECENT" ]]; then + PUBLISH_VERSION="$REPO_VERSION_DESIRED" + RELEASE="true" + echo "This is push to master, and version was bumped from $REPO_VERSION_MOST_RECENT to $REPO_VERSION_DESIRED. Will publish a release of $REPO_VERSION_DESIRED." + fi; + fi; + + if [[ -z "$PUBLISH_VERSION" ]]; then + PUBLISH_VERSION="$REPO_VERSION_MOST_RECENT-post-${{ github.run_number }}" + fi; + + echo "CI will publish artifacts at version: $PUBLISH_VERSION" + else + echo "This PR is from fork, nothing will be published because the CI wouldn't be able to access repo secrets to perform publish." + PUBLISH_VERSION="" + fi; + + LIBINDY_SOURCE_HASH=${{ hashFiles('libindy') }} + LIBNULLPAY_SOURCE_HASH=${{ hashFiles('libnullpay') }} + POSTGRES_SOURCE_HASH=${{ hashFiles('experimental/plugins/postgres') }} + + JAVA_WRAPPER_HASH=${{ hashFiles('wrappers/java') }} + PYTHON_WRAPPER_HASH=${{ hashFiles('wrappers/python') }} + + POOL_DOCKERFILE_HASH=${{ hashFiles('ci/indy-pool.dockerfile') }}-${{ env.POOL_IP }} + ALPINE_DOCKERFILE_HASH=${{ hashFiles('libindy/ci/alpine.dockerfile') }} + WRAPPER_BASE_DOCKERFILE_HASH=${{ hashFiles('libindy/ci/wrappers/wrapper-base.dockerfile') }} + ANDROID_DOCKERFILE_HASH=${{ hashFiles('libindy/ci/wrappers/android.dockerfile') }} + PYTHON_DOCKERFILE_HASH=${{ hashFiles('libindy/ci/wrappers/python.dockerfile') }} + + LIBINDY_HASH=${LIBINDY_SOURCE_HASH:0:11}-${LIBNULLPAY_SOURCE_HASH:0:11}-${POSTGRES_SOURCE_HASH:0:11}-${ALPINE_DOCKERFILE_HASH:0:11} + ANDROID_HASH=${ANDROID_DOCKERFILE_HASH:0:31} + PYTHON_HASH=${PYTHON_DOCKERFILE_HASH:0:31} + WRAPPER_BASE_HASH=${WRAPPER_BASE_DOCKERFILE_HASH:0:31} + + echo "::set-output name=PUBLISH_VERSION::$PUBLISH_VERSION" + echo "::set-output name=RELEASE::$RELEASE" + echo "::set-output name=PRERELEASE::$PRERELEASE" + + echo "::set-output name=CACHE_KEY_POOL::$POOL_DOCKERFILE_HASH" + echo "::set-output name=CACHE_KEY_LIBINDY::$LIBINDY_HASH" + echo "::set-output name=CACHE_KEY_WRAPPER_BASE::$WRAPPER_BASE_HASH" + echo "::set-output name=CACHE_KEY_ANDROID::$ANDROID_HASH" + echo "::set-output name=CACHE_KEY_PYTHON::$PYTHON_HASH" + + echo "::set-output name=DOCKER_IMG_NAME_POOL::indypool:$POOL_DOCKERFILE_HASH" + echo "::set-output name=DOCKER_IMG_NAME_LIBINDY::libindy:$LIBINDY_HASH" + echo "::set-output name=DOCKER_IMG_NAME_WRAPPER_BASE::wrapper-base:$WRAPPER_BASE_HASH" + echo "::set-output name=DOCKER_IMG_NAME_ANDROID::android:$ANDROID_HASH" + echo "::set-output name=DOCKER_IMG_NAME_PYTHON::python:$PYTHON_HASH" + echo ${{ env.POOL_IP }} + + #################################################### + # IMAGE BUILDS + #################################################### + + build-image-indypool: + needs: workflow-setup + runs-on: ubuntu-latest + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} + DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Try load from cache. + id: cache-image-pool + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + + - name: Docker Login + uses: azure/docker-login@v1 + with: + login-server: docker.pkg.github.com + username: $GITHUB_ACTOR + password: ${{ secrets.GITHUB_TOKEN }} + + - name: If NOT found in cache, build and cache image. + if: steps.cache-image-pool.outputs.cache-hit != 'true' + run: | + docker build -t "$DOCKER_IMG_NAME_POOL" --build-arg=pool_ip=${{ env.POOL_IP }} -f ci/indy-pool.dockerfile ci + mkdir -p /tmp/imgcache + docker save "$DOCKER_IMG_NAME_POOL" > /tmp/imgcache/img_indypool.rar + - name: Load image from cache + run: | + docker load < /tmp/imgcache/img_indypool.rar + - name: Verify indypool image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } + + build-image-libindy: + needs: workflow-setup + runs-on: ubuntu-latest + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_LIBINDY: ${{ needs.workflow-setup.outputs.CACHE_KEY_LIBINDY }} + DOCKER_IMG_NAME_LIBINDY: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_LIBINDY }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Try load from cache. + id: cache-image-libindy + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_LIBINDY }} + - name: If NOT found in cache, build and cache image. + if: steps.cache-image-libindy.outputs.cache-hit != 'true' + run: | + docker build --build-arg "RUST_VER=${{ env.RUST_VER }}" \ + -f libindy/ci/alpine.dockerfile \ + -t "$DOCKER_IMG_NAME_LIBINDY" \ + . + mkdir -p /tmp/imgcache + docker save "$DOCKER_IMG_NAME_LIBINDY" > /tmp/imgcache/img_libindy.rar + - name: Load image from cache + run: | + docker load < /tmp/imgcache/img_libindy.rar + - name: Verify libindy image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_LIBINDY" || { echo "Image $DOCKER_IMG_NAME_LIBINDY was not found!" ; exit 1; } + + build-image-wrapper-base: + needs: workflow-setup + runs-on: ubuntu-latest + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.CACHE_KEY_WRAPPER_BASE }} + DOCKER_IMG_NAME_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WRAPPER_BASE }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Try load from cache. + id: cache-image-wrapper-base + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_WRAPPER_BASE }} + - name: If NOT found in cache, build and cache image. + if: steps.cache-image-wrapper-base.outputs.cache-hit != 'true' + run: | + docker build --build-arg "RUST_VER=${{ env.RUST_VER }}" \ + -f libindy/ci/wrappers/wrapper-base.dockerfile \ + -t "$DOCKER_IMG_NAME_WRAPPER_BASE" \ + . + mkdir -p /tmp/imgcache + docker save "$DOCKER_IMG_NAME_WRAPPER_BASE" > /tmp/imgcache/img_wrapper_base.rar + - name: Load image from cache + run: | + docker load < /tmp/imgcache/img_wrapper_base.rar + - name: Verify wrapper base image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WRAPPER_BASE" || { echo "Image $DOCKER_IMG_NAME_WRAPPER_BASE was not found!" ; exit 1; } + + build-image-android: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-wrapper-base + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_ANDROID: ${{ needs.workflow-setup.outputs.CACHE_KEY_ANDROID }} + DOCKER_IMG_NAME_ANDROID: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + CACHE_KEY_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.CACHE_KEY_WRAPPER_BASE }} + DOCKER_IMG_NAME_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WRAPPER_BASE }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load wrapper base image cache + id: load-cached-wrapper-base-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_WRAPPER_BASE }} + - name: If no cached image found + if: steps.load-cached-wrapper-base-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_WRAPPER_BASE"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_wrapper_base.rar + + - name: Try load from cache. + id: cache-image-android + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_ANDROID }} + - name: If NOT found in cache, build and cache image. + if: steps.cache-image-libindy.outputs.cache-hit != 'true' + run: | + docker build --build-arg "WRAPPER_BASE_IMAGE=${{ env.DOCKER_IMG_NAME_WRAPPER_BASE }}" \ + -f libindy/ci/wrappers/android.dockerfile \ + -t "$DOCKER_IMG_NAME_ANDROID" \ + libindy/ci + mkdir -p /tmp/imgcache + docker save "$DOCKER_IMG_NAME_ANDROID" > /tmp/imgcache/img_android.rar + - name: Load image from cache + run: | + docker load < /tmp/imgcache/img_android.rar + - name: Verify android image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } + + build-image-python: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-wrapper-base + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_PYTHON: ${{ needs.workflow-setup.outputs.CACHE_KEY_PYTHON }} + DOCKER_IMG_NAME_PYTHON: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_PYTHON }} + CACHE_KEY_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.CACHE_KEY_WRAPPER_BASE }} + DOCKER_IMG_NAME_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WRAPPER_BASE }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load wrapper base image cache + id: load-cached-wrapper-base-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_WRAPPER_BASE }} + - name: If no cached image found + if: steps.load-cached-wrapper-base-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_WRAPPER_BASE"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_wrapper_base.rar + - name: Verify base image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WRAPPER_BASE" || { echo "Image $DOCKER_IMG_NAME_WRAPPER_BASE was not found!" ; exit 1; } + - name: Try load from cache. + id: cache-image-python + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_PYTHON }} + - name: If NOT found in cache, build and cache image. + if: steps.cache-image-python.outputs.cache-hit != 'true' + run: | + docker build --build-arg "WRAPPER_BASE_IMAGE=${{ env.DOCKER_IMG_NAME_WRAPPER_BASE }}" \ + -f libindy/ci/wrappers/python.dockerfile \ + -t "$DOCKER_IMG_NAME_PYTHON" \ + libindy/ci + mkdir -p /tmp/imgcache + docker save "$DOCKER_IMG_NAME_PYTHON" > /tmp/imgcache/img_python.rar + - name: Load image from cache + run: | + docker load < /tmp/imgcache/img_python.rar + - name: Verify python image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_PYTHON" || { echo "Image $DOCKER_IMG_NAME_PYTHON was not found!" ; exit 1; } + + #################################################### + # INDYPOOL DOCKER IMAGE + #################################################### + + publish-pool-image: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-indypool + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + CACHE_KEY_POOL: ${{needs.workflow-setup.outputs.CACHE_KEY_POOL}} + DOCKER_IMG_NAME_POOL: ${{needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL}} + PUBLISH_VERSION: ${{needs.workflow-setup.outputs.PUBLISH_VERSION}} + steps: + - uses: actions/checkout@v2 + - name: Load indypool image cache + id: load-cached-pool-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + - name: If no cached image found + if: steps.load-cached-pool-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_indypool.rar + - name: Verify indypool image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } + - name: Docker Login + uses: azure/docker-login@v1 + with: + login-server: docker.pkg.github.com + username: $GITHUB_ACTOR + password: ${{ secrets.GITHUB_TOKEN }} + - name: Publish image + run: | + IFS=$':' read -a arr <<< $DOCKER_IMG_NAME_POOL + DOCKER_IMG_NAME_TAGLESS=${arr[0]} + GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'` + REMOTE_DOCKER_IMG_NAME_POOL="docker.pkg.github.com/${GITHUB_REPOSITORY_LOWERCASE}/${DOCKER_IMG_NAME_TAGLESS}:${PUBLISH_VERSION}" + echo "Releasing pool docker image version $PUBLISH_VERSION, tagged $REMOTE_DOCKER_IMG_NAME_POOL" + docker tag "$DOCKER_IMG_NAME_POOL" "$REMOTE_DOCKER_IMG_NAME_POOL" + docker push "$REMOTE_DOCKER_IMG_NAME_POOL" || true + + #################################################### + # LIBINDY DOCKER IMAGE + #################################################### + + test-libindy: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-libindy + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_LIBINDY: ${{ needs.workflow-setup.outputs.CACHE_KEY_LIBINDY }} + CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} + DOCKER_IMG_NAME_LIBINDY: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_LIBINDY }} + DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load indypool image + id: load-cached-pool-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + - name: If no cached image found + if: steps.load-cached-pool-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_indypool.rar + - name: Load libindy image cache + id: load-cached-libindy-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_LIBINDY }} + - name: If no cached image found + if: steps.load-cached-libindy-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_LIBINDY"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_libindy.rar + + - name: Run indy tests + run: | + docker run --rm -d --name indypool --network host $DOCKER_IMG_NAME_POOL + docker run --rm -i --name libindy --network host \ + -e TEST_POOL_IP=${{ env.POOL_IP }} \ + $DOCKER_IMG_NAME_LIBINDY \ + bash -c '(cd $HOME/indy-sdk/libindy && RUST_BACKTRACE=1 RUST_LOG=indy::=debug RUST_TEST_THREADS=1 cargo test --release)' + + publish-libindy-image: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-libindy + - test-libindy + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + CACHE_KEY_LIBINDY: ${{needs.workflow-setup.outputs.CACHE_KEY_LIBINDY}} + DOCKER_IMG_NAME_LIBINDY: ${{needs.workflow-setup.outputs.DOCKER_IMG_NAME_LIBINDY}} + PUBLISH_VERSION: ${{needs.workflow-setup.outputs.PUBLISH_VERSION}} + steps: + - uses: actions/checkout@v2 + - name: Load libindy image cache + id: load-cached-libindy-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_LIBINDY }} + - name: If no cached image found + if: steps.load-cached-libindy-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_LIBINDY"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_libindy.rar + - name: Verify libindy image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_LIBINDY" || { echo "Image $DOCKER_IMG_NAME_LIBINDY was not found!" ; exit 1; } + - name: Docker Login + uses: azure/docker-login@v1 + with: + login-server: docker.pkg.github.com + username: $GITHUB_ACTOR + password: ${{ secrets.GITHUB_TOKEN }} + - name: Publish image + run: | + IFS=$':' read -a arr <<< $DOCKER_IMG_NAME_LIBINDY + DOCKER_IMG_NAME_TAGLESS=${arr[0]} + GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'` + REMOTE_DOCKER_IMG_NAME_LIBINDY="docker.pkg.github.com/${GITHUB_REPOSITORY_LOWERCASE}/${DOCKER_IMG_NAME_TAGLESS}:${PUBLISH_VERSION}" + echo "Releasing libindy docker image version $PUBLISH_VERSION, tagged $REMOTE_DOCKER_IMG_NAME_LIBINDY" + docker tag "$DOCKER_IMG_NAME_LIBINDY" "$REMOTE_DOCKER_IMG_NAME_LIBINDY" + docker push "$REMOTE_DOCKER_IMG_NAME_LIBINDY" || true + + #################################################### + # RUST WRAPPER + #################################################### + + test-rust-wrapper: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-indypool + - build-image-wrapper-base + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.CACHE_KEY_WRAPPER_BASE }} + CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} + DOCKER_IMG_NAME_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WRAPPER_BASE }} + DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + steps: + - uses: actions/checkout@v2 + - name: Load indy-pool image + id: load-cached-pool-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + - name: If no cached image found + if: steps.load-cached-pool-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_indypool.rar + - name: Verify pool image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } + - name: Load libindy image cache + id: load-cached-wrapper-base-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_WRAPPER_BASE }} + - name: If no cached image found + if: steps.load-cached-wrapper-base-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_WRAPPER_BASE"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_wrapper_base.rar + - name: Verify wrapper base image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WRAPPER_BASE" || { echo "Image $DOCKER_IMG_NAME_WRAPPER_BASE was not found!" ; exit 1; } + - name: Run rust wrapper tests + run: | + sudo rm -rf "/usr/local/share/boost" "$AGENT_TOOLSDIRECTORY" + docker run --rm -d --name indypool --network host $DOCKER_IMG_NAME_POOL + docker run --rm -i -v $PWD:/root/indy-sdk --name libindy --network host \ + -e TEST_POOL_IP=${{ env.POOL_IP }} \ + $DOCKER_IMG_NAME_WRAPPER_BASE \ + bash -c '(cd $HOME/indy-sdk/wrappers/rust/indy-sys && cargo build --release && cd $HOME/indy-sdk/wrappers/rust && RUST_BACKTRACE=1 RUST_LOG=indy::=debug RUST_TEST_THREADS=1 cargo test --release)' + + publish-rust-wrapper: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-wrapper-base + - test-rust-wrapper + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.CACHE_KEY_WRAPPER_BASE }} + DOCKER_IMG_NAME_WRAPPER_BASE: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WRAPPER_BASE }} + PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + steps: + - uses: actions/checkout@v2 + - name: Load libindy image cache + id: load-cached-wrapper-base-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_WRAPPER_BASE }} + - name: If no cached image found + if: steps.load-cached-wrapper-base-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_WRAPPER_BASE"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_wrapper_base.rar + - name: Verify wrapper base image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WRAPPER_BASE" || { echo "Image $DOCKER_IMG_NAME_WRAPPER_BASE was not found!" ; exit 1; } + - name: Publish rust wrapper to crates.io + run: | + docker run --rm -i -v $PWD:/root/indy-sdk --name libindy $DOCKER_IMG_NAME_WRAPPER_BASE \ + bash -c '(cd $HOME/indy-sdk/wrappers/rust/indy-sys && \ + cargo login ${{ secrets.CRATESIO_TOKEN }} && \ + cargo bump ${{ env.PUBLISH_VERSION }} && \ + cargo package --allow-dirty && \ + cargo publish --allow-dirty && \ + cd .. && \ + sed -i -E "s/indy-sys = \{ path =\"indy-sys\", version = \"=([0-9,.]+)\" \}/indy-sys = \{ path =\"indy-sys\", version = \"=${{ env.PUBLISH_VERSION }}\" \}/g" Cargo.toml && \ + cargo bump ${{ env.PUBLISH_VERSION }} && \ + sleep 30 && \ + cargo update && \ + cargo package --allow-dirty && \ + cargo publish --allow-dirty)' + + #################################################### + # ANDROID WRAPPER + #################################################### + +# test-android-wrapper-arm64: +# runs-on: ubuntu-latest +# needs: +# - workflow-setup +# - build-image-indypool +# - build-image-wrapper-base +# - build-image-android +# env: +# DOCKER_BUILDKIT: 1 +# CACHE_KEY_ANDROID: ${{ needs.workflow-setup.outputs.CACHE_KEY_ANDROID }} +# CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} +# DOCKER_IMG_NAME_ANDROID: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} +# DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} +# DEVICE_ABI: "arm64" +# steps: +# - name: Git checkout +# uses: actions/checkout@v2 +# - name: Load android wrapper image +# id: load-android-image +# uses: actions/cache@v2 +# with: +# path: /tmp/imgcache +# key: ${{ env.CACHE_KEY_ANDROID }} +# - name: If no cached image found +# if: steps.load-android-image.outputs.cache-hit != 'true' +# run: echo "ERROR == Expected to find image from cache $CACHE_KEY_ANDROID"; exit -1 +# - name: Load image from cache +# run: docker load < /tmp/imgcache/img_android.rar +# - name: Verify android image was loaded +# run: | +# docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } +# # NOTE: This is done because currently, the android image is too large to be loaded along with indypool and the archives, +# # but can be loaded by itself and the archive +# - name: Remove archived android image +# run: rm /tmp/imgcache/img_android.rar +# - name: Load indypool image +# id: load-cached-pool-image +# uses: actions/cache@v2 +# with: +# path: /tmp/imgcache +# key: ${{ env.CACHE_KEY_POOL }} +# - name: If no cached image found +# if: steps.load-cached-pool-image.outputs.cache-hit != 'true' +# run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 +# - name: Load image from cache +# run: docker load < /tmp/imgcache/img_indypool.rar +# - name: Verify pool image was loaded +# run: | +# docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } +# - name: Remove archived indypool image +# run: rm /tmp/imgcache/img_indypool.rar +# - name: Run tests for ${{ env.DEVICE_ABI }} architecture +# uses: ./.github/actions/test-android +# with: +# abi: ${{ env.DEVICE_ABI }} +# android-docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} +# pool-docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + + test-android-wrapper-armv7: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-indypool + - build-image-wrapper-base + - build-image-android + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_ANDROID: ${{ needs.workflow-setup.outputs.CACHE_KEY_ANDROID }} + CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} + DOCKER_IMG_NAME_ANDROID: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + DEVICE_ABI: "arm" + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load android wrapper image + id: load-android-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_ANDROID }} + - name: If no cached image found + if: steps.load-android-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_ANDROID"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_android.rar + - name: Verify android image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } + - name: Remove archived android image + run: rm /tmp/imgcache/img_android.rar + - name: Load indypool image + id: load-cached-pool-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + - name: If no cached image found + if: steps.load-cached-pool-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_indypool.rar + - name: Verify pool image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } + - name: Remove archived indypool image + run: rm /tmp/imgcache/img_indypool.rar + - name: Run tests for ${{ env.DEVICE_ABI }} architecture + uses: ./.github/actions/test-android + with: + abi: ${{ env.DEVICE_ABI }} + pool_ip: ${{ env.POOL_IP }} + android-docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + pool-docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + + test-android-wrapper-emulator: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-indypool + - build-image-wrapper-base + - build-image-android + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_ANDROID: ${{ needs.workflow-setup.outputs.CACHE_KEY_ANDROID }} + CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} + DOCKER_IMG_NAME_ANDROID: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + DEVICE_ABI: "x86_64" + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load android wrapper image + id: load-android-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_ANDROID }} + - name: If no cached image found + if: steps.load-android-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_ANDROID"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_android.rar + - name: Verify android image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } + - name: Remove archived android image + run: rm /tmp/imgcache/img_android.rar + - name: Load indypool image + id: load-cached-pool-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + - name: If no cached image found + if: steps.load-cached-pool-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_indypool.rar + - name: Verify pool image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } + - name: Remove archived indypool image + run: rm /tmp/imgcache/img_indypool.rar + - name: Run tests for ${{ env.DEVICE_ABI }} architecture + uses: ./.github/actions/test-android + with: + abi: ${{ env.DEVICE_ABI }} + pool_ip: ${{ env.POOL_IP }} + android-docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + pool-docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + + publish-android-wrapper-device: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-wrapper-base + - test-android-wrapper-armv7 + # - test-android-wrapper-arm64 + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_ANDROID: ${{ needs.workflow-setup.outputs.CACHE_KEY_ANDROID }} + DOCKER_IMG_NAME_ANDROID: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + FULL_VERSION_NAME: libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-device + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load android wrapper image + id: load-android-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_ANDROID }} + - name: If no cached image found + if: steps.load-android-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_ANDROID"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_android.rar + - name: Verify android image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } + - name: Build and publish android artifacts + uses: ./.github/actions/publish-android + with: + abis: ${{ env.DEVICE_ABIS }} + docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + full-version-name: ${{ env.FULL_VERSION_NAME }} + - uses: actions/upload-artifact@v2 + with: + name: ${{ env.FULL_VERSION_NAME }} + path: /tmp/artifacts/libindy/${{ env.FULL_VERSION_NAME }}.zip + + publish-android-wrapper-emulator: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-wrapper-base + - build-image-android + - test-android-wrapper-emulator + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_ANDROID: ${{ needs.workflow-setup.outputs.CACHE_KEY_ANDROID }} + DOCKER_IMG_NAME_ANDROID: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + FULL_VERSION_NAME: libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-emulator + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load android wrapper image + id: load-android-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_ANDROID }} + - name: If no cached image found + if: steps.load-android-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_ANDROID"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_android.rar + - name: Verify android image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } + - name: Build and publish android artifacts + uses: ./.github/actions/publish-android + with: + abis: ${{ env.EMULATOR_ABIS }} + docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_ANDROID }} + full-version-name: ${{ env.FULL_VERSION_NAME }} + - uses: actions/upload-artifact@v2 + with: + name: ${{ env.FULL_VERSION_NAME }} + path: /tmp/artifacts/libindy/${{ env.FULL_VERSION_NAME }}.zip + + + #################################################### + # PYTHON WRAPPER + #################################################### + + test-python-wrapper: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-indypool + - build-image-python + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_PYTHON: ${{ needs.workflow-setup.outputs.CACHE_KEY_PYTHON }} + CACHE_KEY_POOL: ${{ needs.workflow-setup.outputs.CACHE_KEY_POOL }} + DOCKER_IMG_NAME_PYTHON: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_PYTHON }} + DOCKER_IMG_NAME_POOL: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_POOL }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load indy-pool image + id: load-cached-pool-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_POOL }} + - name: If no cached image found + if: steps.load-cached-pool-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_POOL"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_indypool.rar + - name: Verify pool image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_POOL" || { echo "Image $DOCKER_IMG_NAME_POOL was not found!" ; exit 1; } + - name: Load python wrapper image + id: load-python-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_PYTHON }} + - name: If no cached image found + if: steps.load-python-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_PYTHON"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_python.rar + - name: Verify android image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_ANDROID" || { echo "Image $DOCKER_IMG_NAME_ANDROID was not found!" ; exit 1; } + - name: Run wrapper tests + run: | + sudo rm -rf "/usr/local/share/boost" "$AGENT_TOOLSDIRECTORY" + docker run --rm -d --name indypool --network host $DOCKER_IMG_NAME_POOL + docker run --rm -i -v $PWD:/root/indy-sdk --name python-test --network host \ + -e TEST_POOL_IP="${{ env.POOL_IP }}" \ + $DOCKER_IMG_NAME_PYTHON \ + bash -c '(cd $HOME/indy-sdk/wrappers/python && \ + pip install --user -e .[test] && \ + RUST_LOG=indy=debug python3.6 -m pytest)' + + publish-python-wrapper: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-python + - test-python-wrapper + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + DOCKER_BUILDKIT: 1 + CACHE_KEY_PYTHON: ${{ needs.workflow-setup.outputs.CACHE_KEY_PYTHON }} + DOCKER_IMG_NAME_PYTHON: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_PYTHON }} + PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Load wrapper base image cache + id: load-cached-python-image + uses: actions/cache@v2 + with: + path: /tmp/imgcache + key: ${{ env.CACHE_KEY_PYTHON }} + - name: If no cached image found + if: steps.load-cached-python-image.outputs.cache-hit != 'true' + run: echo "ERROR == Expected to find image from cache $CACHE_KEY_PYTHON"; exit -1 + - name: Load image from cache + run: docker load < /tmp/imgcache/img_python.rar + - name: Verify python image was loaded + run: | + docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_PYTHON" || { echo "Image $DOCKER_IMG_NAME_PYTHON was not found!" ; exit 1; } + - name: Publish Python wrapper + run: | + docker run --rm -i -v $PWD:/root/indy-sdk --name libindy $DOCKER_IMG_NAME_PYTHON \ + bash -c '(cd $HOME/indy-sdk/wrappers/python && \ + PACKAGE_VERSION=${{ env.PUBLISH_VERSION }} python3.6 setup.py sdist && \ + python3.6 -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_PYTHON3_INDY }})' + + #################################################### + # IOS WRAPPER + #################################################### + + publish-ios-wrapper-universal: + runs-on: macos-10.15 + needs: + - workflow-setup + if: needs.workflow-setup.outputs.PUBLISH_VERSION != '' + env: + PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + RUST_VER: ${{ needs.workflow-setup.outputs.RUST_VER }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Build iOS wrapper + run: | + LIBINDY_POD_VERSION=${{ env.PUBLISH_VERSION }} RUST_VER=${{ env.RUST_VER }} ./ci/ga-ios-build.sh libindy aarch64-apple-ios x86_64-apple-ios + - uses: actions/upload-artifact@v2 + with: + name: libindy-ios-${{ env.PUBLISH_VERSION }}-universal + path: ./libindy/out_pod/libindy.tar.gz + + #################################################### + # RELEASE + #################################################### + + make-release: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-libindy + - test-libindy + - test-rust-wrapper + - test-android-wrapper-armv7 + - test-android-wrapper-emulator + - test-python-wrapper + - publish-libindy-image + - publish-rust-wrapper + - publish-android-wrapper-device + - publish-android-wrapper-emulator + if: ${{ needs.workflow-setup.outputs.RELEASE == 'true' || needs.workflow-setup.outputs.PRERELEASE == 'true' }} + outputs: + RELEASE_UPLOAD_URL: ${{ steps.create-release.outputs.upload_url }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + + - name: Generate changelog + uses: heinrichreimer/github-changelog-generator-action@v2.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + futureRelease: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + releaseBranch: master + pullRequests: true + unreleased: true + unreleasedOnly: true + issuesWoLabels: true + prWoLabels: true + stripGeneratorNotice: true + stripHeaders: false + maxIssues: 50 + excludeLabels: duplicate,question,invalid,wontfix,changelog-excluded + breakingLabels: backwards-incompatible,breaking + deprecatedLabels: deprecated + headerLabel: "# Changelog" + breakingLabel: '### Breaking changes' + enhancementLabel: '### Enhancements' + bugsLabel: '### Bug fixes' + deprecatedLabel: '### Deprecations' + removedLabel: '### Removals' + securityLabel: '### Security fixes' + issuesLabel: '### Other issues' + prLabel: '### Other pull requests' + addSections: '{"ci":{"prefix":"### CI changes","labels":["ci"]},"wrappers":{"prefix":"### Wrapper changes","labels":["wrappers"]}}' + excludeTagsRegex: '^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))+)?)$' + + - name: Create a new release + id: create-release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + release_name: Release ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} + body_path: ./CHANGELOG.md + draft: false + prerelease: ${{ needs.workflow-setup.outputs.PRERELEASE == 'true' }} + + release-android-device: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-libindy + - test-libindy + - test-rust-wrapper + # - test-android-wrapper-arm64 + - test-android-wrapper-armv7 + - test-android-wrapper-emulator + - test-python-wrapper + - publish-libindy-image + - publish-rust-wrapper + - publish-android-wrapper-device + - publish-android-wrapper-emulator + - make-release + steps: + - name: Fetch android device build from artifacts + uses: actions/download-artifact@v2 + with: + name: libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-device + - name: Upload release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.make-release.outputs.RELEASE_UPLOAD_URL }} + asset_path: ./libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-device.zip + asset_name: libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-device.zip + asset_content_type: application/zip + + release-android-emulator: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-libindy + - test-libindy + - test-rust-wrapper + # - test-android-wrapper-arm64 + - test-android-wrapper-armv7 + - test-android-wrapper-emulator + - test-python-wrapper + - publish-libindy-image + - publish-rust-wrapper + - publish-android-wrapper-device + - publish-android-wrapper-emulator + - make-release + steps: + - name: Fetch android device build from artifacts + uses: actions/download-artifact@v2 + with: + name: libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-emulator + - name: Upload release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.make-release.outputs.RELEASE_UPLOAD_URL }} + asset_path: ./libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-emulator.zip + asset_name: libindy-android-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-emulator.zip + asset_content_type: application/zip + + release-ios-universal: + runs-on: ubuntu-latest + needs: + - workflow-setup + - build-image-libindy + - test-libindy + - test-rust-wrapper + # - test-android-wrapper-arm64 + - test-android-wrapper-armv7 + - test-android-wrapper-emulator + - test-python-wrapper + - publish-libindy-image + - publish-rust-wrapper + - publish-android-wrapper-device + - publish-android-wrapper-emulator + - make-release + steps: + - name: Fetch iOS device build from artifacts + uses: actions/download-artifact@v2 + with: + name: libindy-ios-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-universal + - name: Upload release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.make-release.outputs.RELEASE_UPLOAD_URL }} + asset_path: ./libindy-ios-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-universal.zip + asset_name: libindy-ios-${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}-universal.zip # TODO: This may not be correct asset name + asset_content_type: application/zip diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 831cacd9d6..9ee1a51f90 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -19,7 +19,6 @@ Ubuntu18 = "Ubuntu 18.04" Centos = "Centos" libindyBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (Centos): false] -libvcxBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (Centos): false] ubuntuPakageTypes = [(Ubuntu16): "xenial", (Ubuntu18): "bionic"] gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github' @@ -115,7 +114,6 @@ def staticValidation() { parallel([ 'libindy' : { runValdiationRust('libindy') }, 'libnullpay': { runValdiationRust('libnullpay') }, - 'libvcx' : { runValdiationRust('vcx/libvcx') }, 'cli' : { runValdiationRust('cli') } ]) } @@ -125,12 +123,7 @@ def runValdiationRust(dir) { try { cleanWs() checkout scm - def testEnv - if (dir == 'vcx/libvcx') { - testEnv = dockerBuild("static-validation-libvcx", "vcx/ci/ubuntu.dockerfile .") - } else { - testEnv = dockerBuild("static-validation-libindy", "libindy/ci/ubuntu.dockerfile libindy/ci") - } + def testEnv = dockerBuild("static-validation-libindy", "libindy/ci/ubuntu.dockerfile libindy/ci") testEnv.inside { //FIXME waiting on IS-823 //sh "cargo clippy --manifest-path ${dir}/Cargo.toml" @@ -238,9 +231,6 @@ def linuxTesting(file, env_name, network_name) { def jobs = [ "${env_name}-cli-test": { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) - }, - "${env_name}-vcx-test": { - vcxTesting(file, env_name, network_name, full_testing) } ] if (full_testing) { @@ -262,38 +252,6 @@ def linuxTesting(file, env_name, network_name) { ]) } -def vcxTesting(file, env_name, network_name, full_testing) { - parallel([ - failFast : true, - "${env_name} Test: build and test libvcx" : { - node('ubuntu') { - cleanWs() - linuxVcxBuild(file, env_name, network_name) - } - }, - "${env_name} Test: test other vcx components": { - if (full_testing) { - waitUntil { - libvcxBuildFinished[env_name] - } - - def jobs = [ - "${env_name}-vcx-nodejs-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxNodejsTesting) - }, - "${env_name}-vcx-java-test" : { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxJavaTesting) - }, - "${env_name}-vcx-python-test": { - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxPythonTesting) - } - ] - parallel(jobs) - } - }, - ]) -} - def linuxLibindyBuild(file, env_name, network_name, full_testing) { def poolInst try { @@ -320,11 +278,6 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { sh "cp libindy/target/release/libindy.so wrappers/nodejs" sh "cp libindy/target/release/libindy.so cli" sh "cp libindy/target/release/libindy.so libnullpay" - sh "cp libindy/target/release/libindy.so vcx/libvcx" - sh "cp libindy/target/release/libindy.so vcx/wrappers/node" - sh "cp libindy/target/release/libindy.so vcx/wrappers/java" - sh "cp libindy/target/release/libindy.so vcx/wrappers/python3" - sh "cp libindy/target/release/libindy.so vcx/dummy-cloud-agent" testEnv.inside { echo "${env_name} Libnullpay Test: Build" @@ -338,10 +291,6 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { } sh "cp libnullpay/target/release/libnullpay.so cli" - sh "cp libnullpay/target/release/libnullpay.so vcx/libvcx" - sh "cp libnullpay/target/release/libnullpay.so vcx/wrappers/node" - sh "cp libnullpay/target/release/libnullpay.so vcx/wrappers/java" - sh "cp libnullpay/target/release/libnullpay.so vcx/wrappers/python3" stash includes: 'wrappers/java/lib/libindy.so', name: "LibindyJavaSO${env_name}" stash includes: 'wrappers/python/libindy.so', name: "LibindyPythonSO${env_name}" @@ -349,11 +298,6 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { stash includes: 'wrappers/nodejs/libindy.so', name: "LibindyNodejsSO${env_name}" stash includes: 'cli/libindy.so', name: "LibindyCliSO${env_name}" stash includes: 'cli/libnullpay.so', name: "LibnullpayCliSO${env_name}" - stash includes: 'vcx/libvcx/libindy.so,vcx/libvcx/libnullpay.so', name: "VCXLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/wrappers/node/libindy.so,vcx/wrappers/node/libnullpay.so', name: "VcxNodeLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/wrappers/java/libindy.so,vcx/wrappers/java/libnullpay.so', name: "VcxJavaLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/wrappers/python3/libindy.so,vcx/wrappers/python3/libnullpay.so', name: "VcxPythonLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/dummy-cloud-agent/libindy.so', name: "LibindyCloudAgentSO${env_name}" libindyBuildFinished[env_name] = true @@ -398,76 +342,6 @@ def testLibindyComponent(directory) { """ } -def linuxVcxBuild(file, env_name, network_name) { - def poolInst - try { - echo "${env_name} Test: Checkout csm" - checkout scm - - poolInst = openPool(env_name, network_name) - - def testEnv = buildTestEnv(file, env_name) - - unstash name: "VCXLibindyAndLibnullpaySO${env_name}" - - echo "${env_name} Libvcx Test: Build" - testEnv.inside { - sh ''' - cd vcx/libvcx - LIBRARY_PATH=./ cargo build --release --features fatal_warnings - ''' - - stash includes: 'vcx/libvcx/target/release/libvcx.so', name: "LibvcxBuildResult${env_name}" - - } - - sh "cp vcx/libvcx/target/release/libvcx.so vcx/wrappers/node" - sh "cp vcx/libvcx/target/release/libvcx.so vcx/wrappers/java" - sh "cp vcx/libvcx/target/release/libvcx.so vcx/wrappers/python3" - - stash includes: 'vcx/wrappers/node/libvcx.so', name: "VcxNodeLibvcxSO${env_name}" - stash includes: 'vcx/wrappers/java/libvcx.so', name: "VcxJavaLibvcxSO${env_name}" - stash includes: 'vcx/wrappers/python3/libvcx.so', name: "VcxPythonLibvcxSO${env_name}" - - libvcxBuildFinished[env_name] = true - - sh "cp vcx/libvcx/libindy.so vcx/dummy-cloud-agent" - - testEnv.inside("--network=${network_name}") { - sh ''' - cd vcx/dummy-cloud-agent - sed -i 's/\\("protocol_type": "\\)2.0/\\11.0/' config/sample-config.json - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo run config/sample-config.json & - ''' - - echo "${env_name} Libvcx Test: Run tests" - sh ''' - cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency" - ''' - } - - testEnv.inside("--network=${network_name}") { - sh ''' - cd vcx/dummy-cloud-agent - sed -i 's/\\("protocol_type": "\\)1.0/\\12.0/' config/sample-config.json - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo run config/sample-config.json & - ''' - - echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" - // TODO in Rust 1.39.0 there was a problem with test name before "--". Temporary put test name after it. - sh ''' - cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests agency_v2" -- tests::test_real_proof_for_protocol_type_v2 --exact - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "pool_tests aries" -- v3::test::aries_demo --exact - ''' - } - } - finally { - closePool(env_name, network_name, poolInst) - } -} - def linuxJavaTesting(env_name, network_name, testEnv) { unstash name: "LibindyJavaSO${env_name}" dir('wrappers/java') { @@ -539,50 +413,6 @@ def linuxNodejsTesting(env_name, network_name, testEnv) { } } -def linuxVcxNodejsTesting(env_name, network_name, testEnv) { - unstash name: "VcxNodeLibvcxSO${env_name}" - unstash name: "VcxNodeLibindyAndLibnullpaySO${env_name}" - - testEnv.inside("--network=${network_name}") { - echo "${env_name} Vcx Test: Test nodejs wrapper" - sh ''' - cd vcx/wrappers/node/ - npm i - npm run compile - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} LIBVCX_PATH=./ npm test - ''' - } -} - -def linuxVcxJavaTesting(env_name, network_name, testEnv) { - unstash name: "VcxJavaLibvcxSO${env_name}" - unstash name: "VcxJavaLibindyAndLibnullpaySO${env_name}" - - dir('vcx/wrappers/java') { - echo "${env_name} Vcx Test: Test java wrapper" - - testEnv.inside("--network=${network_name}") { - sh 'LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} ./gradlew --no-daemon test' - } - } -} - -def linuxVcxPythonTesting(env_name, network_name, testEnv) { - unstash name: "VcxPythonLibvcxSO${env_name}" - unstash name: "VcxPythonLibindyAndLibnullpaySO${env_name}" - - dir('vcx/wrappers/python3') { - testEnv.inside { - echo "${env_name} Vcx Test: Test python wrapper" - - sh ''' - python3 -m pip install --user pytest==3.6.4 pytest-asyncio==0.10.0 - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} python3 -m pytest -s - ''' - } - } -} - def windowsTesting() { node('win2016') { stage('Windows Test') { @@ -682,36 +512,6 @@ def windowsTesting() { stash includes: 'target/release/indy-cli.exe,target/release/*.dll', name: 'IndyCliWindowsBuildResult' } - - bat "PowerShell.exe \"Copy-Item $WORKSPACE/libnullpay/target/release/nullpay.dll -Destination $WORKSPACE/vcx/libvcx\"" - - dir('vcx/libvcx') { - echo "Windows Libvcx Test: Build" - - // FIXME remove that once https://jira.hyperledger.org/browse/IS-1127 is resolved - bat """ - PowerShell.exe "&{(Get-Content -Path src/settings.rs -Raw) -replace '/tmp/test_init.json','./test_init.json'} | Set-Content -Path src/settings.rs" - """ - - withEnv([ - "OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt", - "RUST_BACKTRACE=1" - ]) { - bat "cargo build --release --features fatal_warnings" - bat "cargo test --release --no-run" - - echo "Windows Libvcx Test: Run tests" - withEnv([ - "RUST_TEST_THREADS=1", - "RUST_LOG=vcx=debug,indy::=debug", - "PATH=$WORKSPACE\\libindy\\target\\release;$PATH", - ]) { - bat "cargo test --release" - } - } - - stash includes: 'target/release/*.dll,target/release/*.dll.lib', name: 'LibvcxWindowsBuildResult' - } } finally { try { bat "docker -H $INDY_SDK_SERVER_IP stop indy_pool" @@ -898,19 +698,12 @@ def macosTesting() { stash includes: 'libindy/target/release/libindy.dylib,libindy/target/release/libindy.a', name: 'LibindyMacosBuildResult' sh "cp libindy/target/release/libindy.dylib libnullpay" - sh "cp libindy/target/release/libindy.dylib vcx/libvcx" sh "cp libindy/target/release/libindy.dylib cli" macosModuleBuildingAndTest('libnullpay') stash includes: 'libnullpay/target/release/libnullpay.dylib,libnullpay/target/release/libnullpay.a', name: 'LibnullpayMacosBuildResult' - sh "cp libnullpay/target/release/libnullpay.dylib vcx/libvcx" - - macosModuleBuildingAndTest('vcx/libvcx') - - stash includes: 'vcx/libvcx/target/release/libvcx.dylib,vcx/libvcx/target/release/libvcx.a', name: 'LibvcxMacosBuildResult' - sh "sed -i'.original' -e 's/10.0.0.2/127.0.0.1/g' cli/docker_pool_transactions_genesis" macosModuleBuildingAndTest('cli') @@ -971,7 +764,6 @@ def centosPublishing() { libindyRpmPublishing(testEnv, libindyVersion, env_name) libnullpayRpmPublishing(testEnv, env_name) - libvcxRpmPublishing(testEnv, env_name) indyCliRpmPublishing(testEnv, env_name) } finally { @@ -996,13 +788,6 @@ def libnullpayRpmPublishing(testEnv, env_name) { rpmPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayBuildResult${env_name}") } -def libvcxRpmPublishing(testEnv, env_name) { - echo 'Publish Libvcx rpm files' - def libvcxVersion = getSrcVersion("vcx/libvcx") - - rpmPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibvcxBuildResult${env_name}") -} - def indyCliRpmPublishing(testEnv, env_name) { echo 'Publish Indy Cli rpm files' def indyCliVersion = getSrcVersion("cli") @@ -1049,7 +834,6 @@ def linuxPublishing(file, env_name, build_wrappers) { libindyDebPublishing(testEnv, libindyVersion, env_name) libindyDevDebPublishing(testEnv, libindyVersion, env_name) libnullpayDebPublishing(testEnv, env_name) - libvcxDebPublishing(testEnv, env_name) libindyCliDebPublishing(testEnv, libindyVersion, env_name) // Note that last deb publishing should pass resetCache = true inside if (build_wrappers) { @@ -1057,9 +841,6 @@ def linuxPublishing(file, env_name, build_wrappers) { nodejsWrapperPublishing(testEnv, false, 'libindy') javaWrapperPublishing(testEnv, false) rustWrapperPublishing(testEnv, false) - vcxJavaWrapperPublishing(testEnv, false) - pythonWrapperPublishing(testEnv, false, 'vcx/wrappers/python3', 'vcx/libvcx') - nodejsWrapperPublishing(testEnv, false, 'vcx') } } @@ -1136,11 +917,6 @@ def windowsPublishing() { echo 'Publish Libnullpay Windows files' def libnullpayVersion = getSrcVersion("libnullpay") windowsPublishArtifact(testEnv, "libnullpay", "libnullpay", "lib", libnullpayVersion, "LibnullpayWindowsBuildResult") - - echo 'Publish Libvcx Windows files' - def libvcxVersion = getSrcVersion("vcx/libvcx") - windowsPublishArtifact(testEnv, "vcx/libvcx", "libvcx", "lib", libvcxVersion, "LibvcxWindowsBuildResult") - } finally { echo 'Publish Windows files: Cleanup' @@ -1239,10 +1015,6 @@ def macOsPublishing() { def libnullpayVersion = getSrcVersion("libnullpay") publishMacOsArtifact(testEnv, "libnullpay", "libnullpay", "LibnullpayMacosBuildResult", libnullpayVersion, "lib") - echo 'Publish Libvcx MacOS Library' - def libvcxVersion = getSrcVersion("vcx/libvcx") - publishMacOsArtifact(testEnv, "libvcx", "vcx/libvcx", "LibvcxMacosBuildResult", libvcxVersion, "lib") - echo 'Publish Indy CLI MacOS Library' def cliVersion = getSrcVersion("cli") publishMacOsArtifact(testEnv, "indy-cli", "cli", "IndyCliMacosBuildResult", cliVersion, "executable") @@ -1319,16 +1091,6 @@ def libnullpayDebPublishing(testEnv, env_name) { debPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayBuildResult${env_name}", "libnullpayDebs${env_name}", env_name) } -def libvcxDebPublishing(testEnv, env_name) { - echo 'Publish Libvcx deb files to Apt' - - def libvcxVersion = getSrcVersion("vcx/libvcx") - - setLibindyDependencyVersion("vcx/libvcx/Cargo.toml") - - debPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibvcxBuildResult${env_name}", "libvcxDebs${env_name}", env_name) -} - def setLibindyDependencyVersion(file) { def libindyVersion = getSrcVersion("libindy") def replaceVersion = "$libindyVersion~$env.BUILD_NUMBER" @@ -1382,8 +1144,7 @@ def pythonWrapperPublishing(testEnv, isRelease, directory, base_library) { } def nodejsWrapperPublishing(testEnv, isRelease, library) { - def paths = ['libindy': ['dir': 'wrappers/nodejs', 'base_library': 'libindy'], - 'vcx' : ['dir': 'vcx/wrappers/node', 'base_library': 'vcx/libvcx']] + def paths = ['libindy': ['dir': 'wrappers/nodejs', 'base_library': 'libindy']] def version = getSrcVersion(paths[library]['base_library']) @@ -1392,10 +1153,6 @@ def nodejsWrapperPublishing(testEnv, isRelease, library) { def directory = paths[library]['dir'] testEnv.inside { - if (library == 'vcx') { // need addition step for VCX to create .js files - sh "cd $directory && npm i && npm run compile" - } - npmPublish(version, suffix, directory) } } @@ -1432,31 +1189,6 @@ def javaWrapperPublishing(testEnv, isRelease) { } } -def vcxJavaWrapperPublishing(testEnv, isRelease) { - dir('vcx/wrappers/java') { - echo "Publish To Maven Test: Build docker image" - def version = getSrcVersion("vcx/libvcx") - def suffix = getSuffix(isRelease, "Maven") - - testEnv.inside { - echo "Publish To Maven Test: Test" - withCredentials([file(credentialsId: 'maven-settings', variable: 'settingsFile')]) { - sh 'cp $settingsFile .' - - sh "ci/buildJar.sh ${version}${suffix}" - - sh "chmod +x ci/publishJar.sh" - - withEnv([ - "MAVEN_ADD_OPTIONS=$mavenDeployAddOptions", - ]) { - sh 'ci/publishJar.sh' - } - } - } - } -} - def publishingRCtoStable() { node('ubuntu') { cleanWs() @@ -1472,7 +1204,6 @@ def publishingRCtoStable() { def libindyVersion = getSrcVersion("libindy") def libnullpayVersion = getSrcVersion("libnullpay") - def libvcxVersion = getSrcVersion("vcx/libvcx") def env_name = Ubuntu16 @@ -1510,30 +1241,12 @@ def publishingRCtoStable() { echo "Moving ${env_name} RC artifacts to Stable: libnullpay" publishLibnullpayDebRCtoStable(testEnv, env_name) - echo 'Moving Windows RC artifacts to Stable: libvcx' - publishLibVCXWindowsFilesRCtoStable(libvcxVersion) - - echo "Moving ${env_name} RC artifacts to Stable: libvcx" - publishLibvcxDebRCtoStable(testEnv, env_name) // Note that last deb publishing should pass resetCache = true inside - - echo 'Moving Ubuntu RC artifacts to Stable: vcx java wrapper' - vcxJavaWrapperPublishing(testEnv, true) - - echo 'Moving Ubuntu RC artifacts to Stable: vcx python wrapper' - pythonWrapperPublishing(testEnv, true, 'vcx/wrappers/python3', 'vcx/libvcx') - - echo 'Moving Ubuntu RC artifacts to Stable: vcx nodejs wrapper' - nodejsWrapperPublishing(testEnv, true, 'vcx') - echo 'Moving Android RC artifacts to Stable: libindy' publishLibindAndroidFilesRCtoStable(libindyVersion) echo 'Moving Android RC artifacts to Stable: libnullpay' publishLibnullpayAndroidFilesRCtoStable() - echo 'Moving Android RC artifacts to Stable: libvcx' - publishLibvcxAndroidFilesRCtoStable() - echo 'Moving iOS RC artifacts to Stable: libindy' publishLibindyIOSFilesRCtoStable(libindyVersion) @@ -1546,9 +1259,6 @@ def publishingRCtoStable() { echo 'Moving MacOS RC artifacts to Stable: libnullpay' publishLibnullpayMacOSFilesRCtoStable(libnullpayVersion) - echo 'Moving MacOS RC artifacts to Stable: libvcx' - publishLibvcxMacOSFilesRCtoStable(libvcxVersion) - echo 'Moving MacOS RC artifacts to Stable: indy cli' publishIndyCliMacOSFilesRCtoStable(libindyVersion) @@ -1566,9 +1276,6 @@ def publishingRCtoStable() { echo "Moving ${env_name} RC artifacts to Stable: libnullpay" publishLibnullpayDebRCtoStable(ubuntu18Env, env_name) - echo "Moving ${env_name} RC artifacts to Stable: libvcx" - publishLibvcxDebRCtoStable(ubuntu18Env, env_name) - env_name = Centos echo "Moving ${env_name} RC artifacts to Stable: libindy" @@ -1577,9 +1284,6 @@ def publishingRCtoStable() { echo "Moving ${env_name} RC artifacts to Stable: libnullpay" publishLibnullpayCentosFilesRCtoStable(libnullpayVersion) - echo "Moving ${env_name} RC artifacts to Stable: libvcx" - publishLibvcxCentosFilesRCtoStable(libvcxVersion) - echo "Moving ${env_name} RC artifacts to Stable: indy-cli" publishIndyCliCentosFilesRCtoStable(libindyVersion) @@ -1599,10 +1303,6 @@ def publishLibnullpayCentosFilesRCtoStable(version) { publishCentosFilesRCtoStable("libnullpay", version) } -def publishLibvcxCentosFilesRCtoStable(version) { - publishCentosFilesRCtoStable("libvcx", version) -} - def publishIndyCliCentosFilesRCtoStable(version) { publishCentosFilesRCtoStable("indy-cli", version) } @@ -1623,10 +1323,6 @@ def publishLibnullpayWindowsFilesRCtoStable(libnullpayVersion) { publishWindowsFilesRCtoStable("libnullpay", libnullpayVersion) } -def publishLibVCXWindowsFilesRCtoStable(libvcxVersion) { - publishWindowsFilesRCtoStable("libvcx", libvcxVersion) -} - def publishLibindAndroidFilesRCtoStable(version) { publishAndroidFilesRCtoStable("libindy", version) } @@ -1636,11 +1332,6 @@ def publishLibnullpayAndroidFilesRCtoStable() { publishAndroidFilesRCtoStable("libnullpay", libnullpayVersion) } -def publishLibvcxAndroidFilesRCtoStable() { - def libvcxVersion = getSrcVersion("vcx/libvcx") - publishAndroidFilesRCtoStable("libvcx", libvcxVersion) -} - def publishAndroidFilesRCtoStable(packageName, version) { copyRcFilesToStable("android", packageName, version) } @@ -1688,10 +1379,6 @@ def publishLibnullpayMacOSFilesRCtoStable(version) { publishMacosFilesRCtoStable("libnullpay", version) } -def publishLibvcxMacOSFilesRCtoStable(version) { - publishMacosFilesRCtoStable("libvcx", version) -} - def publishIndyCliMacOSFilesRCtoStable(version) { publishMacosFilesRCtoStable("indy-cli", version) } @@ -1724,11 +1411,6 @@ def publishLibnullpayDebRCtoStable(testEnv, env_name) { publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", env_name) } -def publishLibvcxDebRCtoStable(testEnv, env_name) { - def libvcxVersion = getSrcVersion("vcx/libvcx") - publishDebRCtoStable(testEnv, "libvcx", "vcx/libvcx", libvcxVersion, "libvcxDebs", env_name, true) -} - def publishDebRCtoStable(testEnv, packageName, directory, version, stashName, env_name, resetCache = false) { testEnv.inside { sh "mkdir -p $directory/sovrin-packaging/" @@ -1790,7 +1472,6 @@ def androidPublishing() { libindyVersion = getSrcVersion("libindy") libnullpayVersion = getSrcVersion("libnullpay") - libvcxVersion = getSrcVersion("vcx/libvcx") echo 'Publish Android binaries: Building docker image' @@ -1798,7 +1479,6 @@ def androidPublishing() { publishAndroid(buildEnv, libindyVersion, 'libindy') publishAndroid(buildEnv, libnullpayVersion, 'libnullpay') - publishAndroid(buildEnv, libvcxVersion, 'libvcx') } finally { @@ -1846,16 +1526,6 @@ def androidBuildArtifact(buildEnv, arch, libVersion, artifact, libIndyVersion) { sh "cp libnullpay/${libnullpay_zip_name} ./" stash includes: "${libnullpay_zip_name}", name: "libnullpay_${arch}_zip" } - } else if (artifactName == "LIBVCX") { - buildEnv.inside { - unstash name: "libindy_${arch}_zip" - sh "cp libindy_android_${arch}_${libIndyVersion}.zip vcx/libvcx && unzip -o vcx/libvcx/libindy_android_${arch}_${libIndyVersion}.zip " - stash includes: "libindy_android_${arch}_${libIndyVersion}.zip", name: "libindy_${arch}_zip" - sh "cd vcx/libvcx && ${artifactName}_VERSION=${libVersion} LIBINDY_DIR=../../libindy_${arch}/lib INDY_DIR=../../libindy_${arch}/lib ./${ANDROID_SCRIPT_PATH} -d $arch" - def libvcx_zip_name = "libvcx_android_${arch}_${libVersion}.zip" - sh "cp vcx/libvcx/${libvcx_zip_name} ./" - stash includes: "${libvcx_zip_name}", name: "libvcx_${arch}_zip" - } } } @@ -1920,18 +1590,15 @@ def androidBuildAsTesting() { def libindyVersion = getSrcVersion("libindy") def libnullpayVersion = getSrcVersion("libnullpay") - def libvcxVersion = getSrcVersion("vcx/libvcx") echo 'Building android binaries: Building docker image' dockerBuild('libindy', 'libindy/ci/ubuntu.dockerfile libindy/ci') def buildEnv = dockerBuild('indy-sdk', 'libindy/ci/android.dockerfile libindy/ci') - def vcxBuildEnv = dockerBuild('indy-sdk', 'libindy/ci/android.dockerfile libindy/ci') sh 'chmod -R 777 libindy/' sh 'chmod -R 777 libindy/ci/' buildAndroid(buildEnv, libindyVersion, 'libindy') buildAndroid(buildEnv, libnullpayVersion, 'libnullpay') - buildAndroid(vcxBuildEnv, libvcxVersion, 'libvcx', libindyVersion) } finally { echo 'Building Android binaries: Cleanup' diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 807e57e8d2..b369642de4 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -6,7 +6,6 @@ Ubuntu18 = "Ubuntu 18.04" RedHat = "RedHat" libindyBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] -libvcxBuildFinished = [(Ubuntu16): false, (Ubuntu18): false, (RedHat): false] testing() @@ -30,7 +29,6 @@ def staticValidation() { parallel([ 'libindy' : { runValdiationRust('libindy') }, 'libnullpay': { runValdiationRust('libnullpay') }, - 'libvcx' : { runValdiationRust('vcx/libvcx') }, 'cli' : { runValdiationRust('cli') } ]) } @@ -40,12 +38,7 @@ def runValdiationRust(dir) { try { cleanWs() checkout scm - def testEnv - if (dir == 'vcx/libvcx') { - testEnv = dockerBuild("static-validation-libvcx", "vcx/ci/ubuntu.dockerfile .") - } else { - testEnv = dockerBuild("static-validation-libindy", "libindy/ci/ubuntu.dockerfile libindy/ci") - } + def testEnv = dockerBuild("static-validation-libindy", "libindy/ci/ubuntu.dockerfile libindy/ci") testEnv.inside { //FIXME waiting on IS-823 //sh "cargo clippy --manifest-path ${dir}/Cargo.toml" @@ -157,29 +150,6 @@ def windowsTesting() { } } - bat "PowerShell.exe \"Copy-Item $WORKSPACE/libnullpay/target/debug/nullpay.dll -Destination $WORKSPACE/vcx/libvcx\"" - - dir('vcx/libvcx') { - echo "Windows Libvcx Test: Build" - - withEnv([ - "OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt", - "RUST_BACKTRACE=1" - ]) { - bat "cargo build --features fatal_warnings" - bat "cargo test --no-run" - - echo "Windows Libvcx Test: Run tests" - withEnv([ - "RUST_TEST_THREADS=1", - "RUST_LOG=vcx=debug,indy::=debug", - "PATH=$WORKSPACE\\libindy\\target\\debug;$PATH", - ]) { - bat "cargo test" - } - } - } - //TODO wrappers testing } finally { @@ -223,15 +193,10 @@ def macosTesting() { macosModuleBuildingAndTest('libindy', "--features only_high_cases") sh "cp libindy/target/debug/libindy.dylib libnullpay" - sh "cp libindy/target/debug/libindy.dylib vcx/libvcx" sh "cp libindy/target/debug/libindy.dylib cli" macosModuleBuildingAndTest('libnullpay') - sh "cp libnullpay/target/debug/libnullpay.dylib vcx/libvcx" - - macosModuleBuildingAndTest('vcx/libvcx') - sh "sed -i'.original' -e 's/10.0.0.2/127.0.0.1/g' cli/docker_pool_transactions_genesis" macosModuleBuildingAndTest('cli') @@ -391,44 +356,18 @@ def linuxTesting(file, env_name, network_name, full_testing) { def jobs = [ "${env_name}-cli-test": { linuxModuleTesting(file, env_name, network_name, this.&linuxCLITesting) - }, - "${env_name}-vcx-test": { - vcxTesting(file, env_name, network_name, full_testing) } ] if (full_testing) { jobs["${env_name}wrappers-test"] = { linuxModuleTesting(file, env_name, network_name, this.&linuxIndyWrappersTesting) } - jobs["${env_name}-cloud-agent-test"] = { - linuxModuleTesting(file, env_name, network_name, this.&linuxCloudAgentTesting) - } } parallel(jobs) }, ]) } -def vcxTesting(file, env_name, network_name, full_testing) { - parallel([ - failFast : true, - "${env_name} Test: build and test libvcx" : { - node('ubuntu') { - cleanWs() - linuxVcxBuild(file, env_name, network_name) - } - }, - "${env_name} Test: test other vcx components": { - if (full_testing) { - waitUntil { - libvcxBuildFinished[env_name] - } - linuxModuleTesting(file, env_name, network_name, this.&linuxVcxWrappersTesting) - } - }, - ]) -} - def linuxLibindyBuild(file, env_name, network_name, full_testing) { def poolInst try { @@ -453,11 +392,6 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { sh "cp libindy/target/debug/libindy.so wrappers/rust" sh "cp libindy/target/debug/libindy.so cli" sh "cp libindy/target/debug/libindy.so libnullpay" - sh "cp libindy/target/debug/libindy.so vcx/libvcx" - sh "cp libindy/target/debug/libindy.so vcx/wrappers/node" - sh "cp libindy/target/debug/libindy.so vcx/wrappers/java" - sh "cp libindy/target/debug/libindy.so vcx/wrappers/python3" - sh "cp libindy/target/debug/libindy.so vcx/dummy-cloud-agent" testEnv.inside { echo "${env_name} Libnullpay Test: Build" @@ -468,10 +402,6 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { } sh "cp libnullpay/target/debug/libnullpay.so cli" - sh "cp libnullpay/target/debug/libnullpay.so vcx/libvcx" - sh "cp libnullpay/target/debug/libnullpay.so vcx/wrappers/node" - sh "cp libnullpay/target/debug/libnullpay.so vcx/wrappers/java" - sh "cp libnullpay/target/debug/libnullpay.so vcx/wrappers/python3" stash includes: 'wrappers/java/lib/libindy.so', name: "LibindyJavaSO${env_name}" stash includes: 'wrappers/python/libindy.so', name: "LibindyPythonSO${env_name}" @@ -479,11 +409,6 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) { stash includes: 'wrappers/rust/libindy.so', name: "LibindyRustSO${env_name}" stash includes: 'cli/libindy.so', name: "LibindyCliSO${env_name}" stash includes: 'cli/libnullpay.so', name: "LibnullpayCliSO${env_name}" - stash includes: 'vcx/libvcx/libindy.so,vcx/libvcx/libnullpay.so', name: "VCXLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/wrappers/node/libindy.so,vcx/wrappers/node/libnullpay.so', name: "VcxNodeLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/wrappers/java/libindy.so,vcx/wrappers/java/libnullpay.so', name: "VcxJavaLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/wrappers/python3/libindy.so,vcx/wrappers/python3/libnullpay.so', name: "VcxPythonLibindyAndLibnullpaySO${env_name}" - stash includes: 'vcx/dummy-cloud-agent/libindy.so', name: "LibindyCloudAgentSO${env_name}" libindyBuildFinished[env_name] = true @@ -528,74 +453,6 @@ def testLibindyComponent(directory) { """ } -def linuxVcxBuild(file, env_name, network_name) { - def poolInst - try { - echo "${env_name} Test: Checkout csm" - checkout scm - - poolInst = openPool(env_name, network_name) - - def testEnv = buildTestEnv(file, env_name) - - unstash name: "VCXLibindyAndLibnullpaySO${env_name}" - - echo "${env_name} Libvcx Test: Build" - testEnv.inside { - sh ''' - cd vcx/libvcx - LIBRARY_PATH=./ cargo build --features fatal_warnings - ''' - } - - sh "cp vcx/libvcx/target/debug/libvcx.so vcx/wrappers/node" - sh "cp vcx/libvcx/target/debug/libvcx.so vcx/wrappers/java" - sh "cp vcx/libvcx/target/debug/libvcx.so vcx/wrappers/python3" - - stash includes: 'vcx/wrappers/node/libvcx.so', name: "VcxNodeLibvcxSO${env_name}" - stash includes: 'vcx/wrappers/java/libvcx.so', name: "VcxJavaLibvcxSO${env_name}" - stash includes: 'vcx/wrappers/python3/libvcx.so', name: "VcxPythonLibvcxSO${env_name}" - - libvcxBuildFinished[env_name] = true - - sh "cp vcx/libvcx/libindy.so vcx/dummy-cloud-agent" - - testEnv.inside("--network=${network_name}") { - sh ''' - cd vcx/dummy-cloud-agent - sed -i 's/\\("protocol_type": "\\)2.0/\\11.0/' config/sample-config.json - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo build - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo run config/sample-config.json & - ''' - - echo "${env_name} Libvcx Test: Run tests" - sh ''' - cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency" - ''' - } - - testEnv.inside("--network=${network_name}") { - sh ''' - cd vcx/dummy-cloud-agent - sed -i 's/\\("protocol_type": "\\)1.0/\\12.0/' config/sample-config.json - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo run config/sample-config.json & - ''' - - echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" - // TODO in Rust 1.39.0 there was a problem with test name before "--". Temporary put test name after it. - sh ''' - cd vcx/libvcx - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests agency_v2" -- tests::test_real_proof_for_protocol_type_v2 --exact - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=vcx=debug,indy=debug RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "pool_tests aries" -- v3::test::aries_demo --exact - ''' - } - } - finally { - closePool(env_name, network_name, poolInst) - } -} - def linuxModuleTesting(file, env_name, network_name, module_tester) { linuxModuleTesting(file, env_name, network_name, module_tester, "ubuntu") } @@ -626,7 +483,7 @@ def linuxAndroidOnEmulatorTesting(env_name, network_name, testEnv) { def emu_arch = "x86" testEnv.inside("--network=${network_name}") { - for (directory in ["libindy", "libnullpay", "vcx/libvcx"]) { + for (directory in ["libindy", "libnullpay"]) { echo "${env_name} ${directory} Test: Test on ${emu_arch} emulator" sh "cd ${directory} && ./android.test.sh ${emu_arch}" } @@ -640,12 +497,6 @@ def linuxIndyWrappersTesting(env_name, network_name, testEnv) { linuxRustTesting(env_name, network_name, testEnv) } -def linuxVcxWrappersTesting(env_name, network_name, testEnv) { - linuxVcxNodejsTesting(env_name, network_name, testEnv) - linuxVcxJavaTesting(env_name, network_name, testEnv) - linuxVcxPythonTesting(env_name, network_name, testEnv) -} - def linuxJavaTesting(env_name, network_name, testEnv) { unstash name: "LibindyJavaSO${env_name}" dir('wrappers/java') { @@ -685,50 +536,6 @@ def linuxNodejsTesting(env_name, network_name, testEnv) { } } -def linuxVcxNodejsTesting(env_name, network_name, testEnv) { - unstash name: "VcxNodeLibvcxSO${env_name}" - unstash name: "VcxNodeLibindyAndLibnullpaySO${env_name}" - - testEnv.inside("--network=${network_name}") { - echo "${env_name} Vcx Test: Test nodejs wrapper" - sh ''' - cd vcx/wrappers/node/ - npm i - npm run compile - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} LIBVCX_PATH=./ npm test - ''' - } -} - -def linuxVcxJavaTesting(env_name, network_name, testEnv) { - unstash name: "VcxJavaLibvcxSO${env_name}" - unstash name: "VcxJavaLibindyAndLibnullpaySO${env_name}" - - dir('vcx/wrappers/java') { - echo "${env_name} Vcx Test: Test java wrapper" - - testEnv.inside("--network=${network_name}") { - sh 'LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} ./gradlew --no-daemon test' - } - } -} - -def linuxVcxPythonTesting(env_name, network_name, testEnv) { - unstash name: "VcxPythonLibvcxSO${env_name}" - unstash name: "VcxPythonLibindyAndLibnullpaySO${env_name}" - - dir('vcx/wrappers/python3') { - testEnv.inside("--network=${network_name}") { - echo "${env_name} Vcx Test: Test python wrapper" - - sh ''' - python3 -m pip install --user pytest==3.6.4 pytest-asyncio==0.10.0 - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} python3 -m pytest -s - ''' - } - } -} - def linuxCLITesting(env_name, network_name, testEnv) { unstash name: "LibindyCliSO${env_name}" unstash name: "LibnullpayCliSO${env_name}" @@ -758,19 +565,6 @@ def linuxRustTesting(env_name, network_name, testEnv) { } } -def linuxCloudAgentTesting(env_name, network_name, testEnv) { - unstash name: "LibindyCloudAgentSO${env_name}" - - echo "${env_name} Cloud Agent Test: tests" - testEnv.inside { - sh ''' - cd vcx/dummy-cloud-agent - LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --no-run - LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug RUST_TEST_THREADS=1 cargo test - ''' - } -} - def getBuildPoolVerOptions(pool_type, plenum_ver, anoncreds_ver, node_ver) { if (pool_type != null && plenum_ver != null && anoncreds_ver != null && node_ver != null) { return "--build-arg=indy_stream=${pool_type} --build-arg indy_plenum_ver=${plenum_ver} --build-arg indy_anoncreds_ver=${anoncreds_ver} --build-arg indy_node_ver=${node_ver}" diff --git a/ci/acceptance/ubuntu_acceptance.dockerfile b/ci/acceptance/ubuntu_acceptance.dockerfile index e613b1de07..c606208e5f 100755 --- a/ci/acceptance/ubuntu_acceptance.dockerfile +++ b/ci/acceptance/ubuntu_acceptance.dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && \ python3-pip \ vim +RUN pip3 install --upgrade pip RUN pip3 install -U pip ARG indy_sdk_deb diff --git a/ci/ga-ios-build.sh b/ci/ga-ios-build.sh new file mode 100755 index 0000000000..b697a59723 --- /dev/null +++ b/ci/ga-ios-build.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +set -e +set -x + +if [ "$1" = "--help" ] ; then + echo "Usage: " + return +fi + +package="$1" + +[ -z ${package} ] && exit 1 + +if [ -z "${LIBINDY_POD_VERSION}" ]; then + echo "ERROR: LIBINDY_POD_VERSION environment variable must be specified" +fi + +if [ -z "${RUST_VER}" ]; then + export RUST_VER=1.45.2 + echo "ERROR: RUST_VER environment variable not specified, using $RUST_VER" +fi + +if [ -z "${OPENSSL_DIR}" ]; then + export OPENSSL_DIR=$(brew --prefix openssl) + echo "OPENSSL_DIR not specified, using $OPENSSL_DIR" +fi + +export PKG_CONFIG_ALLOW_CROSS=1 +export CARGO_INCREMENTAL=1 +export POD_FILE_NAME=${package}.tar.gz + +rustup default ${RUST_VER} +rustup target add aarch64-apple-ios x86_64-apple-ios +cargo install cargo-lipo + +brew list libsodium &>/dev/null || brew install libsodium +brew list zeromq &>/dev/null || brew install zeromq +brew list openssl &>/dev/null || brew install openssl + +echo "Build IOS POD started..." + +TYPE="debug" + +cd ${package} + +if [[ $# -eq 2 ]]; then # build for single platform + echo "... for target $2 ..." + cargo lipo --targets $2 +elif [[ $# -eq 3 ]]; then # build for two platforms + echo "... for targets $2,$3 ..." + TYPE="release" + cargo lipo --$TYPE --targets $2,$3 +else # build for all platforms + echo "... for all default targets ..." + TYPE="release" + cargo lipo --$TYPE +fi +echo 'Build completed successfully.' + +WORK_DIR="out_pod" +echo "Try to create out directory: $WORK_DIR" +mkdir $WORK_DIR + +if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then + echo "Could not create temp dir $WORK_DIR" + exit 1 +fi + +echo "Packing..." + +PACKAGE="${package}.a" + +cp include/*.h $WORK_DIR +cp ../LICENSE $WORK_DIR +cp target/universal/$TYPE/$PACKAGE $WORK_DIR +cd $WORK_DIR +tar -cvzf $POD_FILE_NAME * +cd - +ls -l $WORK_DIR/$POD_FILE_NAME + +echo "Packing completed." + +echo "Out directory: $WORK_DIR" diff --git a/docs/getting-started/getting-started.dockerfile b/docs/getting-started/getting-started.dockerfile index 4db8e9f1a5..37af0d6a8e 100644 --- a/docs/getting-started/getting-started.dockerfile +++ b/docs/getting-started/getting-started.dockerfile @@ -14,6 +14,7 @@ RUN apt-get update -y && apt-get install -y \ WORKDIR /home/indy +RUN pip3 install --upgrade pip RUN pip3 install -U \ pip \ ipython-notebook \ diff --git a/experimental/plugins/postgres_storage/src/postgres_storage.rs b/experimental/plugins/postgres_storage/src/postgres_storage.rs index 14e9b18ff4..c451affb1d 100644 --- a/experimental/plugins/postgres_storage/src/postgres_storage.rs +++ b/experimental/plugins/postgres_storage/src/postgres_storage.rs @@ -1045,7 +1045,8 @@ impl PostgresStorageType { } url_base.push_str("@"); url_base.push_str(&config.url[..]); - url_base.push_str("/postgres"); + url_base.push_str("/"); + url_base.push_str(_POSTGRES_DB); url_base } diff --git a/libindy/Cargo.lock b/libindy/Cargo.lock index 8a6b9ee0c6..8f2a3aafee 100644 --- a/libindy/Cargo.lock +++ b/libindy/Cargo.lock @@ -901,7 +901,7 @@ dependencies = [ "serde_derive", "serde_json", "sodiumoxide", - "zeroize 0.9.3", + "zeroize 1.2.0", ] [[package]] @@ -2221,4 +2221,4 @@ checksum = "d33a2c51dde24d5b451a2ed4b488266df221a5eaee2ee519933dc46b9a9b3648" dependencies = [ "libc", "metadeps", -] \ No newline at end of file +] diff --git a/libindy/android.test.sh b/libindy/android.test.sh index f8b9796be8..368d42dade 100755 --- a/libindy/android.test.sh +++ b/libindy/android.test.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash - - +set -x WORKDIR=${PWD} LIBINDY_WORKDIR=${WORKDIR} @@ -16,6 +15,11 @@ if [ -z "${TARGET_ARCH}" ]; then exit 1 fi +if [ -z "${TEST_POOL_IP}" ]; then + echo "Missing TEST_POOL_IP value, setting default value of 10.0.0.2" + export TEST_POOL_IP="10.0.0.2" +fi + set -e source ${CI_DIR}/setup.android.env.sh @@ -89,14 +93,12 @@ execute_on_device(){ adb -e shell "chmod 755 /data/local/tmp/$EXE_NAME" OUT="$(mktemp)" MARK="ADB_SUCCESS!" - time adb -e shell "TEST_POOL_IP=10.0.0.2 LD_LIBRARY_PATH=/data/local/tmp RUST_TEST_THREADS=1 RUST_BACKTRACE=1 RUST_LOG=debug /data/local/tmp/$EXE_NAME && echo $MARK" 2>&1 | tee $OUT + time adb -e shell "TEST_POOL_IP=$TEST_POOL_IP LD_LIBRARY_PATH=/data/local/tmp RUST_TEST_THREADS=1 RUST_BACKTRACE=1 RUST_LOG=debug /data/local/tmp/$EXE_NAME && echo $MARK" 2>&1 | tee $OUT grep $MARK $OUT done } - - recreate_avd setup_dependencies_env_vars ${ABSOLUTE_ARCH} set_env_vars diff --git a/libindy/ci/alpine.dockerfile b/libindy/ci/alpine.dockerfile new file mode 100755 index 0000000000..b42c78b36e --- /dev/null +++ b/libindy/ci/alpine.dockerfile @@ -0,0 +1,43 @@ +FROM alpine:3.12 + +ARG UID=1000 +ARG GID=1000 +ARG RUST_VER="1.45.2" +ARG INDYSDK_PATH=/home/indy/indy-sdk + +ENV RUST_LOG=warning + +RUN addgroup -g $GID indy && adduser -u $UID -D -G indy indy + +RUN apk update && apk upgrade && \ + apk add --no-cache \ + build-base \ + cargo \ + git \ + libsodium-dev \ + libzmq \ + openssl-dev \ + zeromq-dev \ + bash + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_VER + +USER indy +WORKDIR /home/indy/ + +COPY --chown=indy . ./indy-sdk + +RUN cargo build --release --manifest-path=$INDYSDK_PATH/libindy/Cargo.toml + +USER root +RUN mv $INDYSDK_PATH/libindy/target/release/libindy.so /usr/lib + +USER indy +RUN cargo build --release --manifest-path=$INDYSDK_PATH/libnullpay/Cargo.toml +RUN cargo build --release --manifest-path=$INDYSDK_PATH/experimental/plugins/postgres_storage/Cargo.toml + +USER root +RUN mv $INDYSDK_PATH/libnullpay/target/release/libnullpay.so . +RUN mv $INDYSDK_PATH/experimental/plugins/postgres_storage/target/release/libindystrgpostgres.so . + +USER indy diff --git a/libindy/ci/android.prepare.sh b/libindy/ci/android.prepare.sh old mode 100644 new mode 100755 index 52f73e1f85..33be97a7de --- a/libindy/ci/android.prepare.sh +++ b/libindy/ci/android.prepare.sh @@ -16,4 +16,4 @@ download_emulator for arch in "${archs[@]}" do prepare_dependencies "${arch}" -done \ No newline at end of file +done diff --git a/libindy/ci/setup.android.env.sh b/libindy/ci/setup.android.env.sh index 94795d1d89..ae000cb159 100644 --- a/libindy/ci/setup.android.env.sh +++ b/libindy/ci/setup.android.env.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -x if [ -z "${ANDROID_BUILD_FOLDER}" ]; then @@ -49,7 +50,7 @@ delete_existing_avd(){ } download_emulator() { - curl -o emu.zip https://dl.google.com/android/repository/emulator-linux-5889189.zip + curl -o $HOME/emu.zip https://dl.google.com/android/repository/emulator-linux-5889189.zip } create_avd(){ @@ -67,9 +68,10 @@ create_avd(){ "system-images;android-24;default;${ABI}" # TODO hack to downgrade Android Emulator. Should be removed as soon as headless mode will be fixed. - mv /home/indy/emu.zip emu.zip + mv $HOME/emu.zip emu.zip mv emulator emulator_backup unzip emu.zip + rm emu.zip else echo "Skipping sdkmanager activity" fi diff --git a/libindy/ci/ubuntu18.dockerfile b/libindy/ci/ubuntu18.dockerfile index 14c384dbfa..fe12996430 100644 --- a/libindy/ci/ubuntu18.dockerfile +++ b/libindy/ci/ubuntu18.dockerfile @@ -16,6 +16,8 @@ RUN apt-get update && \ libzmq3-dev \ libsodium-dev +RUN pip3 install --upgrade pip + RUN pip3 install -U \ pip \ twine \ diff --git a/libindy/ci/wrappers/android.dockerfile b/libindy/ci/wrappers/android.dockerfile new file mode 100644 index 0000000000..48c21d5fbb --- /dev/null +++ b/libindy/ci/wrappers/android.dockerfile @@ -0,0 +1,13 @@ +ARG WRAPPER_BASE_IMAGE +FROM ${WRAPPER_BASE_IMAGE} + +RUN apt-get update && apt-get install openjdk-8-jdk maven python3-distutils python3 jq zip -y +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 + +ENV ANDROID_BUILD_FOLDER=/tmp/android_build +ENV ANDROID_SDK=${ANDROID_BUILD_FOLDER}/sdk +ENV ANDROID_SDK_ROOT=${ANDROID_SDK} +ENV ANDROID_HOME=${ANDROID_SDK} +ENV TOOLCHAIN_PREFIX=${ANDROID_BUILD_FOLDER}/toolchains/linux +ENV ANDROID_NDK_ROOT=${TOOLCHAIN_PREFIX}/android-ndk-r20 +ENV PATH=${PATH}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin diff --git a/libindy/ci/wrappers/python.dockerfile b/libindy/ci/wrappers/python.dockerfile new file mode 100644 index 0000000000..2984d97566 --- /dev/null +++ b/libindy/ci/wrappers/python.dockerfile @@ -0,0 +1,16 @@ +ARG WRAPPER_BASE_IMAGE +FROM ${WRAPPER_BASE_IMAGE} + +RUN apt-get update && \ + apt-get install -y \ + python3.5 \ + python-setuptools + +RUN curl -fsSL -o- https://bootstrap.pypa.io/pip/get-pip.py | python3.6 + +RUN pip install -U \ + setuptools \ + virtualenv \ + twine==1.15.0 \ + plumbum==1.6.7 six==1.12.0 \ + deb-pkg-tools diff --git a/libindy/ci/wrappers/wrapper-base.dockerfile b/libindy/ci/wrappers/wrapper-base.dockerfile new file mode 100644 index 0000000000..b96c0712c8 --- /dev/null +++ b/libindy/ci/wrappers/wrapper-base.dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:18.04 + +ARG RUST_VER=1.46.0 + +RUN apt-get update && \ + apt-get install -y \ + pkg-config \ + curl \ + cmake \ + build-essential \ + libssl-dev \ + libzmq3-dev \ + python3-distutils + +RUN cd /tmp && \ + curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar -xz && \ + cd /tmp/libsodium-1.0.18 && \ + ./configure && \ + make && \ + make install && \ + ldconfig && \ + rm -rf /tmp/libsodium-1.0.18 + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_VER} +ENV PATH /root/.cargo/bin:$PATH + +RUN cargo install cargo-deb cargo-bump + +WORKDIR /root + +COPY libindy indy-sdk/libindy +COPY wrappers indy-sdk/wrappers +ARG INDYSDK_PATH=/root/indy-sdk + +RUN cargo build --release --manifest-path=$INDYSDK_PATH/libindy/Cargo.toml +RUN mv $INDYSDK_PATH/libindy/target/release/libindy.so /usr/lib + +RUN rm -rf indy-sdk diff --git a/libindy/ga-android.build.sh b/libindy/ga-android.build.sh new file mode 100755 index 0000000000..5cfafa324d --- /dev/null +++ b/libindy/ga-android.build.sh @@ -0,0 +1,175 @@ +#!/usr/bin/env bash +export BLACK=`tput setaf 0` +export RED=`tput setaf 1` +export GREEN=`tput setaf 2` +export YELLOW=`tput setaf 3` +export BLUE=`tput setaf 4` +export MAGENTA=`tput setaf 5` +export CYAN=`tput setaf 6` +export WHITE=`tput setaf 7` + +export BOLD=`tput bold` +export RESET=`tput sgr0` + +set -ex +set -o pipefail +WORKDIR=${PWD} +LIBINDY_WORKDIR=${WORKDIR} +CI_DIR="${LIBINDY_WORKDIR}/ci" +export ANDROID_BUILD_FOLDER="/tmp/android_build" +DOWNLOAD_PREBUILTS="1" + +while getopts ":d" opt; do + case ${opt} in + d) export DOWNLOAD_PREBUILTS="1";; + \?);; + esac +done +shift $((OPTIND -1)) + +TARGET_ARCH=$1 + +if [ -z "${TARGET_ARCH}" ]; then + echo STDERR "${RED}Missing TARGET_ARCH argument${RESET}" + echo STDERR "${BLUE}e.g. x86 or arm${RESET}" + exit 1 +fi + +source ${CI_DIR}/setup.android.env.sh + +create_cargo_config(){ +mkdir -p ${LIBINDY_WORKDIR}/.cargo +cat << EOF > ${LIBINDY_WORKDIR}/.cargo/config +[target.${TRIPLET}] +ar = "$(realpath ${AR})" +linker = "$(realpath ${CC})" +EOF +} + +normalize_dir(){ + case "$1" in + /*) echo "$1";; + ~/*) echo "$1";; + *) echo "$(pwd)/$1";; + esac +} + +setup_dependencies(){ + if [ "${DOWNLOAD_PREBUILTS}" == "1" ]; then + setup_dependencies_env_vars ${ABSOLUTE_ARCH} + else + echo "${BLUE}Not downloading prebuilt dependencies. Dependencies locations have to be passed${RESET}" + if [ -z "${OPENSSL_DIR}" ]; then + + OPENSSL_DIR=$(normalize_dir "openssl_${ABSOLUTE_ARCH}") + if [ -d "${OPENSSL_DIR}" ]; then + echo "${GREEN}Found ${OPENSSL_DIR}${RESET}" + elif [ -z "$2" ]; then + echo STDERR "${RED}Missing OPENSSL_DIR argument and environment variable${RESET}" + echo STDERR "${BLUE}e.g. set OPENSSL_DIR= for environment or openssl_${ABSOLUTE_ARCH}${RESET}" + exit 1 + else + OPENSSL_DIR=$2 + fi + fi + + if [ -z "${SODIUM_DIR}" ]; then + SODIUM_DIR=$(normalize_dir "libsodium_${ABSOLUTE_ARCH}") + if [ -d "${SODIUM_DIR}" ] ; then + echo "${GREEN}Found ${SODIUM_DIR}${RESET}" + elif [ -z "$3" ]; then + echo STDERR "${RED}Missing SODIUM_DIR argument and environment variable${RESET}" + echo STDERR "${BLUE}e.g. set SODIUM_DIR= for environment or libsodium_${ABSOLUTE_ARCH}${RESET}" + exit 1 + else + SODIUM_DIR=$3 + fi + fi + + if [ -z "${LIBZMQ_DIR}" ] ; then + LIBZMQ_DIR=$(normalize_dir "libzmq_${ABSOLUTE_ARCH}") + if [ -d "${LIBZMQ_DIR}" ] ; then + echo "${GREEN}Found ${LIBZMQ_DIR}${RESET}" + elif [ -z "$4" ] ; then + echo STDERR "${RED}Missing LIBZMQ_DIR argument and environment variable${RESET}" + echo STDERR "${BLUE}e.g. set LIBZMQ_DIR= for environment or libzmq_${ABSOLUTE_ARCH}${RESET}" + exit 1 + else + LIBZMQ_DIR=$4 + fi + fi + fi +} + +statically_link_dependencies_with_libindy(){ + echo "${BLUE}Statically linking libraries togather${RESET}" + echo "${BLUE}Output will be available at ${ANDROID_BUILD_FOLDER}/libindy_${ABSOLUTE_ARCH}/lib/libindy.so${RESET}" + $CC -v -shared -o${ANDROID_BUILD_FOLDER}/libindy_${ABSOLUTE_ARCH}/lib/libindy.so -Wl,--whole-archive \ + ${WORKDIR}/target/${TRIPLET}/release/libindy.a \ + ${TOOLCHAIN_DIR}/sysroot/usr/lib/${ANDROID_TRIPLET}/libm.a \ + ${OPENSSL_DIR}/lib/libssl.a \ + ${OPENSSL_DIR}/lib/libcrypto.a \ + ${SODIUM_LIB_DIR}/libsodium.a \ + ${LIBZMQ_LIB_DIR}/libzmq.a \ + -Wl,--no-whole-archive -z muldefs -L${TOOLCHAIN_DIR}/sysroot/usr/lib/${ANDROID_TRIPLET}/${TARGET_API} -lz -llog -lc++_shared +} + +package_library(){ + + export PACKAGE_DIR=${ANDROID_BUILD_FOLDER}/libindy_${ABSOLUTE_ARCH} + export ZIP_DIR=/tmp/artifacts/libindy + + mkdir -p ${PACKAGE_DIR}/lib + mkdir -p ${ZIP_DIR} + + cp -rf "${WORKDIR}/include" ${PACKAGE_DIR} + cp "${WORKDIR}/target/${TRIPLET}/release/libindy.a" ${PACKAGE_DIR}/lib + cp "${WORKDIR}/target/${TRIPLET}/release/libindy.so" ${PACKAGE_DIR}/lib + if [ "${TARGET_ARCH}" != "x86_64" ]; then + mv "${PACKAGE_DIR}/lib/libindy.so" "${PACKAGE_DIR}/lib/libindy_shared.so" && + statically_link_dependencies_with_libindy + fi + pushd ${LIBINDY_WORKDIR} + rm -f libindy_android_${ABSOLUTE_ARCH}.zip + cp -rf ${PACKAGE_DIR} . + if [ -n "${LIBINDY_VERSION}" ]; then + zip -r ${ZIP_DIR}/libindy_android_${ABSOLUTE_ARCH}_${LIBINDY_VERSION}.zip libindy_${ABSOLUTE_ARCH} && + echo "${BLUE}Zip file available at ${ZIP_DIR}/libindy_android_${ABSOLUTE_ARCH}_${LIBINDY_VERSION}.zip ${RESET}" + elif [ -n "${FULL_VERSION_NAME}" ]; then + zip -r ${ZIP_DIR}/${FULL_VERSION_NAME}.zip libindy_${ABSOLUTE_ARCH} && + echo "${BLUE}Zip file available at ${ZIP_DIR}/${FULL_VERSION_NAME}.zip ${RESET}" + else + zip -r ${ZIP_DIR}/libindy_android_${ABSOLUTE_ARCH}.zip libindy_${ABSOLUTE_ARCH} && + echo "${BLUE}Zip file available at ${ZIP_DIR}/libindy_android_${ABSOLUTE_ARCH}.zip ${RESET}" + fi + popd +} + +build(){ + echo "**************************************************" + echo "Building for architecture ${BOLD}${YELLOW}${ABSOLUTE_ARCH}${RESET}" + echo "Toolchain path ${BOLD}${YELLOW}${TOOLCHAIN_DIR}${RESET}" + echo "ZMQ path ${BOLD}${YELLOW}${LIBZMQ_DIR}${RESET}" + echo "Sodium path ${BOLD}${YELLOW}${SODIUM_DIR}${RESET}" + echo "Openssl path ${BOLD}${YELLOW}${OPENSSL_DIR}${RESET}" + echo "Artifacts will be in ${YELLOW}${GREEN}${ANDROID_BUILD_FOLDER}/libindy_${ABSOLUTE_ARCH}${RESET}" + echo "**************************************************" + pushd ${WORKDIR} + rm -rf target/${TRIPLET} + cargo clean + RUSTFLAGS="-C link-args=-Wl -lc++_shared" \ + cargo build --release --target=${TRIPLET} + rm -rf target/${TRIPLET}/release/deps + rm -rf target/${TRIPLET}/release/build + rm -rf target/release/deps + rm -rf target/release/build + popd +} + + +generate_arch_flags ${TARGET_ARCH} +setup_dependencies +set_env_vars +create_standalone_toolchain_and_rust_target +create_cargo_config +build && package_library diff --git a/libindy/indy-utils/Cargo.toml b/libindy/indy-utils/Cargo.toml index c26899adf9..4420be84f3 100644 --- a/libindy/indy-utils/Cargo.toml +++ b/libindy/indy-utils/Cargo.toml @@ -31,8 +31,8 @@ serde = "1.0.99" serde_json = "1.0.40" serde_derive = "1.0.99" sodiumoxide = {version = "0.0.16"} -zeroize = "0.9.3" +zeroize = "1.0.0" [dev-dependencies] rmp-serde = "0.13.7" -rand = "0.7.0" \ No newline at end of file +rand = "0.7.0" diff --git a/libindy/tests/interaction.rs b/libindy/tests/interaction.rs index 712c18bcf1..e90f974400 100644 --- a/libindy/tests/interaction.rs +++ b/libindy/tests/interaction.rs @@ -512,11 +512,12 @@ impl Verifier { } #[cfg(feature = "revocation_tests")] +#[ignore] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand() { anoncreds_revocation_interaction_test_one_prover(r#"{"max_cred_num":5, "issuance_type":"ISSUANCE_ON_DEMAND"}"#); } - + #[cfg(feature = "revocation_tests")] #[cfg(any(feature = "force_full_interaction_tests", not(target_os = "android")))] #[cfg(not(feature = "only_high_cases"))] @@ -816,6 +817,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_three_credentials_po } #[cfg(feature = "revocation_tests")] +#[ignore] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_fully_qualified_did() { let setup = Setup::empty(); @@ -961,6 +963,7 @@ fn anoncreds_revocation_interaction_test_issuance_by_demand_fully_qualified_did( } #[cfg(feature = "revocation_tests")] +#[ignore] #[test] fn anoncreds_revocation_interaction_test_issuance_by_demand_fully_qualified_issuer_unqualified_prover() { let setup = Setup::empty(); diff --git a/libnullpay/android.build.sh b/libnullpay/android.build.sh index 96183881f1..548cd9f7fe 100755 --- a/libnullpay/android.build.sh +++ b/libnullpay/android.build.sh @@ -141,4 +141,4 @@ set_env_vars create_standalone_toolchain_and_rust_target create_cargo_config build -package_library \ No newline at end of file +package_library diff --git a/vcx/ci/Jenkinsfile b/vcx/ci/Jenkinsfile deleted file mode 100644 index b80551c7b6..0000000000 --- a/vcx/ci/Jenkinsfile +++ /dev/null @@ -1,428 +0,0 @@ -#!groovy - -def rust -def vcx_python -def libindy -def libvcx -def vcx_nodejs - -// ******** Artifacts Created ******** -// libvcx_.deb (Debian Installable Library) ----> published Debian to https://repo.corp.evernym.com/deb/pool/main/libv/libvcx/ -// vcx_.deb (Nodejs Wrapper Debian Package) ----> archived with Jenkins and Published to repo.corp.evernym.com/deb/pool -// vcx_.tgz (Nodejs Wrapper Npm Installable Package) ----> published with Filely to https://repo.corp.evernym.com/filely/npm/ -// python3-vcx-wrapper-.tar.gz (Python Installable package) ----> published with Filely to https://kraken.corp.evernym.com/repo/python/upload -// ********* OTHERS ******** -// DEPRECATED ( NO LONGER PRODUCED ) libvcx.tar.gz (libvcx.so file and provision_agent_keys.py) ----> archived with Jenkins -class Globals { - - static String rustVersion = "1.37.0" - - static String libindyVersion = "1.10.1" - - static String libindyTag = "" - - static String libnullVersion = "1.10.1" - - static String nullpayTag = "" - - static String libsovtokenVersion = "1.0.0" - - static String androidSovtokenArtifact = "libsovtoken_1.0.0-201907031231-e7dde6e_all.zip " - - static String iosSovtokenArtifact = "libsovtoken_1.0.0-201907031239-e7dde6e_all.zip" - - static String indyBranch = 'stable' - - static String nullBranch = 'stable' - - static String vcxVersion = null - - static String vcxRevision = null -} - -testing() - -def testing() { - vcxVersion() - if (Globals.vcxVersion && Globals.vcxRevision) { - echo "VCX Version: ${Globals.vcxVersion}" - echo "VCX revision: ${Globals.vcxRevision}" - echo "Full VCX version: ${full_vcx_version()}" - - stage('Testing') { - parallel([ - 'Xenial' : { mainUbuntu() }, - 'Android': { android() }, - 'iOS' : { ios() } - ]) - } - } else { - currentBuild.result = "FAILED" - if (env.BRANCH_NAME == "master") { - fail() - } - echo "vcx version not found" - } -} - -def buildLibindyDocker() { - def libindyDockerfile = 'vcx/ci/libindy.dockerfile' - def indyTag = appendTag(Globals.libindyTag, "~") - - def nullTag= appendTag(Globals.nullpayTag, "~") - - docker.build("libindy", "--build-arg LIBINDY_VER=${Globals.libindyVersion}${indyTag} \ - --build-arg LIBNULL_VER=${Globals.libnullVersion}${nullTag} \ - --build-arg LIBSOVTOKEN_VER=${Globals.libsovtokenVersion} \ - -f ${libindyDockerfile} .") -} - -def buildAndroidDocker() { - def uid= sh(returnStdout: true, script: 'id -u').trim() - android = docker.build("android", "--build-arg uid=${uid} --build-arg RUST_VER=${Globals.rustVersion} -f vcx/wrappers/java/ci/android.dockerfile .") -} - - -def getUserUid() { - return sh(returnStdout: true, script: 'id -u').trim() -} - - -def build(name, file, context='.', customParams = '') { - return docker.build("$name", "${customParams} --build-arg uid=${getUserUid()} -f $file $context") -} - -static String appendTag(tag, del) { - if (tag == null) {tag = ""} - if (tag != "") { tag = del + tag } - return tag -} - -static String full_vcx_version() { - return Globals.vcxVersion + "-" + Globals.vcxRevision -} - -def vcxVersion() { - node('ubuntu') { - - try { - checkout scm - - libindy = buildLibindyDocker() - def scripts_path = "vcx/ci/scripts" - stage('Retrieve VCX version for ios & android') { - libindy.inside { - pwd = sh( - returnStdout: true, - script: 'pwd' - ).trim() - sh "cd vcx/libvcx && ./../ci/scripts/cargo-update-version" - Globals.vcxRevision = sh( - returnStdout: true, - script: 'git rev-parse --short HEAD' - ).trim() - Globals.vcxVersion = sh( - returnStdout: true, - script: "./${scripts_path}/toml_utils.py ${pwd}/vcx/libvcx/Cargo.toml" - ).trim() - } - - } - - } catch (Exception ex) { - currentBuild.result = "FAILED" - if (env.BRANCH_NAME == "master") { - fail() - } - echo "$ex error" - } finally { - sh 'docker system df' - step([$class: 'WsCleanup']) - } - } -} - -def mainUbuntu() { - node('ubuntu') { - - try { - checkout scm - def libvcxDockerfile = 'vcx/ci/libvcx.dockerfile' - def pythonDockerfile = 'vcx/ci/python.dockerfile' - def nodeDockerfile = 'vcx/wrappers/node/ci/node.dockerfile' - def javaDockerfile = 'vcx/wrappers/java/ci/java.dockerfile' - def uid= sh(returnStdout: true, script: 'id -u').trim() - def cwd= sh(returnStdout: true, script: 'pwd').trim() - def python - def node - def java - - // set this to '--no-test' and the rust code will not run tests. - def rustTestFlag="test" - - stage('Build Libindy Image') { - // ******** Build the libindy base image (pulls down dependent debians from sovrin repo, and installs a majority of the dependencies) - buildLibindyDocker() - } - - sh 'mkdir -p output' - sh 'rm -rf output/*' - stage('Build Libvcx Image and Tests Rust Code') { - libvcx = docker.build("libvcx", "--build-arg uid=${uid} --build-arg RUST_VER=${Globals.rustVersion} -f ${libvcxDockerfile} .") - libvcx.inside { - sh "vcx/ci/scripts/package.sh ${rustTestFlag} ${Globals.vcxVersion} ${Globals.vcxRevision}" - } - } - - stage('Test Python Wrapper'){ - python = docker.build("python", "--build-arg uid=${uid} -f ${pythonDockerfile} .") - withEnv(["PYTHONPATH=${cwd}/vcx/wrappers/python3:vcx/wrappers/python3"]){ - python.inside() { - sh 'vcx/wrappers/python3/ci/test.sh' - } - } - } - stage('Test Node Wrapper') { - node = docker.build('node', "--build-arg uid=${uid} -f ${nodeDockerfile} .") - node.inside() { - sh 'vcx/wrappers/node/ci/test.sh' - } - } - stage('Test Java Wrapper'){ - java = docker.build("java", "--build-arg uid=${uid} -f ${javaDockerfile} .") - java.inside() { - sh 'cd vcx/wrappers/java && ./gradlew --no-daemon test' - } - } - stage('Package Python Wrapper') { - python.inside() { - sh 'vcx/wrappers/python3/ci/package.sh' - } - } - stage('Package Node Wrapper') { - node.inside() { - sh 'vcx/wrappers/node/ci/package.sh' - - } - } - stage('Package Java Wrapper') { - java.inside() { - sh 'vcx/wrappers/java/ci/buildJar.sh $(python3 vcx/ci/scripts/toml_utils.py vcx/libvcx/Cargo.toml)' - } - } - // debug info - sh 'ls -al output' - if (env.BRANCH_NAME == "master") { - stage('Publish') { - // ******** PUBLISHING (artifacts are in a Docker Volume) ******** - withCredentials([usernameColonPassword(credentialsId: 'jenkins-kraken-svc', variable: 'KRAKEN_CREDENTIALS')]) { - libvcx.inside("--network=host") { - - // ******** Archive with Jenkins ******** - archiveArtifacts allowEmptyArchive: true, artifacts: 'output/*' - - // ******** Publish Libvcx Debian to repo ******** - sh "vcx/ci/scripts/publish.sh \"${KRAKEN_CREDENTIALS}\" \"libvcx*.deb\" https://kraken.corp.evernym.com/repo/portal_dev/upload" - sh "vcx/ci/scripts/publish.sh \"${KRAKEN_CREDENTIALS}\" \"libvcx*.deb\" https://kraken.corp.evernym.com/repo/agency_dev/upload" - - // ******** Publish vcx Debian To Repo (NPM PACKAGES) For Agency - sh "vcx/ci/scripts/publish.sh \"${KRAKEN_CREDENTIALS}\" \"vcx_*.deb\" https://kraken.corp.evernym.com/repo/agency_dev/upload" - sh "vcx/ci/scripts/publish.sh \"${KRAKEN_CREDENTIALS}\" \"vcx_*.deb\" https://kraken.corp.evernym.com/repo/portal_dev/upload" - - // ******** Publish Npm Package to filely repo ******** - sh "vcx/ci/scripts/publish.sh \"${KRAKEN_CREDENTIALS}\" \"node-vcx-wrapper*.tgz\" https://kraken.corp.evernym.com/repo/npm/upload" - - // ******** Publish Python Package to filely repo ********* - sh "vcx/ci/scripts/publish.sh \"${KRAKEN_CREDENTIALS}\" \"python3-vcx-wrapper*.tar.gz\" https://kraken.corp.evernym.com/repo/python/upload" - } - } - withCredentials([file(credentialsId: 'cloudrepo-artifactory-settings-libvcx', variable: 'settingsFile')]) { - java.inside() { - sh 'cp $settingsFile .' - sh "chmod +x vcx/wrappers/java/ci/publishJar.sh" - sh 'vcx/wrappers/java/ci/publishJar.sh' - } - } - } - } - } catch (Exception ex) { - currentBuild.result = "FAILED" - if (env.BRANCH_NAME == "master") { - fail() - } - echo "$ex error" - } finally { - sh 'docker system df' - step([$class: 'WsCleanup']) - } - } -} - -def android() { - - stage('Android Build') { - parallel([ - "x86" : { buildAndroid("x86") }, - "x86_64" : { buildAndroid("x86_64") }, - "arm" : { buildAndroid("arm") }, - "arm64" : { buildAndroid("arm64") }, - "armv7" : { buildAndroid("armv7") } - ]) - } - node('ubuntu') { - try { - checkout scm - - stage('Build Libindy Image') { - // ******** Build the libindy base image (pulls down dependent debians from sovrin repo, and installs a majority of the dependencies) - buildLibindyDocker() - } - buildAndroidDocker() - stage('Android Packaging') { - //Package .so files into .aar - packageAndroid(android) - } - stage('Android Publishing') { - if (env.BRANCH_NAME == "master") { - //Publish package on aptly - publishAndroid(android) - } - } - } catch (Exception ex) { - currentBuild.result = "FAILED" - if (env.BRANCH_NAME == "master") { - fail() - } - echo "$ex error" - } finally { - sh 'docker system df' - step([$class: 'WsCleanup']) - } - } -} - -def ios() { - - node('macos-vcx') { - checkout scm - stage('iOS Build') { - try { - SCRIPTS_PATH="vcx/libvcx/build_scripts/ios/mac" - WORK_DIR = "/Users/jenkins" - - // Build ios architectures - - def indyTag = appendTag(Globals.libindyTag, "-") - def nullTag = appendTag(Globals.nullpayTag, "-") - - sh "source vcx/ci/scripts/iosBuild.sh ${Globals.indyBranch} ${Globals.libindyVersion}${indyTag} \ - ${Globals.nullBranch} ${Globals.libnullVersion}${nullTag} ${Globals.iosSovtokenArtifact} \ - ${Globals.rustVersion} ${full_vcx_version()}" - - if (env.BRANCH_NAME == "master") { - withCredentials([usernameColonPassword(credentialsId: 'jenkins-kraken-svc', variable: 'KRAKEN_CREDENTIALS')]) { - // ******** Archive with Jenkins ******** - archiveArtifacts allowEmptyArchive: true, artifacts: "/Users/jenkins/IOSBuilds/libvcxpartial/vcx.libvcxpartial_${full_vcx_version()}_universal.zip" - archiveArtifacts allowEmptyArchive: true, artifacts: "/Users/jenkins/IOSBuilds/libvcxpartial/libvcx.a.libvcxpartial_${full_vcx_version()}.tar.gz" - archiveArtifacts allowEmptyArchive: true, artifacts: "/Users/jenkins/IOSBuilds/libvcxall/vcx.libvcxall_${full_vcx_version()}_universal.zip" - archiveArtifacts allowEmptyArchive: true, artifacts: "/Users/jenkins/IOSBuilds/libvcxall/libvcx.a.libvcxall_${full_vcx_version()}_universal.tar.gz" - - sh "find /Users/jenkins/IOSBuilds/libvcxpartial/ -type f -name 'vcx.libvcxpartial_*_universal.zip' -exec curl -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/ios/upload -F 'file=@{}' \\;" - sh "find /Users/jenkins/IOSBuilds/libvcxpartial/ -type f -name 'libvcx.a.libvcxpartial_*_universal.tar.gz' -exec curl -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/ios/upload -F 'file=@{}' \\;" - sh "find /Users/jenkins/IOSBuilds/libvcxall/ -type f -name 'vcx.libvcxall_*_universal.zip' -exec curl -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/ios/upload -F 'file=@{}' \\;" - sh "find /Users/jenkins/IOSBuilds/libvcxall/ -type f -name 'libvcx.a.libvcxall_*_universal.tar.gz' -exec curl -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/ios/upload -F 'file=@{}' \\;" - } - } - } catch (Exception ex) { - currentBuild.result = "FAILED" - if (env.BRANCH_NAME == "master") { - fail() - } - echo "$ex error" - } finally { - step([$class: 'WsCleanup']) - } - } - } -} - -def fail() { - - def message = [ - message: "$JOB_NAME - Build # $BUILD_NUMBER - fail: Check console output at $BUILD_URL to view the results." - ] - slackSend message -} - -def buildAndroid(arch) { - - node('ubuntu') { - try { - checkout scm - - stage('Build Libindy Image') { - // ******** Build the libindy base image (pulls down dependent debians from sovrin repo, and installs a majority of the dependencies) - buildLibindyDocker() - } - stage('Build and Publish Android') { - buildAndroidDocker() - android.inside { - ANDROID_SCRIPT_PATH = 'vcx/ci/scripts/androidBuild.sh' - - sh 'sudo ./vcx/ci/scripts/installCert.sh' - - def indyTag = appendTag(Globals.libindyTag, "-") - def nullTag = appendTag(Globals.nullpayTag, "-") - - sh "./${ANDROID_SCRIPT_PATH} ${arch} ${Globals.indyBranch} ${Globals.libindyVersion}${indyTag} \ - ${Globals.nullBranch} ${Globals.libnullVersion}${nullTag} ${Globals.androidSovtokenArtifact}" - - } - - dir("runtime_android_build/libvcx_${arch}") { - stash includes: "libvcx.so,libz.so,liblog.so,libc++_shared.so", name: "libvcx_${arch}" - } - } - } catch (Exception ex) { - currentBuild.result = "FAILED" - if (env.BRANCH_NAME == "master") { - fail() - } - echo "$ex error" - } finally { - sh 'docker system df' - step([$class: 'WsCleanup']) - } - } -} - -def packageAndroid(android) { - all_archs = ["arm", "arm64", "armv7", "x86", "x86_64"] - for (arch in all_archs) { - dir("runtime_android_build/libvcx_${arch}") { - unstash name: "libvcx_${arch}" - } - } - android.inside { - ANDROID_SCRIPT_PATH = 'vcx/ci/scripts/androidPackage.sh' - sh "chmod +x ${ANDROID_SCRIPT_PATH}" - sh "./${ANDROID_SCRIPT_PATH}" - } -} - -def publishAndroid(envn) { - envn.inside { - withCredentials([file(credentialsId: 'cloudrepo-artifactory-settings-libvcx', variable: 'settingsFile')]) { - sh 'cp $settingsFile .' - ANDROID_SCRIPT_PATH = 'vcx/ci/scripts/androidPublish.sh' - sh "chmod +x ${ANDROID_SCRIPT_PATH}" - sh "./${ANDROID_SCRIPT_PATH} ${full_vcx_version()}" - } - - withCredentials([usernameColonPassword(credentialsId: 'jenkins-kraken-svc', variable: 'KRAKEN_CREDENTIALS')]) { - artifactLocation='vcx/wrappers/java/artifacts/aar' - artifactName="com.evernym-vcx_${full_vcx_version()}_x86-armv7-release.aar" - archiveArtifacts allowEmptyArchive: true, artifacts: "${artifactLocation}/${artifactName}" - } - } -} diff --git a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyErrors.h b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyErrors.h index 07b21169eb..fa4d9b34a3 100644 --- a/wrappers/ios/libindy-pod/Indy/Wrapper/IndyErrors.h +++ b/wrappers/ios/libindy-pod/Indy/Wrapper/IndyErrors.h @@ -53,7 +53,7 @@ typedef NS_ENUM(NSInteger, IndyErrorCode) CommonInvalidParam13 = 115, // Caller passed invalid value as param 14 (null, invalid json and etc..) - CommonInvalidParam14 = 116 + CommonInvalidParam14 = 116, // Wallet errors // Caller passed invalid wallet handle