-
Notifications
You must be signed in to change notification settings - Fork 63
174 lines (146 loc) · 5.01 KB
/
tests.yml
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: tests
on:
push:
branches: [master]
pull_request:
schedule:
# Run every Sunday
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: "3.11"
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Lint package
run: |
make lint
tests:
name: Mocked Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: code-quality
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Run mocked tests
run: |
make test
- name: Build distribution and test installation
shell: bash
run: |
make dist
uv pip install cloudpathlib@$(find dist -name 'cloudpathlib*.whl') --no-deps --force-reinstall
python -c "import cloudpathlib"
uv pip install cloudpathlib@$(find dist -name 'cloudpathlib*.tar.gz') --no-deps --force-reinstall
python -c "import cloudpathlib"
- name: Upload coverage to codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
live-tests:
name: Live Tests
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: "3.11"
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Run live tests
run: |
make test-live-cloud
env:
LIVE_AZURE_CONTAINER: ${{ secrets.LIVE_AZURE_CONTAINER }}
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
AZURE_STORAGE_GEN2_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_GEN2_CONNECTION_STRING }}
LIVE_GS_BUCKET: ${{ secrets.LIVE_GS_BUCKET }}
LIVE_S3_BUCKET: ${{ secrets.LIVE_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CUSTOM_S3_BUCKET: ${{secrets.CUSTOM_S3_BUCKET}}
CUSTOM_S3_KEY_ID: ${{secrets.CUSTOM_S3_KEY_ID}}
CUSTOM_S3_SECRET_KEY: ${{secrets.CUSTOM_S3_SECRET_KEY}}
CUSTOM_S3_ENDPOINT: ${{secrets.CUSTOM_S3_ENDPOINT}}
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
extras-test:
name: Test independent installs of clients
needs: tests
runs-on: ubuntu-latest
strategy:
matrix:
extra: ["s3", "azure", "gs"]
include:
- prefix: "s3"
extra: "s3"
- prefix: "az"
extra: "azure"
- prefix: "gs"
extra: "gs"
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: "3.11"
- name: Build cloudpathlib
run: |
uv pip install build
make dist # build cloudpathlib wheel
- name: Create empty venv
run: |
uv venv ${{ matrix.extra }}-env
- name: Install cloudpathlib[${{ matrix.extra }}]
run: |
source ${{ matrix.extra }}-env/bin/activate
uv pip install "cloudpathlib[${{ matrix.extra }}]@$(find dist -name 'cloudpathlib*.whl')"
- name: Test ${{ matrix.extra }} usage
run: |
source ${{ matrix.extra }}-env/bin/activate
python -c 'from cloudpathlib import CloudPath; CloudPath("${{ matrix.prefix }}://bucket/test")'
env:
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
notify:
name: Notify failed build
needs: [code-quality, tests, live-tests, extras-test]
if: failure() && github.event.pull_request == null
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}