Skip to content

Commit 2b38bbe

Browse files
committed
ci(clamav): unify into single workflow .github/workflows/clam-av.yml; PR/release/dispatch share one build via composite; deprecate old PR/Release files
1 parent 08fdd67 commit 2b38bbe

3 files changed

Lines changed: 71 additions & 94 deletions

File tree

.github/workflows/clam-av-pr.yml

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,11 @@
1-
name: av-clamav-pr
1+
name: (deprecated) av-clamav-pr
2+
# This workflow is intentionally disabled to avoid duplication.
3+
# Use .github/workflows/clam-av.yml instead.
24
on:
3-
pull_request:
4-
5-
permissions:
6-
contents: read
5+
workflow_call:
76

87
jobs:
9-
clamav-pr:
8+
noop:
109
runs-on: ubuntu-latest
1110
steps:
12-
- uses: actions/checkout@v4
13-
14-
- name: Build and package
15-
id: build
16-
uses: ./.github/actions/build-package
17-
18-
- name: Upload build bundle
19-
uses: actions/upload-artifact@v4
20-
with:
21-
name: opencode-bundle
22-
path: bundle/opencode.zip
23-
24-
- name: Install & update ClamAV DB
25-
run: |
26-
set -e
27-
sudo apt-get update
28-
sudo apt-get install -y clamav clamav-freshclam unzip
29-
sudo systemctl stop clamav-freshclam || true
30-
sudo mkdir -p /var/lib/clamav
31-
sudo chown -R clamav:clamav /var/lib/clamav
32-
sudo freshclam --verbose
33-
ls -lh /var/lib/clamav
34-
35-
- name: Extract bundle and scan
36-
run: |
37-
set -e
38-
rm -rf dist-pr/extracted && mkdir -p dist-pr/extracted
39-
unzip -q bundle/opencode.zip -d dist-pr/extracted
40-
echo "File count in payload: $(find dist-pr/extracted -type f | wc -l)"
41-
clamscan -ri --scan-archive=yes dist-pr/extracted | tee clamav-pr.log
42-
! grep -q 'Infected files: [1-9]' clamav-pr.log
43-
44-
- name: Upload PR scan results
45-
uses: actions/upload-artifact@v4
46-
with:
47-
name: clamav-pr-scan-results
48-
path: |
49-
clamav-pr.log
50-
bundle/opencode.zip
11+
- run: echo 'Deprecated: use clam-av.yml'

.github/workflows/clam-av-scan.yml

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,11 @@
1-
name: av-clamav-release
1+
name: (deprecated) av-clamav-release
2+
# This workflow is intentionally disabled to avoid duplication.
3+
# Use .github/workflows/clam-av.yml instead.
24
on:
3-
workflow_dispatch:
4-
release:
5-
types: [published]
6-
7-
permissions:
8-
contents: read
9-
actions: read
5+
workflow_call:
106

117
jobs:
12-
clamav-release:
8+
noop:
139
runs-on: ubuntu-latest
1410
steps:
15-
- name: Checkout (release tag)
16-
if: github.event_name == 'release'
17-
uses: actions/checkout@v4
18-
with:
19-
ref: ${{ github.event.release.tag_name }}
20-
- name: Checkout (manual/default)
21-
if: github.event_name != 'release'
22-
uses: actions/checkout@v4
23-
24-
- name: Build and package
25-
id: build
26-
uses: ./.github/actions/build-package
27-
28-
- name: Install & update ClamAV DB
29-
run: |
30-
set -e
31-
sudo apt-get update
32-
sudo apt-get install -y clamav clamav-freshclam unzip
33-
sudo systemctl stop clamav-freshclam || true
34-
sudo mkdir -p /var/lib/clamav
35-
sudo chown -R clamav:clamav /var/lib/clamav
36-
sudo freshclam --verbose
37-
ls -lh /var/lib/clamav
38-
39-
- name: Extract bundle and scan
40-
run: |
41-
set -e
42-
rm -rf dist-release/extracted && mkdir -p dist-release/extracted
43-
unzip -q bundle/opencode.zip -d dist-release/extracted
44-
echo "File count in payload: $(find dist-release/extracted -type f | wc -l)"
45-
clamscan -ri --scan-archive=yes dist-release/extracted | tee clamav.log
46-
! grep -q 'Infected files: [1-9]' clamav.log
47-
48-
- name: Upload scan results
49-
uses: actions/upload-artifact@v4
50-
with:
51-
name: clamav-release-scan-results
52-
path: |
53-
clamav.log
54-
bundle/opencode.zip
11+
- run: echo 'Deprecated: use clam-av.yml'

.github/workflows/clam-av.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: av-clamav
2+
on:
3+
pull_request:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
actions: read
11+
12+
jobs:
13+
clamav:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Checkout the right ref
17+
- name: Checkout (release tag)
18+
if: github.event_name == 'release'
19+
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.event.release.tag_name }}
22+
- name: Checkout (PR/default)
23+
if: github.event_name != 'release'
24+
uses: actions/checkout@v4
25+
26+
# Single source-of-truth build -> one file
27+
- name: Build and package
28+
id: build
29+
uses: ./.github/actions/build-package
30+
31+
# Install fresh ClamAV DB
32+
- name: Install & update ClamAV DB
33+
run: |
34+
set -e
35+
sudo apt-get update
36+
sudo apt-get install -y clamav clamav-freshclam unzip
37+
sudo systemctl stop clamav-freshclam || true
38+
sudo mkdir -p /var/lib/clamav
39+
sudo chown -R clamav:clamav /var/lib/clamav
40+
sudo freshclam --verbose
41+
ls -lh /var/lib/clamav
42+
43+
# Scan extracted bundle so counts reflect actual files
44+
- name: Extract bundle and scan
45+
run: |
46+
set -e
47+
rm -rf scan && mkdir -p scan
48+
unzip -q bundle/opencode.zip -d scan
49+
echo "File count in payload: $(find scan -type f | wc -l)"
50+
clamscan -ri --scan-archive=yes scan | tee clamav.log
51+
! grep -q 'Infected files: [1-9]' clamav.log
52+
53+
- name: Upload scan results
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: clamav-scan-results
57+
path: |
58+
clamav.log
59+
bundle/opencode.zip

0 commit comments

Comments
 (0)