feat(sdk): Change masking character to a bullet (#579) #2052
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright Avast Software. All Rights Reserved. | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
name: "wallet-sdk ci" | |
env: | |
GO_VERSION: '1.21' | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
SemanticPullRequest: | |
name: Semantic Pull Request Check | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: amannn/action-semantic-pull-request@v4 | |
with: | |
requireScope: true | |
scopes: | | |
sdk | |
app | |
deps | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
Checks: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run checks | |
run: | | |
echo $PATH | |
go env | |
echo ${{ github.workspace }} | |
make checks | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
UnitTest: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run unit test | |
run: make unit-test | |
- name: Upload coverage to Codecov | |
run: | | |
bash <(curl https://codecov.io/bash) | |
env: | |
CODECOV_UPLOAD_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN }} | |
SDKIntegrationTest: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run Integration tests | |
run: | | |
echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts | |
make integration-test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Temporarily disabled due to compatibility issues with Go 1.21. | |
# | |
# WASMIntegrationTest: | |
# runs-on: ubuntu-20.04 | |
# timeout-minutes: 30 | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Set up Go | |
# uses: actions/setup-go@v3 | |
# with: | |
# go-version: ${{ env.GO_VERSION }} | |
# - name: Setup Node.js | |
# uses: actions/setup-node@v3 | |
# - name: Run Integration tests | |
# uses: GabrielBB/xvfb-action@v1 | |
# with: | |
# run: | | |
# echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts | |
# echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts | |
# echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts | |
# echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts | |
# echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts | |
# echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts | |
# make integration-test-wasm | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
iOSFlutterIntegrationTest: | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Generate and copy iOS Binding | |
run: | | |
echo $PATH | |
echo ${{ github.workspace }} | |
echo ${GOPATH} | |
echo ${GOROOT} | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
gomobile init | |
NEW_VERSION=testVer GIT_REV=testRev BUILD_TIME=testTime make generate-ios-bindings copy-ios-bindings | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GOPATH: /Users/runner/work/wallet-sdk/go | |
- name: Setup env for integration test | |
run: | | |
echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts | |
brew install docker docker-compose | |
brew remove --ignore-dependencies qemu | |
curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/dc0669eca9479e9eeb495397ba3a7480aaa45c2e/Formula/qemu.rb | |
brew install ./qemu.rb | |
colima start | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
make prepare-integration-test-flutter | |
- name: Setup Flutter SDK | |
uses: flutter-actions/setup-flutter@v2 | |
with: | |
channel: stable | |
version: 3.10.6 | |
- name: Install flutter app dependencies | |
run: make install-flutter-dependencies | |
- name: Run iOS Simulator | |
uses: futureware-tech/simulator-action@v2 | |
with: | |
model: 'iPhone 14' | |
- name: Remove AppIcon contents file (Simulator build fails with this file) | |
run: | | |
rm -rf demo/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | |
rm -rf demo/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json | |
- name: Run tests on Simulator | |
run: make integration-test-flutter integration-test-ios | |
AndroidFlutterIntegrationTest: | |
runs-on: macOS-12 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Gradle cache | |
uses: gradle/[email protected] | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-29 | |
- name: Cache Android build files | |
uses: actions/cache@v3 | |
with: | |
key: android-build-files | |
path: | | |
demo/app/build | |
demo/app/android/.gradle | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Generate and copy Android Binding | |
run: | | |
echo $PATH | |
echo ${{ github.workspace }} | |
echo ${GOPATH} | |
echo ${GOROOT} | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
gomobile init | |
NEW_VERSION=testVer GIT_REV=testRev BUILD_TIME=testTime make generate-android-bindings copy-android-bindings | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GOPATH: /Users/runner/work/wallet-sdk/go | |
- name: Setup env for integration test | |
run: | | |
echo '127.0.0.1 testnet.orb.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts | |
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts | |
brew install docker docker-compose | |
brew remove --ignore-dependencies qemu | |
curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/dc0669eca9479e9eeb495397ba3a7480aaa45c2e/Formula/qemu.rb | |
brew install ./qemu.rb | |
colima start | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
gomobile init | |
make prepare-integration-test-flutter | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Flutter SDK | |
uses: flutter-actions/setup-flutter@v2 | |
with: | |
channel: stable | |
version: 3.10.6 | |
- name: Install flutter app dependencies | |
run: make install-flutter-dependencies | |
- name: Build APK in Debug mode | |
run: | | |
cd demo/app | |
flutter build apk --debug | |
- name: Run tests on Emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: adb reverse tcp:8075 tcp:8075 && adb reverse tcp:8072 tcp:8072 && adb reverse tcp:9229 tcp:9229 && make integration-test-flutter integration-test-android | |
GenerateVersion: | |
if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main') | |
needs: [ Checks, UnitTest, SDKIntegrationTest] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
outputs: | |
version: ${{ steps.store.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Get current published version | |
run: | | |
TAG=$(git describe --tags --always `git rev-list --tags --max-count=1`) | |
VERSION=$(git rev-parse --short=7 HEAD) | |
echo "repoTag=${TAG} repoVersion=${VERSION}" | |
if [[ $TAG == $VERSION ]]; then | |
TAG=0.0.0 | |
fi | |
echo "CURRENT_SEMVER=${TAG:0:5}" >> $GITHUB_ENV | |
echo "repoTag=${TAG} repoVersion=${VERSION} currentSemVer=${TAG:0:5}" | |
- name: Bump published version | |
id: bump_version | |
uses: christian-draeger/[email protected] | |
with: | |
current-version: '${{ env.CURRENT_SEMVER }}' | |
# TODO: needs to be configurable https://github.com/christian-draeger/increment-semantic-version#input--output-examples | |
version-fragment: 'bug' | |
- id: store | |
run: echo "version=${{ steps.bump_version.outputs.next-version }}" >> $GITHUB_OUTPUT | |
PublishIosSDKSnapshot: | |
if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main') | |
needs: GenerateVersion | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Derive the new version | |
run: | | |
echo "new version" | |
NEW_VER=${{ needs.GenerateVersion.outputs.version }}-SNAPSHOT-$(git rev-parse --short=7 HEAD) | |
echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV | |
echo $NEW_VER | |
- name: Generate Binding | |
run: | | |
echo $PATH | |
echo ${{ github.workspace }} | |
echo ${GOPATH} | |
echo ${GOROOT} | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
gomobile init | |
GIT_REV=$(git rev-parse HEAD) BUILD_TIME=$(date) make generate-ios-bindings | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GOPATH: /Users/runner/work/wallet-sdk/go | |
- name: Upload iOS bindings to GitHub Actions Artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ios-binding | |
path: ./cmd/wallet-sdk-gomobile/bindings/ios | |
- name: Zip walletsdk framework | |
run: | | |
cd ./cmd/wallet-sdk-gomobile/bindings/ios | |
zip -r -X walletsdk.xcframework.zip walletsdk.xcframework | |
- name: Clone walletsdk release repository | |
uses: actions/checkout@v2 | |
with: | |
repository: trustbloc-cicd/wallet-sdk | |
path: ios | |
token: ${{ secrets.WALLET_SDK_CICD_PAT }} | |
- name: Build and commit walletsdk xcframework package | |
run: | | |
cp -r ./cmd/wallet-sdk-gomobile/bindings/ios/walletsdk.xcframework.zip ./ios/walletsdk.xcframework.zip | |
cd ios/ | |
ls -lrt | |
echo "calculate new checksum" | |
NEW_CHECKSUM=$(swift package compute-checksum $FRAMEWORK_NAME.xcframework.zip) | |
echo "moduleName=$FRAMEWORK_NAME version=$NEW_VERSION checksum=$NEW_CHECKSUM" | |
echo "replace name module information in package manifest" | |
sed -E -i '' 's/let moduleName = ".+"/let moduleName = "'$FRAMEWORK_NAME\"/ Package.swift | |
echo "replace version information in package manifest" | |
sed -E -i '' 's/let version = ".+"/let version = "'$NEW_VERSION\"/ Package.swift | |
echo "replace checksum information in package manifest" | |
sed -E -i '' 's/let checksum = ".+"/let checksum = "'$NEW_CHECKSUM\"/ Package.swift | |
echo "Package.swift content file after update" | |
cat Package.swift | |
echo "git commit all without framework and push" | |
git status | |
git add Package.swift | |
git commit -m "New $FRAMEWORK_NAME version $NEW_VERSION" | |
git push | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FRAMEWORK_NAME: walletsdk | |
NEW_VERSION: '${{ env.NEW_VERSION }}' | |
- name: Tag and Release new version Swift package | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
tag_name : ${{ env.NEW_VERSION }} | |
repository : trustbloc-cicd/wallet-sdk | |
files: | | |
ios/walletsdk.xcframework.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.WALLET_SDK_CICD_PAT }} | |
PublishAndroidSDKSnapshot: | |
needs: GenerateVersion | |
if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main') | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Derive the new version | |
run: | | |
echo "new version" | |
NEW_VER=${{ needs.GenerateVersion.outputs.version }}-SNAPSHOT-$(git rev-parse --short=7 HEAD) | |
echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV | |
echo $NEW_VER | |
- name: Generate Binding | |
run: | | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
gomobile init | |
GIT_REV=$(git rev-parse HEAD) BUILD_TIME=$(date) make generate-android-bindings | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GOPATH: /home/runner/work/wallet-sdk/go | |
- name: Upload Android bindings to GitHub Actions Artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: android-binding | |
path: ./cmd/wallet-sdk-gomobile/bindings/android | |
- name: Publish | |
run: | | |
export USER=$USER | |
export TOKEN=$TOKEN | |
export ANDROID_GROUP_ID=dev.trustbloc | |
export ANDROID_ARTIFACT_ID=vc-wallet-sdk | |
export ANDROID_VERSION=${{ env.NEW_VERSION }} | |
export PROJECT_PKG_REPO=https://maven.pkg.github.com/trustbloc-cicd/snapshot | |
echo $ANDROID_VERSION | |
gradle publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
USER: ${{ secrets.CR_USER }} | |
TOKEN: ${{ secrets.CR_PAT }} | |
NEW_VERSION: '${{ env.NEW_VERSION }}' | |
PublishJSSDKSnapshot: | |
needs: GenerateVersion | |
if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main') | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Derive the new version | |
run: | | |
echo "new version" | |
NEW_VER=${{ needs.GenerateVersion.outputs.version }}-snapshot-$(git rev-parse --short=7 HEAD) | |
echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV | |
echo $NEW_VER | |
- name: Set npm authentication tokens | |
run: | | |
echo $PATH | |
echo ${{ github.workspace }} | |
echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}' > ~/.npmrc | |
echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc | |
- name: Generate bindings and publish to npm | |
run: | | |
export PATH=$PATH:$GOPATH/bin | |
echo $PATH | |
cd ./cmd/wallet-sdk-js | |
sed -i 's/"version": "[0-9]\+\.[0-9]\+\.[0-9]\+"/"version": "${{ env.NEW_VERSION }}"/g' package.json | |
sed -i 's#"name": "@trustbloc/wallet-sdk"#"name": "@trustbloc-cicd/wallet-sdk-js"#g' package.json | |
sed -i 's#"url": "https://github.com/trustbloc/wallet-sdk.git",#"url": "https://github.com/trustbloc-cicd/snapshot.git"#g' package.json | |
sed -i '/"directory": "cmd\/wallet-sdk-js"/d' package.json | |
pushd ../../ | |
make generate-js-bindings | |
popd | |
npm publish | |
env: | |
DOCKER_USER: ${{ secrets.CR_USER }} | |
GITHUB_TOKEN: ${{ secrets.CR_PAT }} | |
GOPATH: /home/runner/work/wallet-sdk/go | |
PublishDemoAppSnapshot: | |
needs: GenerateVersion | |
if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main') | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 40 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Derive the new version | |
run: | | |
echo "new version" | |
NEW_VER=${{ needs.GenerateVersion.outputs.version }}-snapshot-$(git rev-parse --short=7 HEAD) | |
echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV | |
echo $NEW_VER | |
- name: Set npm authentication tokens | |
run: | | |
echo $PATH | |
echo ${{ github.workspace }} | |
echo '//npm.pkg.github.com/:_authToken=${{ secrets.CR_PAT }}' > ~/.npmrc | |
echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc | |
- name: Install dependencies | |
run: | | |
pushd ./demo/app/web | |
npm install | |
popd | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CR_USER }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and Push container image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./images/demo/app/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
ALPINE_VER=3.18 | |
GO_VER=1.21 | |
push: true | |
tags: | | |
ghcr.io/trustbloc-cicd/wallet-demo-app:${{ env.NEW_VERSION }} |