Skip to content

[Client] sky api login: follow an HTTP->HTTPS redirect #42272

[Client] sky api login: follow an HTTP->HTTPS redirect

[Client] sky api login: follow an HTTP->HTTPS redirect #42272

Workflow file for this run

name: Python Tests
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- master
- 'releases/**'
pull_request:
branches:
- master
- 'releases/**'
merge_group:
jobs:
python-test:
strategy:
matrix:
python-version: ["3.9"]
test-path:
# Group them based on running time to save CI time and resources
- tests/unit_tests
- tests/test_cli.py
- tests/test_jobs.py tests/test_jobs_and_serve.py tests/test_list_accelerators.py tests/test_api.py
- tests/test_config.py tests/test_wheels.py tests/test_yaml_parser.py tests/test_global_user_state.py tests/test_storage.py tests/test_api_compatibility.py tests/test_infra_k8s_alias.py
- tests/test_no_parellel.py
- tests/test_ssh_proxy_lag.py
include:
# We separate out the random DAG tests because its flaky due to catalog updates.
# TODO(zeping): Move back to the main test group once we fixed the flakiness.
- test-path: tests/unit_tests
test-name: "Unit Tests"
- test-path: tests/test_cli.py
test-name: "CLI Tests"
- test-path: tests/test_jobs.py tests/test_jobs_and_serve.py tests/test_list_accelerators.py tests/test_api.py
test-name: "Jobs & API Tests"
- test-path: tests/test_config.py tests/test_wheels.py tests/test_yaml_parser.py tests/test_global_user_state.py tests/test_storage.py tests/test_api_compatibility.py tests/test_infra_k8s_alias.py
test-name: "Config, Storage & Compatibility Tests"
- test-path: tests/test_no_parellel.py
test-name: "No Parallel Tests"
- test-path: tests/test_ssh_proxy_lag.py
test-name: "Event Loop Lag Tests"
runs-on: ubuntu-latest
name: "Python Tests - ${{ matrix.test-name }}"
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Run Python Tests
uses: ./.github/actions/run-python-tests
with:
python-version: ${{ matrix.python-version }}
test-path: ${{ matrix.test-path }}
test-name: ${{ matrix.test-name }}
buildkite-analytics-token: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
limited-deps-test:
# Test with limited dependencies to ensure cloud module imports don't break
# basic functionality (e.g., importing IBM shouldn't break AWS support)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.13"]
test-path:
- tests/test_jobs_and_serve.py tests/test_cli.py
include:
- test-path: tests/test_jobs_and_serve.py tests/test_cli.py
test-name: "Limited Deps - Jobs, Serve & CLI"
name: "Python Tests - ${{ matrix.test-name }} (${{ matrix.python-version }})"
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
with:
version: "latest"
python-version: ${{ matrix.python-version }}
- name: Install limited dependencies
run: |
uv venv --seed ~/test-env
source ~/test-env/bin/activate
uv pip install --prerelease=allow "azure-cli>=2.65.0,<2.87.0"
# Install limited dependencies only
uv pip install -e ".[kubernetes,aws,gcp,azure]"
uv pip install pytest pytest-xdist pytest-env>=0.6 pytest-asyncio memory-profiler==0.61.0 buildkite-test-collector
- name: Set branch name and commit message
id: set_env
env:
PR_TITLE: ${{ github.event.pull_request.title }}
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
MERGE_GROUP_HEAD_COMMIT_MESSAGE: ${{ github.event.merge_group.head_commit.message }}
HEAD_REF: ${{ github.head_ref }}
REF_NAME: ${{ github.ref_name }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "branch=$HEAD_REF" >> $GITHUB_OUTPUT
{
echo "message<<EOF"
echo "$PR_TITLE"
echo "EOF"
} >> $GITHUB_OUTPUT
else
echo "branch=$REF_NAME" >> $GITHUB_OUTPUT
# For push events after merge, head_commit.message contains the merge commit message
# which includes the PR title. For merge_group events, use merge_group.head_commit.message
{
echo "message<<EOF"
if [ "${{ github.event_name }}" == "merge_group" ]; then
echo "$MERGE_GROUP_HEAD_COMMIT_MESSAGE"
else
echo "$HEAD_COMMIT_MESSAGE"
fi
echo "EOF"
} >> $GITHUB_OUTPUT
fi
- name: Run tests with pytest
env:
TEST_PATH: ${{ matrix.test-path }}
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
BRANCH: ${{ steps.set_env.outputs.branch }}
COMMIT_MESSAGE: ${{ steps.set_env.outputs.message }}
run: |
source ~/test-env/bin/activate
export GITHUB_REF="$BRANCH"
export TEST_ANALYTICS_COMMIT_MESSAGE="$COMMIT_MESSAGE"
SKYPILOT_DISABLE_USAGE_COLLECTION=1 SKYPILOT_SKIP_CLOUD_IDENTITY_CHECK=1 eval "pytest -n 0 --dist no $TEST_PATH"
failover-test:
# Test failover functionality
runs-on: ubuntu-latest
strategy:
matrix:
# moto requires >=3.9
python-version: ["3.10"]
test-path:
- tests/test_failover.py
include:
- test-path: tests/test_failover.py
test-name: "Failover Tests"
name: "Python Tests - ${{ matrix.test-name }}"
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
with:
version: "latest"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv venv --seed ~/test-env
source ~/test-env/bin/activate
uv pip install --prerelease=allow "azure-cli>=2.65.0,<2.87.0"
# Use -e to include examples and tests folder in the path for unit
# tests to access them.
uv pip install -e ".[all]"
uv pip install pytest pytest-xdist pytest-env>=0.6 pytest-asyncio memory-profiler==0.61.0 moto==5.1.2 buildkite-test-collector
- name: Set branch name and commit message
id: set_env
env:
PR_TITLE: ${{ github.event.pull_request.title }}
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
MERGE_GROUP_HEAD_COMMIT_MESSAGE: ${{ github.event.merge_group.head_commit.message }}
HEAD_REF: ${{ github.head_ref }}
REF_NAME: ${{ github.ref_name }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "branch=$HEAD_REF" >> $GITHUB_OUTPUT
{
echo "message<<EOF"
echo "$PR_TITLE"
echo "EOF"
} >> $GITHUB_OUTPUT
else
echo "branch=$REF_NAME" >> $GITHUB_OUTPUT
# For push events after merge, head_commit.message contains the merge commit message
# which includes the PR title. For merge_group events, use merge_group.head_commit.message
{
echo "message<<EOF"
if [ "${{ github.event_name }}" == "merge_group" ]; then
echo "$MERGE_GROUP_HEAD_COMMIT_MESSAGE"
else
echo "$HEAD_COMMIT_MESSAGE"
fi
echo "EOF"
} >> $GITHUB_OUTPUT
fi
- name: Run tests with pytest
env:
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
BRANCH: ${{ steps.set_env.outputs.branch }}
COMMIT_MESSAGE: ${{ steps.set_env.outputs.message }}
run: |
source ~/test-env/bin/activate
export GITHUB_REF="$BRANCH"
export TEST_ANALYTICS_COMMIT_MESSAGE="$COMMIT_MESSAGE"
SKYPILOT_DISABLE_USAGE_COLLECTION=1 SKYPILOT_SKIP_CLOUD_IDENTITY_CHECK=1 pytest -n 4 --dist worksteal ${{ matrix.test-path }}