Skip to content

Commit 72f1ad4

Browse files
committed
debug: try selfhosted runner
1 parent 945075b commit 72f1ad4

File tree

1 file changed

+8
-106
lines changed

1 file changed

+8
-106
lines changed

.github/workflows/ci-test.yml

Lines changed: 8 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,25 @@
11
on: [push]
22
name: Run Test Cases
33
jobs:
4-
test:
5-
strategy:
6-
fail-fast: false
7-
max-parallel: 1
8-
matrix:
9-
python_version: ['2.7', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9']
10-
runs-on: ubuntu-20.04
11-
steps:
12-
- name: Checkout repo
13-
uses: actions/checkout@v2
14-
with:
15-
ref: ${{ github.ref }}
16-
- name: Setup miniconda
17-
uses: conda-incubator/setup-miniconda@v2
18-
with:
19-
auto-update-conda: true
20-
channels: conda-forge
21-
python-version: ${{ matrix.python_version }}
22-
activate-environment: qiniu-sdk
23-
auto-activate-base: false
24-
- name: Setup pip
25-
shell: bash -l {0}
26-
env:
27-
PYTHON_VERSION: ${{ matrix.python_version }}
28-
PIP_BOOTSTRAP_SCRIPT_PREFIX: https://bootstrap.pypa.io/pip
29-
run: |
30-
MAJOR=$(echo "$PYTHON_VERSION" | cut -d'.' -f1)
31-
MINOR=$(echo "$PYTHON_VERSION" | cut -d'.' -f2)
32-
# reinstall pip by some python(<3.7) not compatible
33-
if ! [[ $MAJOR -ge 3 && $MINOR -ge 7 ]]; then
34-
cd /tmp
35-
wget -qLO get-pip.py "$PIP_BOOTSTRAP_SCRIPT_PREFIX/$MAJOR.$MINOR/get-pip.py"
36-
python get-pip.py --user
37-
fi
38-
- name: Setup mock server
39-
shell: bash -el {0}
40-
run: |
41-
conda create -y -n mock-server python=3.10
42-
conda activate mock-server
43-
python3 --version
44-
nohup python3 tests/mock_server/main.py --port 9000 > py-mock-server.log &
45-
echo $! > mock-server.pid
46-
conda deactivate
47-
- name: Install dependencies
48-
shell: bash -l {0}
49-
run: |
50-
python -m pip install --upgrade pip
51-
python -m pip install -I -e ".[dev]"
52-
- name: Run cases
53-
shell: bash -el {0}
54-
env:
55-
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
56-
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
57-
QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }}
58-
QINIU_TEST_NO_ACC_BUCKET: ${{ secrets.QINIU_TEST_NO_ACC_BUCKET }}
59-
QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }}
60-
QINIU_UPLOAD_CALLBACK_URL: ${{secrets.QINIU_UPLOAD_CALLBACK_URL}}
61-
QINIU_TEST_ENV: "travis"
62-
MOCK_SERVER_ADDRESS: "http://127.0.0.1:9000"
63-
run: |
64-
flake8 --show-source --max-line-length=160 ./qiniu
65-
python -m pytest ./test_qiniu.py tests --cov qiniu --cov-report=xml
66-
- name: Post Setup mock server
67-
if: ${{ always() }}
68-
shell: bash
69-
run: |
70-
set +e
71-
cat mock-server.pid | xargs kill
72-
rm mock-server.pid
73-
- name: Print mock server log
74-
if: ${{ failure() }}
75-
run: |
76-
cat py-mock-server.log
77-
- name: Upload results to Codecov
78-
uses: codecov/codecov-action@v4
79-
with:
80-
token: ${{ secrets.CODECOV_TOKEN }}
814
test-win:
825
strategy:
836
fail-fast: false
847
max-parallel: 1
858
matrix:
86-
python_version: ['2.7', '3.5', '3.9']
87-
runs-on: windows-2019
88-
# make sure only one test running,
89-
# remove this when cases could run in parallel.
90-
needs: test
9+
# only 3.4, 3.10 is supported on this machine
10+
python_version: ['3.4', '3.10']
11+
runs-on: [self-hosted, Windows10, X64]
9112
steps:
9213
- name: Checkout repo
9314
uses: actions/checkout@v2
9415
with:
9516
ref: ${{ github.ref }}
96-
- name: Setup miniconda
97-
uses: conda-incubator/setup-miniconda@v2
98-
with:
99-
auto-update-conda: true
100-
channels: conda-forge
101-
python-version: ${{ matrix.python_version }}
102-
activate-environment: qiniu-sdk
103-
auto-activate-base: false
104-
- name: Setup pip
105-
env:
106-
PYTHON_VERSION: ${{ matrix.python_version }}
107-
PIP_BOOTSTRAP_SCRIPT_PREFIX: https://bootstrap.pypa.io/pip
17+
- name: Setup Python
10818
run: |
109-
# reinstall pip by some python(<3.7) not compatible
110-
$pyversion = [Version]"$ENV:PYTHON_VERSION"
111-
if ($pyversion -lt [Version]"3.7") {
112-
Invoke-WebRequest "$ENV:PIP_BOOTSTRAP_SCRIPT_PREFIX/$($pyversion.Major).$($pyversion.Minor)/get-pip.py" -OutFile "$ENV:TEMP\get-pip.py"
113-
python $ENV:TEMP\get-pip.py --user
114-
Remove-Item -Path "$ENV:TEMP\get-pip.py"
115-
}
19+
python${{ maxtrix.pyteon_version }} -m venv .venv
11620
- name: Install dependencies
11721
run: |
22+
.venv\Scripts\active
11823
python -m pip install --upgrade pip
11924
python -m pip install -I -e ".[dev]"
12025
- name: Run cases
@@ -130,20 +35,17 @@ jobs:
13035
PYTHONPATH: "$PYTHONPATH:."
13136
run: |
13237
Write-Host "======== Setup Mock Server ========="
133-
conda create -y -n mock-server python=3.10
134-
conda activate mock-server
135-
python --version
13638
$processOptions = @{
137-
FilePath="python"
39+
FilePath="python3.10"
13840
ArgumentList="tests\mock_server\main.py", "--port", "9000"
13941
PassThru=$true
14042
RedirectStandardOutput="py-mock-server.log"
14143
}
14244
$mocksrvp = Start-Process @processOptions
14345
$mocksrvp.Id | Out-File -FilePath "mock-server.pid"
144-
conda deactivate
14546
Sleep 3
14647
Write-Host "======== Running Test ========="
48+
.venv\Scripts\active
14749
python --version
14850
python -m pytest ./test_qiniu.py tests --cov qiniu --cov-report=xml
14951
- name: Post Setup mock server

0 commit comments

Comments
 (0)