|
| 1 | +name: v0.x Nightly code check |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + schedule: |
| 5 | + - cron: '0 4 * * *' # 4 am UTC every day |
| 6 | +jobs: |
| 7 | + code-check: |
| 8 | + uses: ./.github/workflows/code-check.yml |
| 9 | + with: |
| 10 | + branch: 0.x |
| 11 | + unit-tests: |
| 12 | + uses: ./.github/workflows/unit-tests.yml |
| 13 | + with: |
| 14 | + branch: 0.x |
| 15 | + secrets: |
| 16 | + GIST_PAT: ${{ secrets.GIST_PAT }} |
| 17 | + security-scan: |
| 18 | + needs: [unit-tests] |
| 19 | + uses: ./.github/workflows/security-scan.yml |
| 20 | + with: |
| 21 | + branch: 0.x |
| 22 | + secrets: |
| 23 | + FOSSA_TOKEN: ${{ secrets.FOSSA_TOKEN }} |
| 24 | + SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} |
| 25 | + tests: |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + fail-fast: false # finish all jobs even if one fails |
| 29 | + max-parallel: 2 |
| 30 | + matrix: |
| 31 | + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] |
| 32 | + python-version: ['3.7', '3.8', '3.9', '3.10'] |
| 33 | + steps: |
| 34 | + - name: Check out code |
| 35 | + uses: actions/checkout@v2 |
| 36 | + |
| 37 | + - name: Set up Python 3.7 |
| 38 | + uses: actions/setup-python@v2 |
| 39 | + with: |
| 40 | + python-version: ${{ matrix.python-version }} |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: | |
| 44 | + python -m pip install --upgrade pip |
| 45 | + python -m pip install ".[dev]" |
| 46 | +
|
| 47 | + - name: Test with pytest |
| 48 | + run: | |
| 49 | + pytest tests/unit |
| 50 | +
|
| 51 | + - name: Setup database and engine |
| 52 | + id: setup |
| 53 | + uses: firebolt-db/integration-testing-setup@v1 |
| 54 | + with: |
| 55 | + firebolt-username: ${{ secrets.FIREBOLT_USERNAME }} |
| 56 | + firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }} |
| 57 | + api-endpoint: "api.dev.firebolt.io" |
| 58 | + region: "us-east-1" |
| 59 | + db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }} |
| 60 | + |
| 61 | + - name: Restore cached failed tests |
| 62 | + id: cache-tests-restore |
| 63 | + uses: actions/cache/restore@v3 |
| 64 | + with: |
| 65 | + path: | |
| 66 | + .pytest_cache/v/cache/lastfailed |
| 67 | + key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }} |
| 68 | + |
| 69 | + - name: Run integration tests |
| 70 | + env: |
| 71 | + USER_NAME: ${{ secrets.FIREBOLT_USERNAME }} |
| 72 | + PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }} |
| 73 | + SERVICE_ID: ${{ secrets.SERVICE_ID }} |
| 74 | + SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }} |
| 75 | + DATABASE_NAME: ${{ steps.setup.outputs.database_name }} |
| 76 | + ENGINE_NAME: ${{ steps.setup.outputs.engine_name }} |
| 77 | + ENGINE_URL: ${{ steps.setup.outputs.engine_url }} |
| 78 | + STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }} |
| 79 | + STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }} |
| 80 | + ACCOUNT_NAME: "firebolt" |
| 81 | + FIREBOLT_BASE_URL: "api.dev.firebolt.io" |
| 82 | + run: | |
| 83 | + pytest --last-failed -o log_cli=true -o log_cli_level=INFO --junit-xml=report/junit.xml tests/integration |
| 84 | +
|
| 85 | + - name: Save failed tests |
| 86 | + id: cache-tests-save |
| 87 | + uses: actions/cache/save@v3 |
| 88 | + if: failure() |
| 89 | + with: |
| 90 | + path: | |
| 91 | + .pytest_cache/v/cache/lastfailed |
| 92 | + key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }} |
| 93 | + |
| 94 | + - name: Slack Notify of failure |
| 95 | + if: failure() |
| 96 | + id: slack |
| 97 | + uses: firebolt-db/action-slack-nightly-notify@v1 |
| 98 | + with: |
| 99 | + os: ${{ matrix.os }} |
| 100 | + programming-language: Python |
| 101 | + language-version: ${{ matrix.python-version }} |
| 102 | + notifications-channel: 'ecosystem-ci-notifications' |
| 103 | + slack-api-key: ${{ secrets.SLACK_BOT_TOKEN }} |
0 commit comments