Update the packaging script #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Extension | |
| env: | |
| GITHUB_ACTIONS: true | |
| PYTHONUNBUFFERED: 1 | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| jobs: | |
| check-providers: | |
| name: Check Provider Configuration | |
| runs-on: ubuntu-latest | |
| outputs: | |
| bigquery-available: ${{ steps.bq_check.outputs.inputsChecked }} | |
| snowflake-available: ${{ steps.sf_check.outputs.inputsChecked }} | |
| steps: | |
| - name: Check BigQuery secrets | |
| id: bq_check | |
| uses: svrooij/secret-gate-action@v1 | |
| with: | |
| inputsToCheck: 'BQ_CREDENTIALS_JSON_CI' | |
| env: | |
| BQ_CREDENTIALS_JSON_CI: ${{ secrets.BQ_CREDENTIALS_JSON_CI }} | |
| - name: Check Snowflake secrets | |
| id: sf_check | |
| uses: svrooij/secret-gate-action@v1 | |
| with: | |
| inputsToCheck: 'SF_USER' | |
| env: | |
| SF_USER: ${{ secrets.SF_USER }} | |
| deploy-bigquery: | |
| name: Deploy BigQuery Extension | |
| runs-on: ubuntu-latest | |
| needs: check-providers | |
| if: needs.check-providers.outputs.bigquery-available == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python environment with uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Install Python and dependencies | |
| run: | | |
| uv venv --python 3.11.9 | |
| uv pip install -r requirements.txt | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.BQ_CREDENTIALS_JSON_CI }} | |
| project_id: ${{ vars.BQ_TEST_PROJECT }} | |
| create_credentials_file: true | |
| - name: Deploy BigQuery extension | |
| run: uv run carto_extension.py deploy -d ${{ vars.BQ_TEST_PROJECT }}.${{ vars.BQ_TEST_DATASET }} | |
| env: | |
| # CI detection | |
| CI: true | |
| # BigQuery connection settings | |
| BQ_TEST_PROJECT: ${{ vars.BQ_TEST_PROJECT }} | |
| BQ_TEST_DATASET: ${{ vars.BQ_TEST_DATASET }} | |
| # Python path | |
| PYTHONPATH: ${{ github.workspace }} | |
| test-bigquery: | |
| name: Test BigQuery Extension | |
| runs-on: ubuntu-latest | |
| needs: deploy-bigquery | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python environment with uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Install Python and dependencies | |
| run: | | |
| uv venv --python 3.11.9 | |
| uv pip install -r requirements.txt | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.BQ_CREDENTIALS_JSON_CI }} | |
| project_id: ${{ vars.BQ_TEST_PROJECT }} | |
| create_credentials_file: true | |
| - name: Run BigQuery tests | |
| run: uv run carto_extension.py test --no-deploy | |
| env: | |
| # CI detection | |
| CI: true | |
| # BigQuery connection settings | |
| BQ_TEST_PROJECT: ${{ vars.BQ_TEST_PROJECT }} | |
| BQ_TEST_DATASET: ${{ vars.BQ_TEST_DATASET }} | |
| # Python path | |
| PYTHONPATH: ${{ github.workspace }} | |
| deploy-snowflake: | |
| name: Deploy Snowflake Extension | |
| runs-on: ubuntu-latest | |
| needs: check-providers | |
| if: needs.check-providers.outputs.snowflake-available == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python environment with uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Install Python and dependencies | |
| run: | | |
| uv venv --python 3.11.9 | |
| uv pip install -r requirements.txt | |
| - name: Deploy Snowflake extension | |
| run: uv run carto_extension.py deploy -d ${{ vars.SF_TEST_DATABASE }}.${{ vars.SF_TEST_SCHEMA }} | |
| env: | |
| # CI detection | |
| CI: true | |
| # Snowflake connection settings | |
| SF_USER: ${{ secrets.SF_USER }} | |
| SF_PASSWORD: ${{ secrets.SF_PASSWORD }} | |
| SF_ACCOUNT: ${{ secrets.SF_ACCOUNT }} | |
| SF_TEST_DATABASE: ${{ vars.SF_TEST_DATABASE }} | |
| SF_TEST_SCHEMA: ${{ vars.SF_TEST_SCHEMA }} | |
| # Python path | |
| PYTHONPATH: ${{ github.workspace }} | |
| test-snowflake: | |
| name: Test Snowflake Extension | |
| runs-on: ubuntu-latest | |
| needs: deploy-snowflake | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python environment with uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Install Python and dependencies | |
| run: | | |
| uv venv --python 3.11.9 | |
| uv pip install -r requirements.txt | |
| - name: Run Snowflake tests | |
| run: uv run carto_extension.py test --no-deploy | |
| env: | |
| # CI detection | |
| CI: true | |
| # Snowflake connection settings | |
| SF_USER: ${{ secrets.SF_USER }} | |
| SF_PASSWORD: ${{ secrets.SF_PASSWORD }} | |
| SF_ACCOUNT: ${{ secrets.SF_ACCOUNT }} | |
| SF_TEST_DATABASE: ${{ vars.SF_TEST_DATABASE }} | |
| SF_TEST_SCHEMA: ${{ vars.SF_TEST_SCHEMA }} | |
| # Python path | |
| PYTHONPATH: ${{ github.workspace }} |