-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (68 loc) · 2.56 KB
/
Copy pathtest.yml
File metadata and controls
82 lines (68 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Test Python SDK
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[dev]'
- name: Lint source with ruff
run: ruff check oilpriceapi/
- name: Type check with mypy
run: mypy oilpriceapi/ --ignore-missing-imports
- name: Validate public storefront claims
run: python scripts/validate_storefront_claims.py
- name: Build and validate exact source distribution
if: matrix.python-version == '3.12'
run: |
set -euo pipefail
python -m pip install 'build==1.5.0'
python -m build --sdist
PACKAGE_VERSION="$(python scripts/package_version.py)"
SDIST="dist/oilpriceapi-${PACKAGE_VERSION}.tar.gz"
if [ ! -f "$SDIST" ]; then
echo "::error::Exact source distribution not found: $SDIST"
exit 1
fi
python scripts/validate_storefront_claims.py --sdist "$SDIST"
- name: Run unit tests
run: pytest tests/ --ignore=tests/integration --ignore=tests/contract -m 'not slow' --cov=oilpriceapi --cov-report=xml -v
- name: Build executable snippet manifest
run: |
python scripts/generate_snippet_manifest.py \
--source-commit "$GITHUB_SHA" \
--output artifacts/snippets/oilpriceapi-python-snippets-v1.json
- name: Upload snippet manifest
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: oilpriceapi-python-snippets-${{ github.sha }}
path: artifacts/snippets/
if-no-files-found: error
- name: Upload coverage
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-report
path: coverage.xml