Skip to content

Update test commands for poetry to use 'python -m pytest' #1832

Update test commands for poetry to use 'python -m pytest'

Update test commands for poetry to use 'python -m pytest' #1832

Workflow file for this run

name: Python build
on:
push:
pull_request:
jobs:
build_image:
name: Build Image
runs-on: [ self-hosted, small ]
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: hyperskill.azurecr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- uses: docker/setup-buildx-action@v3
- name: Build and push server image
uses: docker/build-push-action@v6
with:
context: .
pull: true
push: true
tags: hyperskill.azurecr.io/hyperstyle:${{ github.sha }}
cache-from: |
type=gha
type=gha,scope=main
cache-to: type=gha,mode=max
tests:
name: Tests
needs:
- build_image
runs-on: ubuntu-latest
container:
image: hyperskill.azurecr.io/hyperstyle:${{ github.sha }}
credentials:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- name: Run tests
run: |
poetry run python -m pytest
build:
runs-on: ubuntu-latest
needs:
- build_image
container:
image: hyperskill.azurecr.io/hyperstyle:${{ github.sha }}
credentials:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- name: Check env variables
run: |
echo $DETEKT_DIRECTORY && echo $DETEKT_VERSION
echo $CHECKSTYLE_DIRECTORY && echo $CHECKSTYLE_VERSION
echo $PMD_DIRECTORY && echo $PMD_VERSION
echo $GOLANG_LINT_DIRECTORY && echo $GOLANG_LINT_VERSION
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,__pycache__,docs/source/conf.py,old,build,dist,venv,test/resources,.eggs,review.egg-info,.pytest_cache,node_modules,hyperstyle/src/python/review/inspectors/common/inspector/proto
# TODO: change max-complexity into 10 after refactoring
# TODO: remove R504, A003, E800, E402, WPS1, WPS2, WPS3, WPS4, WPS5, WPS6, H601
flake8 . --count --max-complexity=11 --max-line-length=120 --max-doc-length=120 --ignore=R504,A003,E800,E402,W503,WPS,H601,N400,I100,I201,I202, --statistics --exclude=.git,__pycache__,docs/source/conf.py,old,build,dist,venv,test/resources,.eggs,review.egg-info,.pytest_cache,node_modules,hyperstyle/src/python/review/inspectors/common/inspector/proto
- name: Check installed module can run python linters
run: |
review test/resources/inspectors/python/case39_no_issues.py
- name: Check installed module can run java linters
run: |
review test/resources/inspectors/java/test_algorithm_with_scanner.java
- name: Check installed module can run js linters
run: |
review test/resources/inspectors/js/case0_no_issues.js