Skip to content

Merge pull request #219 from aliyun/release-v0.11.3 #414

Merge pull request #219 from aliyun/release-v0.11.3

Merge pull request #219 from aliyun/release-v0.11.3 #414

Workflow file for this run

name: Test
permissions:
contents: read
on:
workflow_dispatch:
push:
branches: [main, master]
paths:
- "src/**"
- "tests/**"
- "pyproject.toml"
- "uv.lock"
- "scripts/aliyun/**"
- ".github/workflows/test.yml"
pull_request:
branches: [main, master]
paths:
- "src/**"
- "tests/**"
- "pyproject.toml"
- "uv.lock"
- "scripts/aliyun/**"
- ".github/workflows/test.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: uv sync --all-extras
- name: Run linters
run: make lint
- name: Verify authentic pinned endpoint catalog
run: |
upstream_dir="$(mktemp -d)"
output_dir="$(mktemp -d)"
git -C "$upstream_dir" init
git -C "$upstream_dir" remote add origin https://github.com/aliyun/aliyun-openapi-meta.git
git -C "$upstream_dir" fetch --depth 1 origin 2563691c22229a0b493606e11166b95896707095
git -C "$upstream_dir" checkout --detach FETCH_HEAD
test "$(git -C "$upstream_dir" rev-parse HEAD)" = "2563691c22229a0b493606e11166b95896707095"
test "$(sha256sum "$upstream_dir/metadatas/products.json" | cut -d ' ' -f 1)" = \
"e79346fbe87dbacd73c4cb68520f897add17a8e90cadb8fb03e5efa217d04be5"
cmp "$upstream_dir/metadatas/products.json" \
tests/tools/cloud/aliyun/fixtures/endpoints/aliyun-openapi-meta/metadatas/products.json
uv run python scripts/aliyun/generate_endpoints.py \
--source "$upstream_dir/metadatas/products.json" \
--source-commit 2563691c22229a0b493606e11166b95896707095 \
--products-sha256 e79346fbe87dbacd73c4cb68520f897add17a8e90cadb8fb03e5efa217d04be5 \
--openmeta-products tests/tools/cloud/aliyun/fixtures/endpoints/openmeta_products.json \
--output-dir "$output_dir"
cmp "$output_dir/catalog.json" src/iac_code/tools/cloud/aliyun/data/endpoints/catalog.json
cmp "$output_dir/unavailable.json" src/iac_code/tools/cloud/aliyun/data/endpoints/unavailable.json
cmp "$output_dir/generation_report.json" src/iac_code/tools/cloud/aliyun/data/endpoints/generation_report.json
- name: Verify locked OSS async operation catalog
run: |
oss_version="$(uv run python -c 'import importlib.metadata as m; print(m.version("alibabacloud-oss-v2"))')"
oss_wheel_sha256="$(uv run python scripts/aliyun/generate_oss_operations.py wheel-hash --lockfile uv.lock)"
oss_catalog="$(mktemp)"
uv run python scripts/aliyun/generate_oss_operations.py generate \
--sdk-version "$oss_version" \
--sdk-wheel-sha256 "$oss_wheel_sha256" \
--openmeta-fixture tests/tools/cloud/aliyun/fixtures/oss/openmeta_operations.json \
--output "$oss_catalog"
cmp "$oss_catalog" src/iac_code/tools/cloud/aliyun/data/oss/operation_catalog.json
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras
- name: Compile translations
run: make translate
- name: Run tests with coverage
run: |
uv run pytest tests/ -v -n auto \
--cov --cov-report=term-missing \
--junitxml=testcase.xml
- name: Check coverage threshold
run: uv run coverage report --fail-under=80
test-windows:
name: Test (Windows, Python 3.10)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: uv sync --all-extras
- name: Run tests
run: uv run pytest tests/ -v --no-header -n auto