Skip to content

m147_test release #5049

m147_test release

m147_test release #5049

Workflow file for this run

name: CI Tests
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- master
jobs:
determine_changed:
name: "Determine changed modules"
runs-on: ubuntu-22.04
if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request'
outputs:
modules: ${{ steps.changed-modules.outputs.modules }}
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- id: changed-modules
run: |
git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json
echo modules=$(cat modules.json) >> $GITHUB_OUTPUT
unit_tests:
name: "Unit Tests"
runs-on: ubuntu-22.04
needs:
- determine_changed
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.determine_changed.outputs.modules) }}
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Add google-services.json
env:
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }}
run: |
echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json
- name: ${{ matrix.module }} Unit Tests
env:
FIREBASE_CI: 1
run: |
./gradlew ${{matrix.module}}:check withErrorProne
- name: Upload Test Results
uses: actions/upload-artifact@v3
if: always()
with:
name: Unit Test Results
path: "**/build/test-results/**/*.xml"
# A job that fails if any job in the unit_tests matrix fails,
# to be used as a required check for merging.
check_all:
runs-on: ubuntu-22.04
if: always()
name: Unit Tests (matrix)
needs: unit_tests
steps:
- name: Check test matrix
if: needs.unit_tests.result != 'success'
run: exit 1
integ_tests:
name: "Instrumentation Tests"
# only run on post submit or PRs not originating from forks.
if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-22.04
needs:
- determine_changed
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.determine_changed.outputs.modules) }}
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Add google-services.json
env:
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }}
run: |
echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
- name: ${{ matrix.module }} Integ Tests
env:
FIREBASE_CI: 1
FTL_RESULTS_BUCKET: android-ci
FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}}
FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }}
run: |
./gradlew ${{matrix.module}}:deviceCheck withErrorProne -PtargetBackend="prod"
firestore_custom_integ_tests:
name: "Firestore Custom Instrumentation Tests Against Named DB"
runs-on: ubuntu-22.04
needs:
- determine_changed
# only run on post submit or PRs not originating from forks.
if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore')
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Add google-services.json
env:
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }}
run: |
echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
# create composite indexes with Terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Terraform Init
run: |
cd firebase-firestore
terraform init
continue-on-error: true
- name: Terraform Apply
if: github.event_name == 'pull_request'
run: |
cd firebase-firestore
# Define a temporary file, redirect both stdout and stderr to the file
output_file=$(mktemp)
if ! terraform apply -var-file=../google-services.json -auto-approve > "$output_file" 2>&1 ; then
cat "$output_file"
if cat "$output_file" | grep -q "index already exists"; then
echo "==================================================================================="
echo -e "\e[93m\e[1mTerraform apply failed due to index already exists; We can safely ignore this error.\e[0m"
echo "==================================================================================="
fi
exit 1
fi
rm -f "$output_file"
continue-on-error: true
- name: Firestore Named DB Integ Tests
env:
FIREBASE_CI: 1
FTL_RESULTS_BUCKET: android-ci
FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}}
FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }}
run: |
./gradlew firebase-firestore:deviceCheck withErrorProne -PtargetBackend="prod" -PtargetDatabaseId="test-db"
firestore_nightly_integ_tests:
name: "Firestore Instrumentation Tests Against Nightly Environment"
runs-on: ubuntu-22.04
needs:
- determine_changed
# only run on post submit or PRs not originating from forks.
if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore')
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Add google-services.json
env:
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.NIGHTLY_INTEG_TESTS_GOOGLE_SERVICES }}
run: |
echo $INTEG_TESTS_GOOGLE_SERVICES > google-services.json
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
- name: Firestore Nightly Integ Tests
env:
FIREBASE_CI: 1
FTL_RESULTS_BUCKET: android-ci
FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}}
FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }}
run: |
./gradlew firebase-firestore:deviceCheck withErrorProne -PtargetBackend="nightly"
publish-test-results:
name: "Publish Tests Results"
needs:
- unit_tests
runs-on: ubuntu-22.04
permissions:
checks: write
# only needed unless run with comment_mode: off
pull-requests: write
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: "artifacts/**/*.xml"