feat: 封装使用默认应用打开指定文件的功能 #1772
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint And Test | |
on: | |
workflow_dispatch: | |
push: | |
release: | |
types: [ published ] | |
pull_request: | |
types: [ opened, synchronize ] | |
jobs: | |
lint: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements_dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Requirements | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements_dev.txt | |
- name: Set time zone | |
run: tzutil /s "China Standard Time" | |
- name: lint | |
run: | | |
tox -e lint | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ windows-latest, ubuntu-latest ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Set time zone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Asia/Shanghai" | |
timezoneMacos: "Asia/Shanghai" | |
timezoneWindows: "China Standard Time" | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements_dev.txt') }}-${{ hashFiles('**/requirements_linux_dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Requirements Windows | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements_dev.txt | |
- name: Install Requirements Ubuntu | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements_linux_dev.txt | |
- name: Test for CodeCov | |
run: | | |
pytest -n auto --cov=./ --cov-report=xml --cov-report=term | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
verbose: true | |
- name: Upload Codecov artifact | |
uses: actions/[email protected] | |
with: | |
name: "coverage.xml" | |
path: ./coverage.xml | |
- name: Test for Coveralls | |
run: | | |
coverage run -m pytest . | |
- name: Upload coverage to Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
coveralls --service=github |