haystack/.github/workflows/compliance.yml
Silvano Cerza 3782ebc835
ci: Fix slack messages formatting (#4556)
* Fix slack messages formatting

* Remove unneeded file
2023-03-30 10:56:20 +02:00

192 lines
7.4 KiB
YAML

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_WEBHOOK_TYPE: INCOMING_WEBHOOK
jobs:
check-license-compliance-cpu:
if: ${{ !github.event.pull_request.head.repo.fork }}
name: Check CPU dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- 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/
- 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
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
check-license-compliance-gpu:
if: ${{ !github.event.pull_request.head.repo.fork }}
name: Check GPU dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- 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
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}