-
Notifications
You must be signed in to change notification settings - Fork 59
191 lines (163 loc) · 5.43 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "pip" # caching pip dependencies
cache-dependency-path: |
pyproject.toml
requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
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.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
cache-dependency-path: |
pyproject.toml
requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run mocked tests
run: |
make test
- name: Build distribution and test installation
shell: bash
run: |
make dist
python -m pip install dist/cloudpathlib-*.whl --no-deps --force-reinstall
python -c "import cloudpathlib"
python -m pip install dist/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@v3
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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "pip" # caching pip dependencies
cache-dependency-path: |
pyproject.toml
requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
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 }}
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@v1
with:
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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: |
pyproject.toml
requirements-dev.txt
- name: Build cloudpathlib
run: |
pip install --upgrade pip build
make dist # build cloudpathlib wheel
- name: Create empty venv
run: |
python -m venv ${{ matrix.extra }}-env
- name: Install cloudpathlib[${{ matrix.extra }}]
run: |
source ${{ matrix.extra }}-env/bin/activate
pip install "$(find dist -name 'cloudpathlib*.whl')[${{ matrix.extra }}]"
- 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 }}