chore: ajout de testIds manquant pour test automatisé (#252) #673
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
name: Native Build & Test | |
env: | |
cacheId: "5" # increment to expire the cache | |
appBuildNumber: ${{ github.run_number }} | |
appBuildVersion: "0.0.4" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main, acceptation, integration, develop] | |
paths: | |
- app/** | |
- .yarn/** | |
- .github/workflows/** | |
pull_request: | |
branches: [main] | |
paths: | |
- app/** | |
- .yarn/** | |
- .github/workflows/** | |
- .gitmodules | |
- package.json | |
- yarn.lock | |
- .yarnrc.yml | |
- .yarn/** | |
jobs: | |
check-secrets: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check secrets | |
shell: bash | |
run: | | |
required_env_vars=( | |
"CERTIFICATE" | |
"KEYCHIAN_PASSWD" | |
"PROVISIONING_PROFILE" | |
"PLAY_STORE_JKS_BASE64" | |
"PLAY_STORE_JKS_ALIAS" | |
"PLAY_STORE_JKS_PASSWD" | |
) | |
for var in "${required_env_vars[@]}"; do | |
if [ -z "${!var}" ]; then | |
echo "error: $var is not set." | |
exit 1 | |
fi | |
done | |
env: | |
CERTIFICATE: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
KEYCHIAN_PASSWD: ${{ secrets.KEYCHIAN_PASSWD }} | |
PROVISIONING_PROFILE: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
PLAY_STORE_JKS_BASE64: ${{ secrets.PLAY_STORE_JKS_BASE64 }} | |
PLAY_STORE_JKS_ALIAS: ${{ secrets.PLAY_STORE_JKS_ALIAS }} | |
PLAY_STORE_JKS_PASSWD: ${{ secrets.PLAY_STORE_JKS_PASSWD }} | |
check-vars: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check variables | |
shell: bash | |
run: | | |
required_env_vars=( | |
"OCA_URL" | |
"MEDIATOR_USE_PUSH_NOTIFICATIONS" | |
) | |
for var in "${required_env_vars[@]}"; do | |
if [ -z "${!var}" ]; then | |
echo "error: $var is not set." | |
exit 1 | |
fi | |
done | |
env: | |
OCA_URL: ${{ vars.OCA_URL }} | |
MEDIATOR_USE_PUSH_NOTIFICATIONS: ${{vars.MEDIATOR_USE_PUSH_NOTIFICATIONS }} | |
build-ios: | |
needs: [check-secrets, check-vars] | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Setup NodeJS | |
uses: ./.github/workflows/actions/setup-node | |
- name: Configure ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
working-directory: ./app | |
- name: What XCode are we using? | |
run: | | |
find /Applications -type d -maxdepth 1 -iname 'xcode*.app' | |
sudo xcode-select --switch /Applications/Xcode_15.2.app | |
sudo xcode-select -p | |
- name: Cached pip dependencies | |
uses: actions/cache@v4 | |
id: pip-cache | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache pod dependencies | |
id: pod-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
app/ios/Pods | |
~/Library/Caches/CocoaPods | |
~/.cocoapods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Restore cached derived data | |
id: cache-dd-restore | |
uses: actions/cache/restore@v4 | |
with: | |
path: app/ios/xbuild/Build | |
key: ${{ runner.os }}-dd-xcode | |
- name: Install dependencies | |
working-directory: ./ | |
run: | | |
yarn install --immutable && \ | |
git status | |
- name: Install iOS dependencies | |
# if: steps.pod-cache.outputs.cache-hit != 'true' || steps.npm-cache.outputs.cache-hit != 'true' | |
working-directory: app | |
run: | | |
yarn run ios:setup && \ | |
git status && \ | |
git diff ios/Podfile.lock | |
- name: Bump Build No. | |
working-directory: app/ios | |
env: | |
CURRENT_PROJECT_VERSION: ${{ env.appBuildNumber }} | |
MARKETING_VERSION: ${{ env.appBuildVersion }} | |
run: | | |
agvtool new-version ${CURRENT_PROJECT_VERSION} && \ | |
agvtool new-marketing-version ${MARKETING_VERSION} | |
# Actual environment variables are not being picked up | |
# by the build so they're put into an .env file. | |
- name: Create environment settings | |
# if: env.CQEN_MEDIATOR_URL != null && env.OCA_URL != null && env.MEDIATOR_URL != null | |
working-directory: app | |
env: | |
MEDIATOR_USE_PUSH_NOTIFICATIONS: ${{ vars.MEDIATOR_USE_PUSH_NOTIFICATIONS }} | |
MEDIATOR_URL: ${{ secrets.MEDIATOR_URL }} | |
MEDIATOR_URL_DEV: ${{ secrets.MEDIATOR_URL_DEV }} | |
OCA_URL: ${{ vars.OCA_URL }} | |
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | |
run: | | |
BRANCH_NAME="${{ github.ref_name }}" | |
echo "MEDIATOR_USE_PUSH_NOTIFICATIONS=${MEDIATOR_USE_PUSH_NOTIFICATIONS}" >.env | |
echo "MEDIATOR_URL=${MEDIATOR_URL}" >>.env | |
echo "MEDIATOR_URL_DEV=${MEDIATOR_URL_DEV}" >>.env | |
echo "OCA_URL=${OCA_URL}" >>.env | |
if [[ "$BRANCH_NAME" == "main" ]]; then | |
echo "ENVIRONMENT=PRODUCTION" >>.env | |
elif [[ "$BRANCH_NAME" == "acceptation" ]]; then | |
echo "ENVIRONMENT=ACCEPTATION" >>.env | |
elif [[ "$BRANCH_NAME" == "integration" ]]; then | |
echo "ENVIRONMENT=INTEGRATION" >>.env | |
else | |
echo "ENVIRONMENT=${ENVIRONMENT}" >>.env | |
fi | |
- name: Update APS environment | |
working-directory: app/ios/AriesBifold | |
run: | | |
sed -i '' 's/development/production/g' AriesBifold.entitlements | |
cat AriesBifold.entitlements | |
- name: Create prod signing credentials | |
uses: ./.github/workflows/actions/create-ios-sig-creds | |
with: | |
certificate: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
certificate_password: ${{ secrets.KEYCHIAN_PASSWD }} | |
provisioning_profile: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
- name: Archive build | |
working-directory: app/ios | |
run: | | |
xcodebuild \ | |
-workspace AriesBifold.xcworkspace \ | |
-scheme AriesBifold \ | |
-allowProvisioningUpdates \ | |
-configuration Release \ | |
-xcconfig ../../release.xcconfig \ | |
-derivedDataPath xbuild \ | |
-archivePath ../../AriesBifold.xcarchive \ | |
-sdk iphoneos \ | |
-verbose \ | |
archive | |
- name: Save cache for derived data | |
id: cache-dd-save | |
uses: actions/cache/save@v4 | |
with: | |
path: app/ios/xbuild/Build | |
key: ${{ steps.cache-dd-restore.outputs.cache-primary-key }} | |
- name: Export production archive | |
uses: ./.github/workflows/actions/export-ios-archive | |
with: | |
export_options: options.plist | |
ouput_artifact_ref: ios-artifact | |
- name: Ship to iTunes | |
if: github.ref_name == 'main' || github.ref_name == 'acceptation' || github.ref_name == 'integration' || github.ref_name == 'develop' | |
uses: ./.github/workflows/actions/ship-to-itunes | |
with: | |
app_store_connect_issuer_id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} | |
app_store_connect_key_identifier: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }} | |
app_store_connect_private_key: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_95 }} | |
version_code: ${{ env.appBuildNumber }} | |
version_name: ${{ env.appBuildVersion }} | |
branch_name: ${{ github.ref_name }} | |
build-android: | |
needs: [check-secrets, check-vars] | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Setup NodeJS | |
uses: ./.github/workflows/actions/setup-node | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: 11 | |
cache: "gradle" | |
server-id: github | |
settings-path: ${{ github.workspace }} | |
- name: Install dependencies | |
working-directory: ./ | |
run: | | |
yarn install --immutable && \ | |
git status | |
# Actual environment variables are not being picked up | |
# by the build so they're put into an .env file. | |
- name: Create environment settings | |
working-directory: app | |
env: | |
MEDIATOR_USE_PUSH_NOTIFICATIONS: ${{ vars.MEDIATOR_USE_PUSH_NOTIFICATIONS }} | |
MEDIATOR_URL: ${{ secrets.MEDIATOR_URL }} | |
MEDIATOR_URL_DEV: ${{ secrets.MEDIATOR_URL_DEV }} | |
OCA_URL: ${{ vars.OCA_URL }} | |
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | |
run: | | |
echo "MEDIATOR_USE_PUSH_NOTIFICATIONS=${MEDIATOR_USE_PUSH_NOTIFICATIONS}" >.env | |
echo "MEDIATOR_URL=${MEDIATOR_URL}" >>.env | |
echo "MEDIATOR_URL_DEV=${MEDIATOR_URL_DEV}" >>.env | |
echo "OCA_URL=${OCA_URL}" >>.env | |
if [[ "$BRANCH_NAME" == "main" ]]; then | |
echo "ENVIRONMENT=PRODUCTION" >>.env | |
elif [[ "$BRANCH_NAME" == "acceptation" ]]; then | |
echo "ENVIRONMENT=ACCEPTATION" >>.env | |
elif [[ "$BRANCH_NAME" == "integration" ]]; then | |
echo "ENVIRONMENT=INTEGRATION" >>.env | |
else | |
echo "ENVIRONMENT=${ENVIRONMENT}" >>.env | |
fi | |
- name: Create release keystore | |
working-directory: app/android/app | |
env: | |
PLAY_STORE_JKS_BASE64: ${{ secrets.PLAY_STORE_JKS_BASE64 }} | |
PLAY_STORE_JKS_ALIAS: ${{ secrets.PLAY_STORE_JKS_ALIAS }} | |
PLAY_STORE_JKS_PASSWD: ${{ secrets.PLAY_STORE_JKS_PASSWD }} | |
run: | | |
echo "${PLAY_STORE_JKS_BASE64}" | base64 -d >release.keystore && \ | |
keytool -list -v -keystore release.keystore -alias ${PLAY_STORE_JKS_ALIAS} -storepass:env PLAY_STORE_JKS_PASSWD | \ | |
grep "SHA1" | |
# - name: Android debug build | |
# if: github.ref_name != 'main' || needs.check-android-secrets.outputs.isReleaseBuild != 'true' | |
# working-directory: app/android | |
# env: | |
# VERSION_CODE: ${{ env.appBuildNumber }} | |
# VERSION_NAME: ${{ env.appBuildVersion }} | |
# run: | | |
# ./gradlew --no-daemon bundleRelease | |
- name: Android release build | |
working-directory: app/android | |
env: | |
PLAY_STORE_JKS_ALIAS: ${{ secrets.PLAY_STORE_JKS_ALIAS }} | |
PLAY_STORE_JKS_PASSWD: ${{ secrets.PLAY_STORE_JKS_PASSWD }} | |
VERSION_CODE: ${{ env.appBuildNumber }} | |
VERSION_NAME: ${{ env.appBuildVersion }} | |
run: | | |
( cd ../ && npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --verbose ) && \ | |
./gradlew bundleRelease && \ | |
./gradlew assembleRelease && \ | |
find . -type f -name '*.apk' | |
# - name: Publish to GitHub Packages Registry | |
# run: mvn deploy:deploy-file -s $GITHUB_WORKSPACE/settings.xml -DgroupId=com.github.bcgov -DartifactId=bc-wallet -Dclassifier=android -DrepositoryId=github -Durl=https://maven.pkg.github.com/$GITHUB_REPOSITORY -Dversion=${{ env.appBuildVersion }}.${{ env.appBuildNumber }} -DgeneratePom=false -Dpackaging=aab -Dfile=app/android/app/build/outputs/bundle/release/app-release.aab | |
# env: | |
# GITHUB_TOKEN: ${{ github.token }} | |
- name: List Artifacts | |
run: | | |
find . -type f -name '*.apk' | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android | |
path: | | |
app/android/app/build/outputs/bundle/release/app-release.aab | |
app/android/app/build/outputs/apk/release/app-release.apk | |
- name: Upload Android artifact | |
if: github.ref_name == 'main' || github.ref_name == 'acceptation' || github.ref_name == 'integration' || github.ref_name == 'develop' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-artifact | |
path: app/android/app/build/outputs/bundle/release/app-release.aab | |
if-no-files-found: error | |
retention-days: 7 | |
- name: Ship to Google Play | |
if: github.ref_name == 'main' || github.ref_name == 'acceptation' || github.ref_name == 'integration' || github.ref_name == 'develop' | |
working-directory: app/ | |
env: | |
GOOGLE_API_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_API_CREDENTIALS_BASE64 }} | |
GOOGLE_API_CREDENTIALS: "api_keys.json" | |
ANDROID_BUNDLE_PATH: "./android/app/build/outputs/bundle/release/app-release.aab" | |
ANDROID_PACKAGE_NAME: "ca.qc.gouv.portefeuillemobileqc" | |
VERSION_CODE: ${{ env.appBuildNumber }} | |
VERSION_NAME: ${{ env.appBuildVersion }} | |
BRANCHE_NAME: ${{ github.ref_name }} | |
run: | | |
# when we updated to yarn we started getting an error with paths | |
# and had to add `/android` to the path. | |
# when we updated to yarn we started getting an error with paths | |
# and had to add `/android` to the path. | |
echo "${GOOGLE_API_CREDENTIALS_BASE64}" | base64 -d >${GOOGLE_API_CREDENTIALS} && \ | |
node ./deploy-to-playstore.js | |
release: | |
if: github.ref_name == 'main' | |
needs: [build-ios, build-android] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create release | |
uses: actions/create-release@v1.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.appBuildVersion }}-${{ env.appBuildNumber }} | |
release_name: Version ${{ env.appBuildVersion }}-${{ env.appBuildNumber }} | |
body: | | |
Dev Release. | |
ship-to-lambdatest: | |
if: github.ref_name == 'main' | |
needs: [build-ios, build-android] | |
runs-on: ubuntu-22.04 | |
outputs: | |
IOS_APP_URL: ${{ steps.upload-app-ios.outputs.IOS_APP_URL }} | |
ANDROID_APP_URL: ${{ steps.upload-app-android.outputs.ANDROID_APP_URL }} | |
steps: | |
- name: Download iOS artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ios-artifact | |
- name: Download Android artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: android-artifact | |
- name: Ship iOS to LambdaTest | |
env: | |
LAMBDA_USERNAME: ${{ secrets.LAMBDA_USERNAME }} | |
LAMBDA_ACCESS_KEY: ${{ secrets.LAMBDA_ACCESS_KEY }} | |
id: upload-app-ios | |
run: | | |
curl \ | |
-u "$LAMBDA_USERNAME:$LAMBDA_ACCESS_KEY" \ | |
--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \ | |
--form 'appFile=@"AriesBifold.ipa"' \ | |
--form "name=QCWallet-$GITHUB_RUN_NUMBER.ipa" > $HOME/lt_ios_resp.json | |
echo "IOS_APP_URL=lt://$(jq -r '.app_id' $HOME/lt_ios_resp.json)" >> "$GITHUB_OUTPUT" | |
- name: Ship Android to LambdaTest | |
env: | |
LAMBDA_USERNAME: ${{ secrets.LAMBDA_USERNAME }} | |
LAMBDA_ACCESS_KEY: ${{ secrets.LAMBDA_ACCESS_KEY }} | |
id: upload-app-android | |
run: | | |
curl \ | |
-u "$LAMBDA_USERNAME:$LAMBDA_ACCESS_KEY" \ | |
--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \ | |
--form 'appFile=@"app-release.aab"' \ | |
--form "name=QCWallet-$GITHUB_RUN_NUMBER.aab" > $HOME/lt_android_resp.json | |
echo "ANDROID_APP_URL=lt://$(jq -r '.app_id' $HOME/lt_android_resp.json)" >> "$GITHUB_OUTPUT" | |
run-on-device-tests: | |
if: github.ref_name == 'main' | |
needs: [ship-to-lambdatest] | |
runs-on: ubuntu-22.04 | |
strategy: | |
max-parallel: 1 | |
fail-fast: false | |
matrix: | |
include: | |
- mobile-platform: "-p Android" | |
app-file-name: "-a ${{ needs.ship-to-lambdatest.outputs.ANDROID_APP_URL }}" | |
build-name: "-b QCWallet-${{ github.run_number }}-Android" | |
report-project: "android-multi-device-full" | |
- mobile-platform: "-p iOS" | |
app-file-name: "-a ${{ needs.ship-to-lambdatest.outputs.IOS_APP_URL }}" | |
build-name: "-b QCWallet-${{ github.run_number }}-iOS" | |
report-project: "ios-multi-device-full" | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: run-aath-agents | |
if: ${{ matrix.mobile-platform=='-p iOS' }} | |
uses: ./.github/workflows/actions/run-aath-agents | |
with: | |
USE_NGROK: "" | |
- name: run-aath-agents-ngrok | |
if: ${{ matrix.mobile-platform=='-p Android' }} | |
uses: ./.github/workflows/actions/run-aath-agents | |
with: | |
USE_NGROK: "-n" | |
# - name: run-lambdatest-connect-tunnel | |
# if: ${{ matrix.mobile-platform=='-p iOS' }} | |
# uses: LambdaTest/LambdaTest-tunnel-action@v1 | |
# with: | |
# user: ${{ secrets.LAMBDA_USERNAME }} | |
# accessKey: ${{ secrets.LAMBDA_ACCESS_KEY }} | |
# tunnelName: "PortefeuilleQC-Tunnel-${{ github.run_number }}" | |
- name: Fetch mobile test harness repo | |
uses: actions/checkout@v2 | |
with: | |
repository: MCN-ING/aries-mobile-test-harness | |
path: aries-mobile-test-harness | |
ref: main | |
- name: Run LambdaTest all tests | |
uses: ./.github/workflows/actions/run-test-harness | |
env: | |
LEDGER_URL_CONFIG: "http://test.bcovrin.vonx.io" | |
REGION: "us-west-1" | |
with: | |
MOBILE_WALLET: "-w qc_wallet" | |
ISSUER_AGENT: '-i "AATH;http://0.0.0.0:9020"' | |
VERIFIER_AGENT: '-v "AATH;http://0.0.0.0:9030"' | |
DEVICE_CLOUD: "-d LambdaTest" | |
DEVICE_CLOUD_USER: "-u ${{ secrets.LAMBDA_USERNAME }}" | |
DEVICE_CLOUD_KEY: "-k ${{ secrets.LAMBDA_ACCESS_KEY }}" | |
MOBILE_PLATFORM: ${{ matrix.mobile-platform }} | |
APP_FILE_NAME: ${{ matrix.app-file-name }} | |
BUILD_NAME: ${{ matrix.build-name }} | |
TEST_SCOPE: "-t @qc_wallet -t ~@wip -t ~@qc_wallet_not" | |
REPORT_PROJECT: ${{ matrix.report-project }} | |
# - name: Upload smoke-test results to Allure | |
# if: ${{ always() }} | |
# uses: ./.github/workflows/actions/run-send-gen-test-results-secure | |
# with: | |
# REPORT_PROJECT: ${{ matrix.report-project }} | |
# ADMIN_USER: ${{ secrets.ALLURE_USERNAME }} | |
# ADMIN_PW: ${{ secrets.ALLURE_PASSWD }} |