|  | 
|  | 1 | +# Copyright 2021 Google Inc. | 
|  | 2 | +# | 
|  | 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | +# you may not use this file except in compliance with the License. | 
|  | 5 | +# You may obtain a copy of the License at | 
|  | 6 | +# | 
|  | 7 | +#     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | +# | 
|  | 9 | +# Unless required by applicable law or agreed to in writing, software | 
|  | 10 | +# distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | +# See the License for the specific language governing permissions and | 
|  | 13 | +# limitations under the License. | 
|  | 14 | + | 
|  | 15 | +name: Nightly Builds | 
|  | 16 | + | 
|  | 17 | +on: | 
|  | 18 | +  # Runs every day at 06:20 AM (PT) and 08:20 PM (PT) / 04:20 AM (UTC) and 02:20 PM (UTC) | 
|  | 19 | +  # or on 'firebase_nightly_build' repository dispatch event. | 
|  | 20 | +  schedule: | 
|  | 21 | +    - cron: "20 4,14 * * *" | 
|  | 22 | +  repository_dispatch: | 
|  | 23 | +    types: [firebase_nightly_build] | 
|  | 24 | + | 
|  | 25 | +jobs: | 
|  | 26 | +  nightly: | 
|  | 27 | + | 
|  | 28 | +    runs-on: ubuntu-latest | 
|  | 29 | + | 
|  | 30 | +    steps: | 
|  | 31 | +    - name: Checkout source for staging | 
|  | 32 | +      uses: actions/checkout@v2 | 
|  | 33 | +      with: | 
|  | 34 | +        ref: ${{ github.event.client_payload.ref || github.ref }} | 
|  | 35 | + | 
|  | 36 | +    - name: Set up Python | 
|  | 37 | +      uses: actions/setup-python@v1 | 
|  | 38 | +      with: | 
|  | 39 | +        python-version: 3.6 | 
|  | 40 | + | 
|  | 41 | +    - name: Install dependencies | 
|  | 42 | +      run: | | 
|  | 43 | +        python -m pip install --upgrade pip | 
|  | 44 | +        pip install -r requirements.txt | 
|  | 45 | +        pip install setuptools wheel | 
|  | 46 | +        pip install tensorflow | 
|  | 47 | +        pip install keras | 
|  | 48 | +
 | 
|  | 49 | +    - name: Run unit tests | 
|  | 50 | +      run: pytest | 
|  | 51 | + | 
|  | 52 | +    - name: Run integration tests | 
|  | 53 | +      run: ./.github/scripts/run_integration_tests.sh | 
|  | 54 | +      env: | 
|  | 55 | +        FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }} | 
|  | 56 | +        FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} | 
|  | 57 | + | 
|  | 58 | +    # Build the Python Wheel and the source distribution. | 
|  | 59 | +    - name: Package release artifacts | 
|  | 60 | +      run: python setup.py bdist_wheel sdist | 
|  | 61 | + | 
|  | 62 | +    # Attach the packaged artifacts to the workflow output. These can be manually | 
|  | 63 | +    # downloaded for later inspection if necessary. | 
|  | 64 | +    - name: Archive artifacts | 
|  | 65 | +      uses: actions/upload-artifact@v1 | 
|  | 66 | +      with: | 
|  | 67 | +        name: dist | 
|  | 68 | +        path: dist | 
|  | 69 | + | 
|  | 70 | +    - name: Send email on failure | 
|  | 71 | +      if: failure() | 
|  | 72 | +      uses: firebase/firebase-admin-node/.github/actions/send-email | 
|  | 73 | +      with: | 
|  | 74 | +        api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }} | 
|  | 75 | +        domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }} | 
|  | 76 | +        from: 'GitHub <admin-github@${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}>' | 
|  | 77 | +        to: ${{ secrets.FIREBASE_ADMIN_GITHUB_EMAIL }} | 
|  | 78 | +        subject: 'Nightly build ${{github.run_id}} of ${{github.repository}} failed!' | 
|  | 79 | +        html: > | 
|  | 80 | +          <b>Nightly workflow ${{github.run_id}} failed on: ${{github.repository}}</b> | 
|  | 81 | +          <br /><br />Navigate to the  | 
|  | 82 | +          <a href="https://github.com/firebase/firebase-admin-python/actions/runs/${{github.run_id}}">failed workflow</a>. | 
|  | 83 | +      continue-on-error: true | 
|  | 84 | + | 
|  | 85 | +    - name: Send email on cancelled | 
|  | 86 | +      if: cancelled() | 
|  | 87 | +      uses: firebase/firebase-admin-node/.github/actions/send-email | 
|  | 88 | +      with: | 
|  | 89 | +        api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }} | 
|  | 90 | +        domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }} | 
|  | 91 | +        from: 'GitHub <admin-github@${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}>' | 
|  | 92 | +        to: ${{ secrets.FIREBASE_ADMIN_GITHUB_EMAIL }} | 
|  | 93 | +        subject: 'Nightly build ${{github.run_id}} of ${{github.repository}} cancelled!' | 
|  | 94 | +        html: > | 
|  | 95 | +          <b>Nightly workflow ${{github.run_id}} cancelled on: ${{github.repository}}</b> | 
|  | 96 | +          <br /><br />Navigate to the  | 
|  | 97 | +          <a href="https://github.com/firebase/firebase-admin-python/actions/runs/${{github.run_id}}">cancelled workflow</a>. | 
|  | 98 | +      continue-on-error: true | 
0 commit comments