Skip to content

Commit 4e934c7

Browse files
committed
ci(clamav-pr): use shared build-package composite; produce single bundle/opencode.zip; scan extracted bundle
1 parent ec148ff commit 4e934c7

1 file changed

Lines changed: 14 additions & 29 deletions

File tree

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

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,39 @@ on:
55
permissions:
66
contents: read
77

8-
defaults:
9-
run:
10-
shell: bash
11-
128
jobs:
139
clamav-pr:
1410
runs-on: ubuntu-latest
1511
steps:
1612
- uses: actions/checkout@v4
1713

18-
- name: Setup Bun
19-
uses: ./.github/actions/setup-bun
20-
21-
- name: Verify Bun
22-
run: bun --version
23-
24-
- name: Install dependencies (Bun)
25-
run: bun install --frozen-lockfile || bun install
26-
27-
- name: Build (Bun)
28-
run: bun run build
14+
- name: Build and package
15+
id: build
16+
uses: ./.github/actions/build-package
2917

30-
- name: Package build outputs
31-
run: |
32-
set -e
33-
rm -rf dist-pr/payload
34-
mkdir -p dist-pr/payload
35-
rsync -a --exclude '.git' --exclude '.github' --exclude 'node_modules' ./ dist-pr/payload/
36-
tar -czf dist-pr/scan.tgz -C dist-pr/payload .
37-
ls -lh dist-pr/scan.tgz
18+
- name: Upload build bundle
19+
uses: actions/upload-artifact@v4
20+
with:
21+
name: opencode-bundle
22+
path: bundle/opencode.zip
3823

3924
- name: Install & update ClamAV DB
4025
run: |
4126
set -e
4227
sudo apt-get update
43-
sudo apt-get install -y clamav clamav-freshclam
28+
sudo apt-get install -y clamav clamav-freshclam unzip
4429
sudo systemctl stop clamav-freshclam || true
4530
sudo mkdir -p /var/lib/clamav
4631
sudo chown -R clamav:clamav /var/lib/clamav
4732
sudo freshclam --verbose
4833
ls -lh /var/lib/clamav
4934
50-
- name: ClamAV scan (extract and scan all files)
35+
- name: Extract bundle and scan
5136
run: |
5237
set -e
53-
mkdir -p dist-pr/extracted
54-
tar -xzf dist-pr/scan.tgz -C dist-pr/extracted
55-
echo 'File count in payload: '$(find dist-pr/extracted -type f | wc -l)
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)"
5641
clamscan -ri --scan-archive=yes dist-pr/extracted | tee clamav-pr.log
5742
! grep -q 'Infected files: [1-9]' clamav-pr.log
5843
@@ -62,4 +47,4 @@ jobs:
6247
name: clamav-pr-scan-results
6348
path: |
6449
clamav-pr.log
65-
dist-pr/scan.tgz
50+
bundle/opencode.zip

0 commit comments

Comments
 (0)