[refactor](rollback){from stage}: use fetch-depth #39
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
######################################### | |
# on PR | |
# 1. linting | |
# 2. unit test | |
# 3. CodeQL (by github actions) | |
# 4. SonarQube with results on PR (by SonarCloud) | |
# | |
# author: ashraf minhaj | |
# mail : ashraf_minhaj@yahoo.com | |
######################################### | |
name: 'PR Tests' | |
on: | |
pull_request: | |
branches: | |
- "stage" | |
- "main" | |
types: [opened, synchronize] | |
jobs: | |
Test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: Display Python version | |
# run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
working-directory: ./app | |
- name: test app | |
run: python test_main.py | |
working-directory: ./app | |
Linting: | |
name: Lint Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" # Specify a single Python version for linting | |
- name: Install pylint | |
run: python -m pip install pylint | |
- name: Install requirements | |
run: python -m pip install -r requirements.txt | |
working-directory: ./app | |
- name: Lint | |
run: pylint --fail-under=9 main.py | |
working-directory: ./app |