Skip to content

Commit 9a78f33

Browse files
author
Prabhu Subramanian
authored
Merge pull request #1 from ngcloudsec/feature/bundle-all
Feature/bundle all
2 parents 769fa1b + 80707be commit 9a78f33

File tree

2 files changed

+135
-8
lines changed

2 files changed

+135
-8
lines changed

.github/workflows/ubuntu.yml

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,43 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
Depscan-GNU-Build:
8+
Depscan-Linux-Build:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v3
12-
- name: Checkout tools repo
12+
- name: Checkout dep-scan
1313
uses: actions/checkout@v3
1414
with:
1515
repository: AppThreat/dep-scan
1616
path: dep-scan
17+
- name: Checkout cdxgen
18+
uses: actions/checkout@v3
19+
with:
20+
repository: AppThreat/cdxgen
21+
path: cdxgen
22+
- name: Checkout cdxgen
23+
uses: actions/checkout@v3
24+
with:
25+
repository: ngcloudsec/cdxgen-plugins-bin
26+
path: cdxgen-plugins-bin
1727
- uses: actions/setup-python@v4
1828
with:
1929
python-version: '3.10'
30+
- name: Use Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 18.x
34+
- uses: actions/setup-go@v3
35+
with:
36+
go-version: '^1.19.1'
37+
- uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cache/go-build
41+
~/go/pkg/mod
42+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43+
restore-keys: |
44+
${{ runner.os }}-go-
2045
- name: Install pyinstaller
2146
run: |
2247
python3 -m pip install twine setuptools wheel pyinstaller
@@ -26,22 +51,41 @@ jobs:
2651
tar -xvf upx-4.0.0-amd64_linux.tar.xz
2752
chmod +x upx-4.0.0-amd64_linux/upx
2853
sudo cp upx-4.0.0-amd64_linux/upx /usr/local/bin/
29-
- name: Binary gnu build
54+
- name: Produce cdxgen pkg
55+
run: |
56+
sudo npm install -g pkg
57+
cd cdxgen
58+
npm install
59+
pkg -t node18-linux package.json --out-path dist
60+
chmod +x dist/cdxgen
61+
./dist/cdxgen --version
62+
- name: Build cdxgen plugins
63+
run: |
64+
cd cdxgen-plugins-bin
65+
bash build.sh
66+
- name: Binary amd64 build
3067
run: |
3168
cd dep-scan
32-
pyinstaller depscan/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name depscan --collect-all depscan --upx-dir /usr/local/bin
33-
./dist/depscan --help
34-
./dist/depscan -i . -o /tmp/depscan.json
69+
pyinstaller depscan/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name depscan-linux-amd64 --add-data="vendor:vendor" --add-binary="../cdxgen/dist/cdxgen:local_bin" --add-binary="../cdxgen-plugins-bin/plugins/osquery/osqueryi-linux-amd64:local_bin/osquery" --add-binary="../cdxgen-plugins-bin/plugins/goversion/goversion-linux-amd64:local_bin/goversion" --add-binary="../cdxgen-plugins-bin/plugins/trivy/trivy-cdxgen-linux-amd64:local_bin/trivy" --add-binary="../cdxgen-plugins-bin/plugins/cargo-auditable/cargo-auditable-cdxgen-linux-amd64:local_bin/cargo-auditable" --collect-submodules depscan --upx-dir /usr/local/bin
70+
sha256sum ./dist/depscan-linux-amd64 > ./dist/depscan-linux-amd64.sha256
71+
./dist/depscan-linux-amd64 --help
72+
./dist/depscan-linux-amd64 -i . -o /tmp/depscan.json
73+
- name: BLint
74+
run: |
75+
pip3 install blint
76+
blint -i dist -o /tmp/reports
3577
env:
3678
PYTHONIOENCODING: utf-8
3779
LANG: en_US.utf-8
3880
- uses: actions/upload-artifact@v1
81+
if: startsWith(github.ref, 'refs/tags/') != true
3982
with:
4083
path: ./dep-scan/dist
41-
name: depscan-linux-gnu
84+
name: depscan-linux-amd64
4285
- name: Release
4386
uses: softprops/action-gh-release@v1
4487
if: startsWith(github.ref, 'refs/tags/')
4588
with:
4689
files: |
47-
dep-scan/dist/depscan
90+
dep-scan/dist/depscan-linux-amd64
91+
dep-scan/dist/depscan-linux-amd64.sha256

.github/workflows/win.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build Windows Binaries
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
Depscan-Windows-Build:
9+
runs-on: windows-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Checkout dep-scan
13+
uses: actions/checkout@v3
14+
with:
15+
repository: AppThreat/dep-scan
16+
path: dep-scan
17+
- name: Checkout cdxgen
18+
uses: actions/checkout@v3
19+
with:
20+
repository: AppThreat/cdxgen
21+
path: cdxgen
22+
- name: Checkout cdxgen
23+
uses: actions/checkout@v3
24+
with:
25+
repository: ngcloudsec/cdxgen-plugins-bin
26+
path: cdxgen-plugins-bin
27+
- uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.10'
30+
- name: Use Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 18.x
34+
- uses: actions/setup-go@v3
35+
with:
36+
go-version: '^1.19.1'
37+
- uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cache/go-build
41+
~/go/pkg/mod
42+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43+
restore-keys: |
44+
${{ runner.os }}-go-
45+
- name: Install pyinstaller
46+
run: |
47+
python -m pip install twine setuptools wheel pyinstaller tzdata
48+
cd dep-scan
49+
pip install -r requirements.txt
50+
pyinstaller --help
51+
- name: Produce cdxgen pkg
52+
run: |
53+
npm install -g pkg
54+
cd cdxgen
55+
npm install
56+
pkg -t node18-win package.json --out-path dist
57+
.\dist\cdxgen.exe --version
58+
- name: Build cdxgen plugins
59+
run: |
60+
cd cdxgen-plugins-bin
61+
.\build.ps1
62+
- name: Binary windows build
63+
run: |
64+
cd dep-scan
65+
Invoke-WebRequest -Uri https://github.com/upx/upx/releases/download/v4.0.0/upx-4.0.0-win64.zip -UseBasicParsing -OutFile upx-4.0.0-win64.zip
66+
Expand-Archive -Path upx-4.0.0-win64.zip -DestinationPath . -Force
67+
68+
pyinstaller depscan/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name depscan --add-data="vendor;vendor" --add-binary="../cdxgen/dist/cdxgen.exe;local_bin" --add-binary="../cdxgen-plugins-bin/plugins/osquery/osqueryi-windows-amd64.exe;local_bin/osquery" --add-binary="../cdxgen-plugins-bin/plugins/goversion/goversion-windows-amd64.exe;local_bin/goversion" --add-binary="../cdxgen-plugins-bin/plugins/cargo-auditable/cargo-auditable-windows-amd64.exe;local_bin/cargo-auditable" --collect-submodules depscan --disable-windowed-traceback -i ../depscan.ico --version-file=../file_version_info.txt --upx-dir upx-4.0.0-win64
69+
.\dist\depscan.exe --help
70+
env:
71+
PYTHONIOENCODING: utf-8
72+
LANG: en_US.utf-8
73+
- uses: actions/upload-artifact@v1
74+
if: startsWith(github.ref, 'refs/tags/') != true
75+
with:
76+
path: dep-scan/dist
77+
name: depscan-windows
78+
- name: Release
79+
uses: softprops/action-gh-release@v1
80+
if: startsWith(github.ref, 'refs/tags/')
81+
with:
82+
files: |
83+
dep-scan/dist/depscan.exe

0 commit comments

Comments
 (0)