Skip to content

Commit d3406a9

Browse files
committed
test: add self-hosted runner for python3.4
1 parent 945075b commit d3406a9

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/ci-test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,68 @@ jobs:
164164
uses: codecov/codecov-action@v4
165165
with:
166166
token: ${{ secrets.CODECOV_TOKEN }}
167+
test-win-self-hosted:
168+
strategy:
169+
fail-fast: false
170+
max-parallel: 1
171+
matrix:
172+
# only 3.4, 3.10 is supported on this machine
173+
python_version: ['3.4']
174+
runs-on: [self-hosted, Windows10, X64]
175+
needs: test-win
176+
steps:
177+
- name: Checkout repo
178+
uses: actions/checkout@v2
179+
with:
180+
ref: ${{ github.ref }}
181+
- name: Setup Python
182+
run: |
183+
python${{ matrix.python_version }} -m venv .venv
184+
- name: Install dependencies
185+
run: |
186+
.venv\Scripts\Activate.ps1
187+
python -m pip install --upgrade pip
188+
python -m pip install -I -e ".[dev]"
189+
- name: Run cases
190+
env:
191+
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
192+
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
193+
QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }}
194+
QINIU_TEST_NO_ACC_BUCKET: ${{ secrets.QINIU_TEST_NO_ACC_BUCKET }}
195+
QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }}
196+
QINIU_UPLOAD_CALLBACK_URL: ${{secrets.QINIU_UPLOAD_CALLBACK_URL}}
197+
QINIU_TEST_ENV: "github"
198+
MOCK_SERVER_ADDRESS: "http://127.0.0.1:9000"
199+
run: |
200+
Write-Host "======== Setup Mock Server ========="
201+
$processOptions = @{
202+
FilePath="python3.10"
203+
ArgumentList="tests\mock_server\main.py", "--port", "9000"
204+
PassThru=$true
205+
RedirectStandardOutput="py-mock-server.log"
206+
}
207+
$mocksrvp = Start-Process @processOptions
208+
$mocksrvp.Id | Out-File -FilePath "mock-server.pid"
209+
Sleep 3
210+
Write-Host "======== Running Test ========="
211+
.venv\Scripts\Activate.ps1
212+
python --version
213+
python -m pytest test_qiniu.py tests --cov qiniu --cov-report=xml
214+
- name: Post Setup mock server
215+
if: ${{ always() }}
216+
run: |
217+
Try {
218+
$mocksrvpid = Get-Content -Path "mock-server.pid"
219+
Stop-Process -Id $mocksrvpid
220+
Remove-Item -Path "mock-server.pid"
221+
} Catch {
222+
Write-Host -Object $_
223+
}
224+
- name: Print mock server log
225+
if: ${{ failure() }}
226+
run: |
227+
Get-Content -Path "py-mock-server.log" | Write-Host
228+
- name: Upload results to Codecov
229+
uses: codecov/codecov-action@v4
230+
with:
231+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)