fix: working directory at job level

Signed-off-by: WANG Xu <feici02@outlook.com>
This commit is contained in:
WANG Xu 2025-03-11 15:24:06 +08:00
parent cef8c45eb2
commit a4eec90ba4
No known key found for this signature in database
GPG Key ID: 243B1A4F56B56F50
1 changed files with 29 additions and 25 deletions

View File

@ -1,4 +1,4 @@
name: TDGpt CI Pipeline name: TDgpt CI
on: on:
pull_request: pull_request:
@ -10,38 +10,42 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
working-directory: ${{ github.workspace }}/tools/tdgpt
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ["3.10"] python-version: ["3.10"]
defaults:
run:
working-directory: ${{ github.workspace }}/tools/tdgpt
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: 'pip' cache: 'pip'
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install flake8 pytest pylint python -m pip install flake8 pytest pylint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Checking the code with pylint - name: Checking the code with pylint
run: | run: |
pylint $(git ls-files '*.py') --exit-zero pylint $(git ls-files '*.py') --exit-zero
- name: Checking the code with flake8 - name: Checking the code with flake8
run: | run: |
# stop the build if there are Python syntax errors or undefined names # stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run test cases with pytest - name: Run test cases with pytest
run: | run: |
pytest pytest