Skip to content

Commit

Permalink
Merge branch 'main' into repo-mountie/add-compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
nodlesh authored Jul 26, 2023
2 parents 45d788d + a6e3baf commit 905a430
Show file tree
Hide file tree
Showing 172 changed files with 11,069 additions and 837 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/bc_wallet/get_sl_apps_uploaded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from ast import Raise
import os
import json
import requests
import os
import sys
from pathlib import Path

# exit if not enough arguments passed to script
if len(sys.argv) != 6:
raise Exception(
"Incorrect argument passed to script. Usage: python .github/workflows/bc_wallet/get_sl_apps_uploaded.py <Sauce Labs User> <Suace Labs Key> <Platform> <Sauce Labs Region> <Latest App File eg .github/workflows/bc_wallet/latest_app.json>"
)

# Assign script parameters
sl_user = sys.argv[1]
sl_key = sys.argv[2]
platform = sys.argv[3]
sl_region = sys.argv[4]
local_latest_app_json_filename = sys.argv[5]


def find_latest_app(resp_json, platfrom):
latest_app = None
for item in resp_json["items"]:
if latest_app == None or item['upload_timestamp'] > latest_app['upload_timestamp']:
latest_app = item
return latest_app

# call api to get app json
resp = requests.get(f'https://api.{sl_region}.saucelabs.com/v1/storage/files', auth=(sl_user, sl_key))
resp_json = resp.json()

# traverse app json to get the lastest upload_timestamp for the platform(kind)
if resp.status_code == 200:
latest_app_json = find_latest_app(resp_json, platform)
else:
raise Exception(f"There was a problem getting the list of available apps in Sauce Labs: {resp_json}")

local_latest_app_json_file = Path(local_latest_app_json_filename)
local_latest_app_json_file.touch(exist_ok=True)
if os.stat(local_latest_app_json_filename).st_size != 0: # Local json file is not new
with open(local_latest_app_json_file) as infile:
local_latest_app_file_json = json.load(infile)
if latest_app_json['upload_timestamp'] > local_latest_app_file_json['upload_timestamp']:
# Save the file
with open(local_latest_app_json_filename, 'w') as outfile:
#outfile.write(json.dumps(infile))
print('true')
file_name, ext = os.path.splitext(latest_app_json['name'])
print(file_name)
json.dump(latest_app_json, outfile)
else:
print('false')
else: # Local json file is new, just use the latest app found
with open(local_latest_app_json_filename, 'w') as outfile:
print('true')
file_name, ext = os.path.splitext(latest_app_json['name'])
print(file_name)
json.dump(latest_app_json, outfile)
1 change: 1 addition & 0 deletions .github/workflows/bc_wallet/latest_app.json

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: BC WALLET RUN ALL TESTS ON ALL DEVICES

on:
# repository dispatch: if could be triggered from bc wallet repo then wait for midnight, don't think we can wait.
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # every day at midnight

jobs:
check-app-updated:
runs-on: ubuntu-latest
outputs:
APP_IS_NEW: ${{ steps.check-app-updated-on-sl.outputs.APP_IS_NEW }}
NEW_APP_NAME: ${{ steps.check-app-updated-on-sl.outputs.NEW_APP_NAME }}
steps:
- name: checkout-test-harness
uses: actions/checkout@v2
- name: check-app-updated-on-sl
id: check-app-updated-on-sl
run: |
output=($(python .github/workflows/bc_wallet/get_sl_apps_uploaded.py ${{ secrets.SAUCE_USERNAME }} ${{ secrets.SAUCE_ACCESS_KEY }} Android us-west-1 .github/workflows/bc_wallet/latest_app.json ))
echo ${output[@]}
echo ${output[0]}
echo ${output[1]}
echo "::set-output name=APP_IS_NEW::${output[0]}"
echo "::set-output name=NEW_APP_NAME::${output[1]}"
run-on-device-tests:
needs: [check-app-updated]
#needs: [check-app-updated-ios, check-app-updated-android]
if: ${{ needs.check-app-updated.outputs.APP_IS_NEW }} == 'true'
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
include:
- mobile-platform: "-p Android"
app-file-name: "-a ${{ needs.check-app-updated.outputs.NEW_APP_NAME }}.aab"
report-project: "android-multi-device-full"
- mobile-platform: "-p iOS"
app-file-name: "-a ${{ needs.check-app-updated.outputs.NEW_APP_NAME }}.ipa"
report-project: "ios-multi-device-full"
- mobile-platform: "-p Android"
app-file-name: "-a ${{ needs.check-app-updated.outputs.NEW_APP_NAME }}.aab"
report-project: "candy-uvp-pcft-chat-android"
- mobile-platform: "-p iOS"
app-file-name: "-a ${{ needs.check-app-updated.outputs.NEW_APP_NAME }}.ipa"
report-project: "candy-uvp-pcft-chat-ios"
- mobile-platform: "-p Android"
app-file-name: "-a ${{ needs.check-app-updated.outputs.NEW_APP_NAME }}.aab"
report-project: "bc-digital-id-android"
- mobile-platform: "-p iOS"
app-file-name: "-a ${{ needs.check-app-updated.outputs.NEW_APP_NAME }}.ipa"
report-project: "bc-digital-id-ios"
#timeout-minutes: 60
steps:
- uses: actions/checkout@v2

- name: run-aath-agents
if: ${{ matrix.mobile-platform=='-p iOS' && !contains(matrix.report-project,'candy-uvp-pcft-chat') }}
uses: ./.github/workflows/run-aath-agents
with:
LEDGER_URL_CONFIG: "http://test.bcovrin.vonx.io"
USE_NGROK: ""

- name: run-aath-agents-ngrok
if: ${{ matrix.mobile-platform=='-p Android' && !contains(matrix.report-project,'candy-uvp-pcft-chat') }}
uses: ./.github/workflows/run-aath-agents
with:
LEDGER_URL_CONFIG: "http://test.bcovrin.vonx.io"
USE_NGROK: "-n"

- name: run-aath-verifier-agent
if: ${{ matrix.mobile-platform=='-p iOS' && contains(matrix.report-project,'candy-uvp-pcft-chat') }}
uses: ./.github/workflows/run-aath-agents
with:
TEST_AGENTS: "-b acapy-main"
GENESIS_URL: "https://raw.githubusercontent.com/ICCS-ISAC/dtrust-reconu/main/CANdy/test/pool_transactions_genesis"
AGENT_CONFIG_FILE: "/aries-backchannels/acapy/read_only_ledger_verifier_config.yaml"
USE_NGROK: ""

- name: run-aath-verifier-agent-ngrok
if: ${{ matrix.mobile-platform=='-p Android' && contains(matrix.report-project,'candy-uvp-pcft-chat') }}
uses: ./.github/workflows/run-aath-agents
with:
TEST_AGENTS: "-b acapy-main"
GENESIS_URL: "https://raw.githubusercontent.com/ICCS-ISAC/dtrust-reconu/main/CANdy/test/pool_transactions_genesis"
AGENT_CONFIG_FILE: "/aries-backchannels/acapy/read_only_ledger_verifier_config.yaml"
USE_NGROK: "-n"

- name: run-sauce-connect-tunnel
if: ${{ matrix.mobile-platform=='-p iOS' && !contains(matrix.report-project,'candy-uvp-pcft-chat') }}
uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
directDomains: aries-mediator-agent.vonx.io

# tunnelIdentifier: github-action-tunnel
# region: us-west-1

# - name: Saucectl RUN Docker and Cloud
# uses: saucelabs/saucectl-run-action@v1
# env:
# SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
# SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
# with:
# testing-environment: ""
# concurrency: 10

# - name: run-sauce-connect-tunnel
# run: |
# docker run \
# -e SAUCE_USERNAME=${{ secrets.SAUCE_USERNAME }} \
# -e SAUCE_ACCESS_KEY=${{ secrets.SAUCE_ACCESS_KEY }} \
# --network="host" \
# --detach \
# saucelabs/sauce-connect

- name: Run AMTH All Tests
if: ${{ contains(matrix.report-project,'multi-device-full') }}
uses: ./.github/workflows/run-test-harness
env:
LEDGER_URL_CONFIG: "http://test.bcovrin.vonx.io"
REGION: "us-west-1"
#TEST_RETRY_ATTEMPTS_OVERRIDE: "2"
with:
MOBILE_WALLET: "-w bc_wallet"
ISSUER_AGENT: '-i "AATH;http://0.0.0.0:9020"'
VERIFIER_AGENT: '-v "AATH;http://0.0.0.0:9030"'
DEVICE_CLOUD: "-d SauceLabs"
DEVICE_CLOUD_USER: "-u ${{ secrets.SAUCE_USERNAME }}"
DEVICE_CLOUD_KEY: "-k ${{ secrets.SAUCE_ACCESS_KEY }}"
MOBILE_PLATFORM: ${{ matrix.mobile-platform }}
APP_FILE_NAME: ${{ matrix.app-file-name }}
TEST_SCOPE: "-t @bc_wallet -t ~@wip -t ~@Connectionless -t ~@BCSC"
REPORT_PROJECT: ${{ matrix.report-project }}
continue-on-error: true

# - name: Shutdown Sauce Connect Tunnel
# if: ${{ matrix.mobile-platform=='-p iOS' }}
# run: |
# docker ps \
# --format '{{.ID}} {{.Image}}' | \
# grep saucelabs/sauce-connect | \
# awk '{print $1}' | \
# xargs docker stop

- name: Run AMTH BC Wallet Connectionless Tests
if: ${{ contains(matrix.report-project,'candy-uvp-pcft-chat') }}
uses: ./.github/workflows/run-test-harness
env:
REGION: "us-west-1"
#TEST_RETRY_ATTEMPTS_OVERRIDE: "2"
with:
MOBILE_WALLET: "-w bc_wallet"
ISSUER_AGENT: '-i "CANdy_UVP;https://openvp-candy-issuer-test.apps.silver.devops.gov.bc.ca/"'
VERIFIER_AGENT: '-v "AATH;http://0.0.0.0:9030"'
DEVICE_CLOUD: "-d SauceLabs"
DEVICE_CLOUD_USER: "-u ${{ secrets.SAUCE_USERNAME }}"
DEVICE_CLOUD_KEY: "-k ${{ secrets.SAUCE_ACCESS_KEY }}"
MOBILE_PLATFORM: ${{ matrix.mobile-platform }}
APP_FILE_NAME: ${{ matrix.app-file-name }}
TEST_SCOPE: "-t @bc_wallet -t @Connectionless -t ~@wip -t ~@BCSC"
REPORT_PROJECT: ${{ matrix.report-project }}
continue-on-error: true

- name: Run AMTH BC Wallet BC Digital ID Tests
#if: ${{ matrix.report-project=='bc-digital-id-ios' || matrix.report-project=='bc-digital-id-android' }}
if: ${{ contains(matrix.report-project,'bc-digital-id') }}
uses: ./.github/workflows/run-test-harness
env:
REGION: "us-west-1"
BC_VP_USERNAME: ${{ secrets.BC_VP_USERNAME }}
BC_VP_PASSWORD: ${{ secrets.BC_VP_PASSWORD }}
BC_VP_HOLDER_EMAIL: ${{ secrets.BC_VP_HOLDER_EMAIL }}
BC_VP_HOLDER_EMAIL_PASSWORD: ${{ secrets.BC_VP_HOLDER_EMAIL_PASSWORD }}
BCSC_ACCOUNT_USER: ${{ secrets.BCSC_ACCOUNT_USER }}
BCSC_ACCOUNT_PASSWORD: ${{ secrets.BCSC_ACCOUNT_PASSWORD }}
# GOOGLE_API_TOKEN: ${{ secrets.GOOGLE_API_TOKEN }}
# GOOGLE_API_CREDENTIALS: ${{ secrets.GOOGLE_API_CREDENTIALS }}
#TEST_RETRY_ATTEMPTS_OVERRIDE: "2"
with:
MOBILE_WALLET: "-w bc_wallet"
ISSUER_AGENT: '-i "BC_VP;https://bcvcpilot-issuer-admin-test.apps.silver.devops.gov.bc.ca"'
VERIFIER_AGENT: '-v "AATH;http://0.0.0.0:9030"'
DEVICE_CLOUD: "-d SauceLabs"
DEVICE_CLOUD_USER: "-u ${{ secrets.SAUCE_USERNAME }}"
DEVICE_CLOUD_KEY: "-k ${{ secrets.SAUCE_ACCESS_KEY }}"
MOBILE_PLATFORM: ${{ matrix.mobile-platform }}
APP_FILE_NAME: ${{ matrix.app-file-name }}
TEST_SCOPE: "-t @bc_wallet -t @BCSC -t ~@wip"
REPORT_PROJECT: ${{ matrix.report-project }}
continue-on-error: true

- name: Upload AMTH All Test results to Allure
uses: ./.github/workflows/run-send-gen-test-results-secure
with:
REPORT_PROJECT: ${{ matrix.report-project }}
ADMIN_USER: ${{ secrets.ALLURE_USERNAME }}
ADMIN_PW: ${{ secrets.ALLURE_PASSWD }}
58 changes: 58 additions & 0 deletions .github/workflows/run-aath-agents/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Run aath-agents"
description: "Build and run aries agent test harness agents"
author: "[email protected]"
inputs:
BUILD_AGENTS:
description: "Agent Frameworks to build"
required: true
default: "-a acapy-main"
TEST_AGENTS:
description: "Agent Frameworks to run"
required: true
default: "-a acapy-main -b acapy-main"
LEDGER_URL_CONFIG:
description: "Ledger to use"
required: false
GENESIS_URL:
description: "Ledger to use"
required: false
TAILS_SERVER_URL_CONFIG:
description: "Tails Server to use"
required: false
default: "https://tails.vonx.io"
AGENT_CONFIG_FILE:
description: "Customized agent args to use"
required: true
default: "/aries-backchannels/acapy/auto_issuer_config.yaml"
USE_NGROK:
description: "Use NGROK Tunnel"
required: false
default: "-n"
runs:
using: "composite"
steps:
- name: checkout-aath
run: git clone https://github.com/hyperledger/aries-agent-test-harness.git
shell: bash
- name: build-aath-agents
run: ./manage build ${{ inputs.BUILD_AGENTS }}
shell: bash
working-directory: aries-agent-test-harness
- name: run-aath-agents
run: |
if [[ -n "${{ inputs.GENESIS_URL }}" ]]; then
GENESIS_URL=${{ inputs.GENESIS_URL }} TAILS_SERVER_URL_CONFIG=${{ inputs.TAILS_SERVER_URL_CONFIG }} AGENT_CONFIG_FILE=${{ inputs.AGENT_CONFIG_FILE }} ./manage start ${{ inputs.TEST_AGENTS }} ${{ inputs.USE_NGROK }}
elif [[ -n "${{ inputs.LEDGER_URL_CONFIG }}" ]]; then
LEDGER_URL_CONFIG=${{inputs.LEDGER_URL_CONFIG}} TAILS_SERVER_URL_CONFIG=${{inputs.TAILS_SERVER_URL_CONFIG}} AGENT_CONFIG_FILE=${{inputs.AGENT_CONFIG_FILE}} ./manage start ${{inputs.TEST_AGENTS}} ${{inputs.USE_NGROK}}
else
echo "Neither LEDGER_URL_CONFIG nor GENESIS_URL provided."
fi
shell: bash
working-directory: aries-agent-test-harness
- name: shut-down-uniresolver
run: ./manage service stop uniresolver
shell: bash
working-directory: aries-agent-test-harness
branding:
icon: "cloud-lightning"
color: "blue"
34 changes: 34 additions & 0 deletions .github/workflows/run-send-gen-test-results-secure/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Run Send Generate Test Results"
description: "Run the send-results script to push raw test results to the Allure server"
author: "[email protected]"
inputs:
RESULTS_LOCATION:
description: "Location of the raw test results generated by Allure"
required: true
default: "allure-results"
ALLURE_SERVER:
description: "URL of the Allure Service"
required: true
default: "https://allure-mobile.vonx.io/api"
REPORT_PROJECT:
description: "Name of the project the Allure Service is using to store these results"
required: true
default: "acapy"
ADMIN_USER:
description: "Username of the Allure Adminstrator"
required: true
ADMIN_PW:
description: "Password of the Allure Adminstrator"
required: true
runs:
using: "composite"
steps:
- name: run-send-gen-test-results-secure
#working-directory: aries-mobile-test-harness
run: ./aries-mobile-tests/allure/send_results_secure.sh ${{ inputs.RESULTS_LOCATION }} ${{ inputs.ALLURE_SERVER }} -p ${{ inputs.REPORT_PROJECT }} ${{ inputs.ADMIN_USER }} ${{ inputs.ADMIN_PW }}
shell: bash
env:
NO_TTY: "1"
branding:
icon: "mic"
color: "purple"
Loading

0 comments on commit 905a430

Please sign in to comment.