Skip to content

Commit b7868df

Browse files
authored
Use pip direct URL syntax and support SCIO optional dependencies (#34)
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 13c2df8 commit b7868df

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
on: [push]
2+
3+
jobs:
4+
scan-codebase:
5+
runs-on: ubuntu-24.04
6+
name: Run Android D2D
7+
steps:
8+
- name: Get the action.yml from the current branch
9+
uses: actions/checkout@v4
10+
with:
11+
sparse-checkout: action.yml
12+
sparse-checkout-cone-mode: false
13+
14+
- uses: ./
15+
with:
16+
scancodeio-repo-branch: "bump-android"
17+
scancodeio-extras: "android_analysis"
18+
pipelines: "android_d2d"
19+
input-urls:
20+
https://github.com/aboutcode-org/scancode.io/raw/main/scanpipe/tests/data/d2d/jars/from-flume-ng-node-1.9.0.zip#from
21+
https://github.com/aboutcode-org/scancode.io/raw/main/scanpipe/tests/data/d2d/jars/to-flume-ng-node-1.9.0.zip#to

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ from your **GitHub Workflows**.
2525
- [Check for compliance issues](#check-for-compliance-issues)
2626
- [Define a custom project name](#define-a-custom-project-name)
2727
- [Install ScanCode.io from a repository branch](#install-scancodeio-from-a-repository-branch)
28+
- [Install ScanCode.io with optional dependencies](#install-scancodeio-with-optional-dependencies)
2829
- [Run source to binary mapping](#run-source-to-binary-mapping)
2930
- [Where does the scan results go?](#where-are-the-scan-results)
3031

@@ -227,6 +228,14 @@ Activate this behavior by enabling `check-compliance` and setting
227228
scancodeio-repo-branch: "main"
228229
```
229230

231+
### Install ScanCode.io with optional dependencies
232+
233+
```yaml
234+
- uses: aboutcode-org/scancode-action@beta
235+
with:
236+
scancodeio-extras: "android_analysis,mining"
237+
```
238+
230239
### Run source to binary mapping
231240

232241
Use this [workflow template](.github/workflows/map-deploy-to-develop-template.yml) for validating the integrity of open-source binary. It compares a project’s binary to its source code. Workflow will generate mapping between compiled binary and its original source code, which helps in spotting any malicious, unexpected, or otherwise undesirable code that may have made its way into the final binary.

action.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ inputs:
4444
description: "Branch to install ScanCode.io from the GitHub repository (optional)"
4545
required: false
4646
default: ""
47+
scancodeio-extras:
48+
description: "ScanCode.io optional dependencies (comma-separated) (optional)."
49+
required: false
50+
default: ""
4751

4852
runs:
4953
using: "composite"
@@ -84,16 +88,27 @@ runs:
8488
sudo -u postgres psql -c "ALTER USER ${{ env.SCANCODEIO_DB_USER }} WITH ENCRYPTED PASSWORD '${{ env.SCANCODEIO_DB_PASSWORD }}'"
8589
sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 ${{ env.SCANCODEIO_DB_NAME }}
8690
91+
- name: Generate scancodeio pip install argument
92+
if: env.SCANCODEIO_IS_INSTALLED != 'true'
93+
shell: bash
94+
run: |
95+
SCANCODEIO_PIP_PACKAGE_ARG="scancodeio"
96+
TRIMMED_EXTRAS="$(echo "${{ inputs.scancodeio-extras }}" | tr -d '[:space:]')"
97+
if [ -n "$TRIMMED_EXTRAS" ]; then
98+
SCANCODEIO_PIP_PACKAGE_ARG+="[$TRIMMED_EXTRAS]"
99+
fi
100+
echo "SCANCODEIO_PIP_PACKAGE_ARG=${SCANCODEIO_PIP_PACKAGE_ARG}" >> $GITHUB_ENV
101+
87102
- name: Install ScanCode.io (only if not already installed)
88103
if: env.SCANCODEIO_IS_INSTALLED != 'true'
89104
shell: bash
90105
run: |
91106
if [ -z "${{ inputs.scancodeio-repo-branch }}" ]; then
92-
echo "Installing the latest ScanCode.io release from PyPI"
93-
pip install --upgrade scancodeio
107+
echo "Installing the latest ${{ env.SCANCODEIO_PIP_PACKAGE_ARG }} release from PyPI"
108+
pip install --upgrade "${{ env.SCANCODEIO_PIP_PACKAGE_ARG }}"
94109
else
95-
echo "Installing ScanCode.io from the GitHub branch: ${{ inputs.scancodeio-repo-branch }}"
96-
pip install git+https://github.com/aboutcode-org/scancode.io.git@${{ inputs.scancodeio-repo-branch }}
110+
echo "Installing ${{ env.SCANCODEIO_PIP_PACKAGE_ARG }} from the GitHub branch: ${{ inputs.scancodeio-repo-branch }}"
111+
pip install "${{ env.SCANCODEIO_PIP_PACKAGE_ARG }} @ git+https://github.com/aboutcode-org/scancode.io.git@${{ inputs.scancodeio-repo-branch }}"
97112
fi
98113
99114
- name: Run migrations to prepare the database

0 commit comments

Comments
 (0)