-
Notifications
You must be signed in to change notification settings - Fork 7
134 lines (114 loc) · 4.18 KB
/
ci.yml
File metadata and controls
134 lines (114 loc) · 4.18 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
name: CI
on:
push:
branches: [main, master]
pull_request:
# Run on all pull requests regardless of source branch
jobs:
python:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Transloadit CLI
run: npm install -g transloadit
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install Poetry (Windows)
if: runner.os == 'Windows'
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
echo "$HOME\AppData\Roaming\Python\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Poetry (Unix)
if: runner.os != 'Windows'
run: pip install --upgrade poetry
- name: Install Dependencies
run: poetry install
- name: Test with coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
poetry run pytest --cov=transloadit \
--cov-report=xml \
--cov-report=json \
--cov-report=html \
--cov-report=term-missing \
--cov-fail-under=65 \
tests
env:
TEST_NODE_PARITY: 1
- name: Test without coverage
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.12'
run: poetry run pytest tests
- name: Upload coverage reports
# Only upload coverage if we have a token (skip for Dependabot PRs)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && (github.event_name != 'pull_request' || github.actor != 'dependabot[bot]')
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: python-sdk
fail_ci_if_error: false
- name: Upload coverage reports (tokenless)
# Use tokenless upload for Dependabot PRs
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests
name: python-sdk
fail_ci_if_error: false
- name: Upload coverage artifacts
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: |
coverage.json
htmlcov/
python-e2e:
runs-on: ubuntu-latest
needs: python
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
PYTHON_SDK_E2E: "1"
TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_KEY }}
TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_SECRET }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Transloadit CLI
run: npm install -g transloadit
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
architecture: x64
cache: 'pip'
- name: Install Poetry
run: pip install --upgrade poetry
- name: Install dependencies
run: poetry install
- name: Ensure credentials present
run: |
if [ -z "$TRANSLOADIT_KEY" ] || [ -z "$TRANSLOADIT_SECRET" ]; then
echo "TRANSLOADIT_KEY and TRANSLOADIT_SECRET secrets must be configured for the E2E job" >&2
exit 1
fi
- name: Run E2E upload test
env:
TEST_NODE_PARITY: 0
run: |
poetry run pytest tests/test_e2e_upload.py -q --maxfail=1 --no-cov