Refactor exception handling and raise InspectionError #1884
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: | | |
cd /review | |
/hyperstyle/bin/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 | |
run: | | |
cd /review | |
# stop the build if there are Python syntax errors or undefined names | |
/hyperstyle/bin/ruff check --unsafe-fixes --preview . | |
- name: Check installed module can run python linters | |
run: | | |
cd /review | |
/hyperstyle/bin/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: | | |
cd /review | |
/hyperstyle/bin/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: | | |
cd /review | |
/hyperstyle/bin/python -m hyperstyle.src.python.review.run_tool test/resources/inspectors/js/case0_no_issues.js |