Skip to content

Commit 6fce6d5

Browse files
committed
Refactor GitHub Actions workflow: separate linting and building jobs for improved clarity and maintainability
1 parent 08d2602 commit 6fce6d5

File tree

1 file changed

+40
-27
lines changed

1 file changed

+40
-27
lines changed

.github/workflows/docker-image.yml

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,46 @@ permissions:
1111
security-events: write
1212

1313
jobs:
14-
build:
14+
lint:
1515
runs-on: ubuntu-latest
16-
1716
steps:
18-
- uses: actions/checkout@v4
19-
- name: Log in to Docker Hub
20-
uses: docker/login-action@v3
21-
with:
22-
username: ${{ secrets.DOCKERHUB_USERNAME }}
23-
password: ${{ secrets.DOCKERHUB_TOKEN }}
24-
25-
- name: Build the Docker image
26-
run: docker build . --file Dockerfile --tag gopalsaini/wsi-slides-dzi-processor:latest
27-
28-
- name: Scan Docker image for vulnerabilities
29-
uses: docker/scout-action@v1
30-
with:
31-
command: cves
32-
image: gopalsaini/wsi-slides-dzi-processor:latest
33-
only-severities: critical,high
34-
sarif-file: scout-report.sarif
35-
continue-on-error: true
17+
- uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+
pip install pylint
27+
- name: Run Pylint
28+
run: |
29+
pylint $(git ls-files '*.py')
3630
37-
- name: Upload SARIF report
38-
uses: github/codeql-action/upload-sarif@v3
39-
with:
40-
sarif_file: scout-report.sarif
41-
42-
- name: Push the Docker image
43-
run: docker push gopalsaini/wsi-slides-dzi-processor:latest
31+
build:
32+
runs-on: ubuntu-latest
33+
needs: lint
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Log in to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
- name: Build the Docker image
42+
run: docker build . --file Dockerfile --tag gopalsaini/wsi-slides-dzi-processor:latest
43+
- name: Scan Docker image for vulnerabilities
44+
uses: docker/scout-action@v1
45+
with:
46+
command: cves
47+
image: gopalsaini/wsi-slides-dzi-processor:latest
48+
only-severities: critical,high
49+
sarif-file: scout-report.sarif
50+
continue-on-error: true
51+
- name: Upload SARIF report
52+
uses: github/codeql-action/upload-sarif@v3
53+
with:
54+
sarif_file: scout-report.sarif
55+
- name: Push the Docker image
56+
run: docker push gopalsaini/wsi-slides-dzi-processor:latest

0 commit comments

Comments
 (0)