Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BSR) feat(CI): add e2e pipeline #7562

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/dev_on_schedule_e2e_android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: '0 [on_schedule] Dev on schedule e2e android'

on:
workflow_call:
secrets:
GCP_EHP_SERVICE_ACCOUNT:
required: true
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER:
required: true

permissions:
contents: read
id-token: write

jobs:
maestro-cloud:
runs-on: ubuntu-22.04
steps:
- name: Enable Corepack
run: corepack enable

- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Setup java
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Yarn install
run: yarn install

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Authentification to Google
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}

- name: Get Secret
id: 'secrets'
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
ANDROID_GOOGLE_SERVICES_JSON:passculture-metier-ehp/pc-native-android-google-service-staging
ANDROID_KEYSTORE_STORE_PASSWORD:passculture-metier-ehp/passculture-app-native-android-staging-keystore-store-password
ANDROID_KEYSTORE_KEY_PASSWORD:passculture-metier-ehp/passculture-app-native-android-staging-keystore-key-password
ANDROID_KEYSTORE:passculture-metier-ehp/passculture-app-native-staging-keystore
ROBIN_API_KEY:passculture-metier-ehp/passculture-app-native-e2e-robin-api-key
MAESTRO_PASSWORD:passculture-metier-ehp/passculture-app-native-e2e-maestro-password

- name: Create a directory for keystores
run: mkdir --parents android/keystores/

- name: Setup android keystore for staging environment
run: |
echo '${{ steps.secrets.outputs.ANDROID_KEYSTORE }}' | base64 --decode > android/keystores/staging.keystore

- name: Setup android keystore properties for staging environment
uses: chuhlomin/[email protected]
with:
template: templates_github_ci/staging.keystore.properties
vars: |
ENVIRONMENT: staging
ANDROID_KEYSTORE_STORE_PASSWORD: ${{ steps.secrets.outputs.ANDROID_KEYSTORE_STORE_PASSWORD }}
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ steps.secrets.outputs.ANDROID_KEYSTORE_KEY_PASSWORD }}
result_path: android/keystores/staging.keystore.properties

- name: Setup android Google services config
run: echo '${{ steps.secrets.outputs.ANDROID_GOOGLE_SERVICES_JSON }}' > android/app/google-services.json

- name: Build android apk
run: cd android && ENVFILE=.env.staging ./gradlew assembleDebug

- name: Run Maestro Tests
uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ steps.secrets.outputs.ROBIN_API_KEY }}
project-id: proj_01javz1ncreqb9dcshv3y4da44
app-file: android/app/build/outputs/apk/staging/debug/app-staging-debug.apk
device-locale: fr_FR
android-api-level: 34
workspace: .maestro/tests/
include-tags: cloud
env: |
MAESTRO_APP_ID=app.passculture.staging
MAESTRO_PASSWORD=${{ steps.secrets.outputs.MAESTRO_PASSWORD }}
[email protected]
[email protected]
MAESTRO_UNREGISTERED_EMAIL=dev-tests-unregistered+e2e@passculture.team
MAESTRO_MOCK_ANALYTICS_SERVER=http://localhost:$MOCK_ANALYTICS_SERVER_PORT
MAESTRO_NUMBER_PHONE=0607080910
MAESTRO_RUN_TRACKING_TESTS=false
MAESTRO_RUN_CLOUD_COMMANDS=true
100 changes: 5 additions & 95 deletions .github/workflows/dev_on_workflow_run_e2e_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,99 +8,9 @@ on:
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER:
required: true

permissions:
contents: read
id-token: write

jobs:
maestro-cloud:
runs-on: ubuntu-22.04
outputs:
app: android/app/build/outputs/apk/debug
steps:
- name: Enable Corepack
run: corepack enable
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- uses: pass-culture-github-actions/[email protected]
id: yarn-modules-cache
with:
path: |
node_modules
~/.cache/yarn
key: v1-yarn-dependency-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
v1-yarn-dependency-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
bucket: ${{ inputs.CACHE_BUCKET_NAME }}
workload-identity-provider: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
service-account: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
- name: Yarn install
run: yarn install
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Authentification to Google
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
- name: Get Secret
id: 'secrets'
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
ANDROID_GOOGLE_SERVICES_JSON:passculture-metier-ehp/pc-native-android-google-service-staging
ANDROID_KEYSTORE_STORE_PASSWORD:passculture-metier-ehp/passculture-app-native-android-staging-keystore-store-password
ANDROID_KEYSTORE_KEY_PASSWORD:passculture-metier-ehp/passculture-app-native-android-staging-keystore-key-password
ANDROID_KEYSTORE:passculture-metier-ehp/passculture-app-native-staging-keystore
ROBIN_API_KEY:passculture-metier-ehp/passculture-app-native-e2e-robin-api-key
MAESTRO_PASSWORD:passculture-metier-ehp/passculture-app-native-e2e-maestro-password
- name: Create a directory for keystores
run: |
mkdir --parents android/keystores/
- name: Setup android keystore for staging environment
run: |
echo '${{ steps.secrets.outputs.ANDROID_KEYSTORE }}' | base64 --decode > android/keystores/staging.keystore
- name: Setup android keystore properties for staging environment
uses: chuhlomin/[email protected]
with:
template: templates_github_ci/staging.keystore.properties
vars: |
ENVIRONMENT: staging
ANDROID_KEYSTORE_STORE_PASSWORD: ${{ steps.secrets.outputs.ANDROID_KEYSTORE_STORE_PASSWORD }}
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ steps.secrets.outputs.ANDROID_KEYSTORE_KEY_PASSWORD }}
result_path: android/keystores/staging.keystore.properties
- name: Setup android Google services config
run: echo '${{ steps.secrets.outputs.ANDROID_GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
- name: Build android apk
run: cd android && ENVFILE=.env.staging ./gradlew assembleDebug

- name: Upload APK to Maestro Cloud
uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ steps.secrets.outputs.ROBIN_API_KEY }}
project-id: proj_01javz1ncreqb9dcshv3y4da44
app-file: android/app/build/outputs/apk/staging/debug/app-staging-debug.apk
device-locale: fr_FR
android-api-level: 34
workspace: .maestro/tests/
include-tags: cloud
env: |
MAESTRO_APP_ID=app.passculture.staging
MAESTRO_PASSWORD=${{ steps.secrets.outputs.MAESTRO_PASSWORD }}
[email protected]
[email protected]
MAESTRO_UNREGISTERED_EMAIL=dev-tests-unregistered+e2e@passculture.team
MAESTRO_MOCK_ANALYTICS_SERVER=http://localhost:$MOCK_ANALYTICS_SERVER_PORT
MAESTRO_NUMBER_PHONE=0607080910
MAESTRO_RUN_TRACKING_TESTS=false
MAESTRO_RUN_CLOUD_COMMANDS=true
e2e-tests:
uses: ./.github/workflows/reusable_e2e_android.yml
secrets:
GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
17 changes: 17 additions & 0 deletions .github/workflows/pr_e2e_android.yml
xlecunff-pass marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: '[Daily] Run E2E tests on Android'

on:
schedule:
# 00:00 Paris UTC
xlecunff-pass marked this conversation as resolved.
Show resolved Hide resolved
- cron: '* 22 * * *'

permissions:
contents: read
id-token: write

jobs:
e2e-tests:
uses: ./.github/workflows/reusable_e2e_android.yml
secrets:
GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}