chore: update python to 3.11 #392
Workflow file for this run
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: Jetstream Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '[0-9][0-9][0-9][0-9].[0-9][0-9]?.[0-9]+' # Calver: YYYY.M.MINOR | |
| pull_request: | |
| branches: | |
| - main | |
| merge_group: | |
| jobs: | |
| build: | |
| environment: GH Actions | |
| permissions: | |
| contents: read | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Build venv and install dependencies | |
| run: | | |
| python -m venv venv/ | |
| venv/bin/pip install --no-deps --progress-bar off --upgrade -r requirements.txt | |
| - name: Ruff lint | |
| run: venv/bin/ruff check jetstream | |
| - name: Ruff format | |
| run: venv/bin/ruff format --check jetstream | |
| - name: Mypy | |
| run: venv/bin/mypy jetstream | |
| - name: Authenticate to GCP and Generate ID Token | |
| id: auth | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ secrets.GCP_DRYRUN_SERVICE_ACCOUNT_EMAIL }} | |
| token_format: 'id_token' | |
| id_token_audience: 'https://us-central1-moz-fx-data-shared-prod.cloudfunctions.net/dryrun' | |
| id_token_include_email: true | |
| - name: Export ID Token for Python | |
| env: | |
| GOOGLE_GHA_ID_TOKEN: ${{ steps.auth.outputs.id_token }} | |
| run: echo "GOOGLE_GHA_ID_TOKEN=$GOOGLE_GHA_ID_TOKEN" >> $GITHUB_ENV | |
| - name: PyTest | |
| run: venv/bin/pytest --ruff --ruff-format --ignore=jetstream/tests/integration/ -n 8 | |
| integration: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: GH Actions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Build venv and install dependencies | |
| run: | | |
| python -m venv venv/ | |
| venv/bin/pip install --no-deps --progress-bar off --upgrade -r requirements.txt | |
| - name: Authenticate to GCP (OIDC) | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ secrets.GCP_INTEGRATION_SERVICE_ACCOUNT_EMAIL }} | |
| - name: PyTest Integration Test | |
| run: venv/bin/pytest --ruff --ruff-format --integration jetstream/tests/integration/ -n 8 | |
| deploy: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/mozilla-jetstream | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install deployment tools | |
| run: pip install --upgrade build setuptools wheel twine | |
| - name: Build distribution files | |
| run: python -m build --sdist | |
| - name: Publish distribution 📦 to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| docker: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: GH Actions | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: [build, integration] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build . -t jetstream:latest | |
| - name: Push Docker image to GAR | |
| uses: mozilla-it/deploy-actions/docker-push@v3 | |
| with: | |
| project_id: moz-fx-data-experiments | |
| local_image: jetstream | |
| image_repo_host: gcr.io | |
| image_repo_path: moz-fx-data-experiments/jetstream | |
| workload_identity_pool_project_number: ${{ vars.GCPV2_WORKLOAD_IDENTITY_POOL_PROJECT_NUMBER }} |