-
Notifications
You must be signed in to change notification settings - Fork 25
89 lines (83 loc) · 2.67 KB
/
ci.yml
File metadata and controls
89 lines (83 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: CI-WORKFLOW
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
env:
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
API_KEY: ${{ secrets.API_KEY }}
jobs:
run-cyclonedx:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to the github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate CycloneDX SBOM
run: |
docker pull ghcr.io/cyclonedx/cdxgen-python:v11
docker run --rm -e FETCH_LICENSE=true -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen-python310:v11 -r /app -o /app/sbom.json -t python --profile license-compliance
- name: Upload BOM to Dependency-Track
run: |
curl -v -X POST https://${{ secrets.DEPENDENCYTRACK_HOSTNAME }}/api/v1/bom \
-H 'Content-Type: multipart/form-data' \
-H 'X-Api-Key: ${{ secrets.DEPENDENCYTRACK_APIKEY }}' \
-F 'autoCreate=true' \
-F 'projectName=python' \
-F 'projectVersion= ${{ github.sha }}' \
-F 'parentName=sift-python' \
-F 'isLatest=true' \
-F "bom=@sbom.json"
#- name: Upload BOM to Dependency-Track
# uses: DependencyTrack/gh-upload-sbom@v3
# with:
# serverHostname: ${{ secrets.DEPENDENCYTRACK_HOSTNAME }}
# apiKey: ${{ secrets.DEPENDENCYTRACK_APIKEY }}
# projectName: 'python'
# projectVersion: ${{ github.sha }}
# bomFilename: "sbom.json"
# autoCreate: true
# parentName: 'sift-python'
# env:
# ACTIONS_STEP_DEBUG: true
build-and-test-python3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.14"
- name: Install the library
run: |
pip install -e .
- name: Run linters
run: |
pip install -U pre-commit
pre-commit run -v --all-files
- name: Run tests
run: |
python -m unittest discover
run-integration-tests-python3:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.14"
- name: Run integration tests
run: |
pip install .
python test_integration_app/main.py