chore: release main #1838
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: import-profiler | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - preview | |
| # Trigger workflow on GitHub merge queue events | |
| merge_group: | |
| types: [checks_requested] | |
| permissions: | |
| contents: read | |
| jobs: | |
| initialize: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| is_full_run: ${{ steps.check-label.outputs.is_full_run }} | |
| env: | |
| MAX_SHARDS: 8 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| # Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base` | |
| # See https://github.com/googleapis/google-cloud-python/issues/12013 | |
| # and https://github.com/actions/checkout#checkout-head. | |
| with: | |
| fetch-depth: 2 | |
| persist-credentials: false | |
| - name: Check for unit_test:all_packages label | |
| id: check-label | |
| run: | | |
| if [[ "${{ contains(github.event.pull_request.labels.*.name, 'unit_test:all_packages') }}" == "true" ]]; then | |
| echo "is_full_run=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_full_run=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Get package shards | |
| id: set-matrix | |
| env: | |
| BUILD_TYPE: presubmit | |
| TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }} | |
| TEST_ALL_PACKAGES: ${{ steps.check-label.outputs.is_full_run }} | |
| MAX_SHARDS: ${{ env.MAX_SHARDS }} | |
| run: | | |
| if [ -n "$TARGET_BRANCH" ]; then | |
| git fetch origin "$TARGET_BRANCH" --depth=1 || true | |
| fi | |
| python3 ci/get_package_shards.py | |
| import-profile: | |
| needs: initialize | |
| if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != '' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package_shard: ${{ fromJson(needs.initialize.outputs.matrix) }} | |
| name: ${{ matrix.package_shard.is_sharded && format('import-profile ({0})', matrix.package_shard.name) || format('import-profile ({0})', matrix.package_shard.description) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 # Fetch git history to find changed packages / baseline | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "3.15" | |
| allow-prereleases: true | |
| cache: 'pip' | |
| - name: Run import profiler unit tests | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov setuptools | |
| pytest scripts/import_profiler/test_profiler.py --cov=profiler --cov-report=term-missing --cov-fail-under=100 | |
| - name: Run import profiler for ${{ matrix.package_shard.description }} | |
| env: | |
| BUILD_TYPE: presubmit | |
| TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }} | |
| TEST_TYPE: import_profile | |
| PY_VERSION: "3.15" | |
| # Workaround: Allows libcst to compile on Python 3.15+ while PyO3 catches up | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" | |
| PACKAGE_LIST: ${{ matrix.package_shard.packages }} | |
| run: | | |
| ci/run_conditional_tests.sh | |
| all-import-profiles: | |
| needs: [initialize, import-profile] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check import profile results | |
| run: | | |
| if [[ "${{ needs.initialize.result }}" != "success" ]]; then | |
| echo "Error: The initialize job status was: ${{ needs.initialize.result }}" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs['import-profile'].result }}" != "success" && "${{ needs['import-profile'].result }}" != "skipped" ]]; then | |
| echo "Import profiles failed" | |
| exit 1 | |
| fi | |
| echo "All import profiles passed or were skipped" |