Refactoring #1842
Workflow file for this run
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: Python build | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
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: [ self-hosted, small ] | |
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: [ self-hosted, small ] | |
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 | |
poetry run python -m 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 | |
poetry run python -m 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: | | |
poetry run python -m hyperstyle.src.python.review.run_tool test/resources/inspectors/python/case39_no_issues.py | |
- name: Check installed module can run java linters | |
run: | | |
poetry run python -m hyperstyle.src.python.review.run_tool test/resources/inspectors/java/test_algorithm_with_scanner.java | |
- name: Check installed module can run js linters | |
run: | | |
poetry run python -m hyperstyle.src.python.review.run_tool test/resources/inspectors/js/case0_no_issues.js |