|
| 1 | +name: Data Connect Demo App |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + nodeVersion: |
| 7 | + firebaseToolsVersion: |
| 8 | + javaVersion: |
| 9 | + gradleInfoLog: |
| 10 | + type: boolean |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - firebase-dataconnect/demo/** |
| 14 | + - .github/workflows/dataconnect_demo_app.yml |
| 15 | + schedule: |
| 16 | + - cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern) |
| 17 | + |
| 18 | +env: |
| 19 | + FDC_NODE_VERSION: ${{ inputs.nodeVersion || '20' }} |
| 20 | + FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.28.0' }} |
| 21 | + FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} |
| 22 | + FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools |
| 23 | + FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase |
| 24 | + |
| 25 | +defaults: |
| 26 | + run: |
| 27 | + shell: bash |
| 28 | + working-directory: firebase-dataconnect/demo |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + test: |
| 36 | + continue-on-error: false |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + with: |
| 41 | + sparse-checkout: firebase-dataconnect/demo |
| 42 | + |
| 43 | + - name: Create Cache Key Files |
| 44 | + run: | |
| 45 | + echo "gmagjr2b9d" >github_actions_demo_test_cache_key.txt |
| 46 | + echo "${{ env.FDC_FIREBASE_TOOLS_VERSION }}" >github_actions_demo_assemble_firebase_tools_version.txt |
| 47 | +
|
| 48 | + - uses: actions/setup-node@v3 |
| 49 | + with: |
| 50 | + node-version: ${{ env.FDC_NODE_VERSION }} |
| 51 | + cache: 'npm' |
| 52 | + cache-dependency-path: | |
| 53 | + firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt |
| 54 | + firebase-dataconnect/demo/github_actions_demo_assemble_firebase_tools_version.txt |
| 55 | +
|
| 56 | + - name: cache package-lock.json |
| 57 | + id: package_json_lock |
| 58 | + uses: actions/cache@v4 |
| 59 | + with: |
| 60 | + path: ${{ env.FDC_FIREBASE_TOOLS_DIR }}/package*.json |
| 61 | + key: firebase_tools_package_json-${{ env.FDC_FIREBASE_TOOLS_VERSION }} |
| 62 | + |
| 63 | + - name: install firebase-tools from scratch |
| 64 | + if: steps.package_json_lock.outputs.cache-hit != 'true' |
| 65 | + run: | |
| 66 | + set -v |
| 67 | + mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }} |
| 68 | + cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} |
| 69 | + echo '{}' > package.json |
| 70 | + npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }} |
| 71 | +
|
| 72 | + - name: install firebase-tools from package-lock.json |
| 73 | + if: steps.package_json_lock.outputs.cache-hit == 'true' |
| 74 | + run: | |
| 75 | + cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} |
| 76 | + npm ci --fund=false --audit=false |
| 77 | +
|
| 78 | + - uses: actions/setup-java@v4 |
| 79 | + with: |
| 80 | + java-version: ${{ env.FDC_JAVA_VERSION }} |
| 81 | + distribution: temurin |
| 82 | + cache: gradle |
| 83 | + cache-dependency-path: | |
| 84 | + firebase-dataconnect/demo/build.gradle.kts |
| 85 | + firebase-dataconnect/demo/gradle.properties |
| 86 | + firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties |
| 87 | + firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt |
| 88 | +
|
| 89 | + - name: tool versions |
| 90 | + continue-on-error: true |
| 91 | + run: | |
| 92 | + set +e -v |
| 93 | + which java |
| 94 | + java -version |
| 95 | + which javac |
| 96 | + javac -version |
| 97 | + which node |
| 98 | + node --version |
| 99 | + ${{ env.FDC_FIREBASE_COMMAND }} --version |
| 100 | + ./gradlew --version |
| 101 | +
|
| 102 | + - name: ./gradlew assemble test |
| 103 | + run: | |
| 104 | + set -x |
| 105 | + ./gradlew \ |
| 106 | + --no-daemon \ |
| 107 | + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ |
| 108 | + --profile \ |
| 109 | + -PdataConnect.minimalApp.firebaseCommand=${{ env.FDC_FIREBASE_COMMAND }} \ |
| 110 | + assemble test |
| 111 | +
|
| 112 | + - uses: actions/upload-artifact@v4 |
| 113 | + with: |
| 114 | + name: apks |
| 115 | + path: firebase-dataconnect/demo/build/**/*.apk |
| 116 | + if-no-files-found: warn |
| 117 | + compression-level: 0 |
| 118 | + |
| 119 | + - uses: actions/upload-artifact@v4 |
| 120 | + with: |
| 121 | + name: gradle_build_reports |
| 122 | + path: firebase-dataconnect/demo/build/reports/ |
| 123 | + if-no-files-found: warn |
| 124 | + compression-level: 9 |
| 125 | + |
| 126 | + spotlessCheck: |
| 127 | + continue-on-error: false |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v3 |
| 131 | + with: |
| 132 | + sparse-checkout: firebase-dataconnect/demo |
| 133 | + |
| 134 | + - name: Create Cache Key Files |
| 135 | + run: echo "h99ee4egfd" >github_actions_demo_spotless_cache_key.txt |
| 136 | + |
| 137 | + - uses: actions/setup-java@v4 |
| 138 | + with: |
| 139 | + java-version: ${{ env.FDC_JAVA_VERSION }} |
| 140 | + distribution: temurin |
| 141 | + cache: gradle |
| 142 | + cache-dependency-path: | |
| 143 | + firebase-dataconnect/demo/build.gradle.kts |
| 144 | + firebase-dataconnect/demo/gradle.properties |
| 145 | + firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties |
| 146 | + firebase-dataconnect/demo/github_actions_demo_spotless_cache_key.txt |
| 147 | +
|
| 148 | + - name: tool versions |
| 149 | + continue-on-error: true |
| 150 | + run: | |
| 151 | + set +e -v |
| 152 | + which java |
| 153 | + java -version |
| 154 | + which javac |
| 155 | + javac -version |
| 156 | + ./gradlew --version |
| 157 | +
|
| 158 | + - name: ./gradlew spotlessCheck |
| 159 | + run: | |
| 160 | + set -x |
| 161 | + ./gradlew \ |
| 162 | + --no-daemon \ |
| 163 | + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ |
| 164 | + spotlessCheck |
0 commit comments