Repository navigation
141 lines (120 loc) · 4.59 KB
/
Copy pathtest.yml
File metadata and controls
141 lines (120 loc) · 4.59 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- "**"
merge_group:
permissions:
contents: read
concurrency:
group: test-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pytest:
name: Unit tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
python-version: ['3.11.18', '3.12.16', '3.13.18', '3.14.10']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Install dependencies
run: uv sync --locked --group dev --managed-python --python ${{ matrix.python-version }}
- name: Run pytest
id: pytest
env:
COVERAGE_ARGS: ${{ matrix.python-version == '3.12.16' && '--cov=cloudsmith_cli' || '' }}
run: uv run pytest -m "not integration" ${COVERAGE_ARGS} --junitxml=./reports/pytest.xml
- name: Upload test results
if: ${{ !cancelled() && steps.pytest.outcome != 'skipped' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-results-${{ matrix.python-version }}
path: ./reports/pytest.xml
retention-days: 30
if-no-files-found: error
pytest-windows:
name: Windows unit tests (Python 3.14)
runs-on: windows-2025
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Install dependencies
run: uv sync --locked --group dev --python 3.14
- name: Run pytest
run: uv run pytest cloudsmith_cli -m "windows and not integration"
integration-gate:
name: Check integration credentials
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
available: ${{ steps.credentials.outputs.available }}
steps:
- name: Check integration credentials
id: credentials
env:
API_KEY: ${{ secrets.PYTEST_CLOUDSMITH_API_KEY }}
API_HOST: ${{ vars.PYTEST_CLOUDSMITH_API_HOST }}
ORGANIZATION: ${{ vars.PYTEST_CLOUDSMITH_ORGANIZATION }}
run: |
if [ -n "${API_KEY}" ] && [ -n "${API_HOST}" ] && [ -n "${ORGANIZATION}" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "Skipping live integration tests because credentials are unavailable."
fi
integration:
name: Live integration tests (Python 3.14.10)
needs: integration-gate
if: needs.integration-gate.outputs.available == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Install dependencies
run: uv sync --locked --group dev --managed-python --python 3.14.10
- name: Run live integration tests
id: pytest
env:
PYTEST_CLOUDSMITH_API_KEY: ${{ secrets.PYTEST_CLOUDSMITH_API_KEY }}
PYTEST_CLOUDSMITH_API_HOST: ${{ vars.PYTEST_CLOUDSMITH_API_HOST }}
PYTEST_CLOUDSMITH_ORGANIZATION: ${{ vars.PYTEST_CLOUDSMITH_ORGANIZATION }}
PYTEST_CLOUDSMITH_USERNAME: ${{ secrets.PYTEST_CLOUDSMITH_USERNAME }}
PYTEST_CLOUDSMITH_PASSWORD: ${{ secrets.PYTEST_CLOUDSMITH_PASSWORD }}
PYTEST_GITHUB_TOKEN: ${{ secrets.PYTEST_GITHUB_TOKEN }}
run: uv run pytest -m integration --junitxml=./reports/pytest.xml
- name: Upload test results
if: ${{ !cancelled() && steps.pytest.outcome != 'skipped' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-results-integration-3.12
path: ./reports/pytest.xml
retention-days: 30
if-no-files-found: error