diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml new file mode 100644 index 000000000..be28fd32b --- /dev/null +++ b/.github/workflows/compliance.yml @@ -0,0 +1,98 @@ +name: License Compliance Checks + +on: + pull_request: + paths: + - '**/pyproject.toml' + schedule: + - cron: '0 0 * * *' # every day at midnight + +env: + GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_ALERT_CHANNEL: "#haystack" + +jobs: + check-license-compliance-cpu: + name: Check CPU dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Install Haystack (CPU) + # FIXME audio temporarily not checked as we plan to remove it in the near future + run: | + pip install --upgrade pip + pip install .[docstores,crawler,preprocessing,ocr,ray,onnx,beir] + pip install rest_api/ + pip install ui/ + + - name: Create file with full dependency list + run: | + pip freeze > requirements-full.txt + + - name: Send license report to Fossa + # This will collect all necessary information (mostly used dependencies) and send it to the Fossa API + uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # Use a specific version if locking is preferred + with: + api-key: ${{ secrets.FOSSA_LICENSE_SCAN_TOKEN }} + + - name: Check license compliance + # This will poll the Fossa API until they have processed the information which we've sent in the previous step + # and fail if Fossa found an issue with the licences of our dependencies. + uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # Use a specific version if locking is preferred + with: + api-key: ${{ secrets.FOSSA_LICENSE_SCAN_TOKEN }} + run-tests: true + + - name: Send Slack notification if license check failed + uses: act10ns/slack@87c73aef9f8838eb6feae81589a6b1487a4a9e08 + if: failure() && github.ref == 'refs/heads/master' + with: + status: ${{ job.status }} + channel: ${{ env.SLACK_ALERT_CHANNEL }} + + check-license-compliance-gpu: + name: Check GPU dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Install Haystack + # FIXME audio temporarily not checked as we plan to remove it in the near future + run: | + pip install --upgrade pip + pip install .[docstores-gpu,crawler,preprocessing,ocr,ray,onnx-gpu] + + - name: Create file with full dependency list + run: | + pip freeze > requirements-full.txt + + - name: Send license report to Fossa + # This will collect all necessary information (mostly used dependencies) and send it to the Fossa API + uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # Use a specific version if locking is preferred + with: + api-key: ${{ secrets.FOSSA_LICENSE_SCAN_TOKEN }} + + - name: Check license compliance + # This will poll the Fossa API until they have processed the information which we've sent in the previous step + # and fail if Fossa found an issue with the licences of our dependencies. + uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # Use a specific version if locking is preferred + with: + api-key: ${{ secrets.FOSSA_LICENSE_SCAN_TOKEN }} + run-tests: true + + - name: Send Slack notification if license check failed + uses: act10ns/slack@87c73aef9f8838eb6feae81589a6b1487a4a9e08 + if: failure() && github.ref == 'refs/heads/master' + with: + status: ${{ job.status }} + channel: ${{ env.SLACK_ALERT_CHANNEL }} diff --git a/README.md b/README.md index 7d77d4a82..0957e9ba0 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ Documentation + + FOSSA Status + Release diff --git a/pyproject.toml b/pyproject.toml index a243e3afd..331d250a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,7 +310,6 @@ max-args=7 [tool.pylint.'SIMILARITIES'] min-similarity-lines=6 - [tool.pytest.ini_options] minversion = "6.0" addopts = "--strict-markers" diff --git a/rest_api/pyproject.toml b/rest_api/pyproject.toml index 6cb1a3d63..9d8303cb5 100644 --- a/rest_api/pyproject.toml +++ b/rest_api/pyproject.toml @@ -66,9 +66,7 @@ python = ["37", "38", "39", "310"] [tool.coverage.run] branch = true parallel = true -omit = [ - "rest_api/__about__.py", -] +omit = ["rest_api/__about__.py"] [tool.coverage.report] exclude_lines = [ diff --git a/ui/pyproject.toml b/ui/pyproject.toml index 7acb6cbe4..6dccf2cb8 100644 --- a/ui/pyproject.toml +++ b/ui/pyproject.toml @@ -57,9 +57,7 @@ python = ["37", "38", "39", "310"] [tool.coverage.run] branch = true parallel = true -omit = [ - "ui/__about__.py", -] +omit = ["ui/__about__.py"] [tool.coverage.report] exclude_lines = [