-
Notifications
You must be signed in to change notification settings - Fork 6
93 lines (81 loc) · 2.69 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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 -d=ij_python 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 -d=ij_java 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