This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
79 lines (71 loc) · 2.81 KB
/
format_scan.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
name: Format Scan
on:
pull_request:
branches: [main]
paths:
- intel_extension_for_transformers/**
- neural_chat/**
- workflows/**
- setup.py
- .github/workflows/format_scan.yml
- .github/workflows/script/formatScan/**
workflow_dispatch:
# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOCKER_CONFIG_NAME: "commonDockerConfig"
REPO_NAME: "code-scan"
REPO_TAG: "1.0"
DOCKER_FILE_NAME: "codeScan"
CONTAINER_NAME: "codeScan"
jobs:
format-scan:
runs-on: itrex-node-spell
strategy:
matrix:
job_name: [
"pylint",
"bandit",
# "clangformat",
"cloc",
"cpplint",
# "pydocstyle",
#"pyspelling",
"hadolint"
]
fail-fast: false
steps:
- name: Docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}-${{ runner.name }}'$) ]]; then
docker start ${{ env.CONTAINER_NAME }}-${{ runner.name }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v4
- name: Docker Build
run: |
docker build -f ${{ github.workspace }}/.github/workflows/docker/${{ env.DOCKER_FILE_NAME }}.dockerfile -t ${{ env.REPO_NAME }}:${{ env.REPO_TAG }} .
- name: Docker Run
run: |
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}-${{ runner.name }}'$) ]]; then
docker stop ${{ env.CONTAINER_NAME }}-${{ runner.name }}
docker rm -vf ${{ env.CONTAINER_NAME }}-${{ runner.name }} || true
fi
docker run -dit --memory="4g" --memory-reservation="1g" --disable-content-trust --privileged --name=${{ env.CONTAINER_NAME }}-${{ runner.name }} --shm-size="1g" \
-v ${{ github.workspace }}:/intel-extension-for-transformers \
${{ env.REPO_NAME }}:${{ env.REPO_TAG }}
- name: Code scan check
run: |
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} \
bash -c "bash /intel-extension-for-transformers/.github/workflows/script/formatScan/${{ matrix.job_name }}.sh"
- name: Publish pipeline artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.job_name }}
path: ${{ github.workspace }}/.github/workflows/script/formatScan/${{ matrix.job_name }}.*