|
| 1 | +# SPDX-FileCopyrightText: 2023-2024 Sony Semiconductor Solutions Corporation |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + builder-tag: |
| 9 | + description: The builder tag to be used |
| 10 | + default: latest |
| 11 | + required: false |
| 12 | + type: string |
| 13 | + package-namespace: |
| 14 | + description: The package namespace for docker images |
| 15 | + default: ${{ github.repository }} |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + ref: |
| 19 | + type: string |
| 20 | + required: true |
| 21 | + |
| 22 | +jobs: |
| 23 | + build-agent: |
| 24 | + name: Agent (${{ matrix.name }}, ${{ matrix.platform }}) |
| 25 | + runs-on: ${{ matrix.runner }} |
| 26 | + container: |
| 27 | + image: ghcr.io/${{ inputs.package-namespace }}/builder-${{ matrix.name }}:${{ inputs.builder-tag }} |
| 28 | + credentials: |
| 29 | + username: ${{ github.actor }} |
| 30 | + password: ${{ github.token }} |
| 31 | + options: ${{ startsWith(matrix.runner, 'buildjet') && '--user 1000:1001' || '--user 1001:127' }} |
| 32 | + timeout-minutes: 8 # the worst case is 3 minutes |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + include: |
| 37 | + - name: raspios-bookworm |
| 38 | + runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} |
| 39 | + platform: arm64 |
| 40 | + - name: ubuntu-noble |
| 41 | + runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} |
| 42 | + platform: arm64 |
| 43 | + - name: ubuntu-noble |
| 44 | + runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204' || 'ubuntu-24.04' }} |
| 45 | + platform: amd64 |
| 46 | + steps: |
| 47 | + - name: Checkout source |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + ref: ${{ inputs.ref }} |
| 51 | + |
| 52 | + - name: Build |
| 53 | + run: bear -- make -j$((`nproc` * 2)) CFLAGS="-g -Werror" |
| 54 | + |
| 55 | + - name: Generate SBOM |
| 56 | + run: | |
| 57 | + ./scripts/sources bin/evp_agent > sources.lst |
| 58 | + ./scripts/mk-sbom -d -c `dpkg -l libc6 | awk '/libc6/ {print $3}'` sources.lst |
| 59 | +
|
| 60 | + - name: Agent Debian Package |
| 61 | + run: make dist |
| 62 | + |
| 63 | + - name: Upload agent debian package |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: agent-deb-${{ matrix.name }}-${{ matrix.platform }}-${{ github.run_id }} |
| 67 | + path: evp-agent*.deb |
| 68 | + |
| 69 | + - name: Upload sdk debian package |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: libevp-app-sdk-dev-${{ matrix.name }}-${{ matrix.platform }}-${{ github.run_id }} |
| 73 | + path: libevp-app-sdk-dev*.deb |
| 74 | + |
| 75 | + - name: Upload SBOM |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: sbom-agent-${{ matrix.name }}-${{ matrix.platform }}-${{ github.run_id }} |
| 79 | + path: | |
| 80 | + compile_commands.json |
| 81 | + sources.lst |
| 82 | + sbom.tsv |
| 83 | + sbom-files.txt |
| 84 | + sbom-tmp.txt |
| 85 | +
|
| 86 | + build-sdk: |
| 87 | + name: SDK (${{ matrix.name }}, ${{ matrix.platform }}) |
| 88 | + runs-on: ${{ matrix.runner }} |
| 89 | + container: |
| 90 | + image: ghcr.io/${{ inputs.package-namespace }}/builder-${{ matrix.name }}:${{ inputs.builder-tag }} |
| 91 | + credentials: |
| 92 | + username: ${{ github.actor }} |
| 93 | + password: ${{ github.token }} |
| 94 | + options: ${{ startsWith(matrix.runner, 'buildjet') && '--user 1000:1001' || '--user 1001:127' }} |
| 95 | + timeout-minutes: 8 # the worst case is 3 minutes |
| 96 | + strategy: |
| 97 | + fail-fast: false |
| 98 | + matrix: |
| 99 | + include: |
| 100 | + - name: raspios-bookworm |
| 101 | + runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} |
| 102 | + platform: arm64 |
| 103 | + - name: ubuntu-noble |
| 104 | + runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} |
| 105 | + platform: arm64 |
| 106 | + - name: ubuntu-noble |
| 107 | + runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204' || 'ubuntu-24.04' }} |
| 108 | + platform: amd64 |
| 109 | + |
| 110 | + steps: |
| 111 | + - name: Checkout source |
| 112 | + uses: actions/checkout@v4 |
| 113 | + with: |
| 114 | + ref: ${{ inputs.ref }} |
| 115 | + |
| 116 | + - name: Build SDK |
| 117 | + run: make -j$((`nproc` * 2)) sdk \ |
| 118 | + CFLAGS="-O2 -Werror" \ |
| 119 | + KBUILD_DEFCONFIG=configs/linux-docker.config |
| 120 | + |
| 121 | + - name: Install python test dependencies |
| 122 | + working-directory: src/python-evp-app-sdk |
| 123 | + run: | |
| 124 | + python3 -m venv .venv |
| 125 | + . .venv/bin/activate |
| 126 | + pip install \ |
| 127 | + -e . \ |
| 128 | + -r requirements.test.txt |
| 129 | +
|
| 130 | + - name: Run python SDK tests |
| 131 | + working-directory: src/python-evp-app-sdk |
| 132 | + run: | |
| 133 | + . .venv/bin/activate |
| 134 | + python -m pytest \ |
| 135 | + --cov=evp.app \ |
| 136 | + --cov-report="xml:pysdk-cov.xml" \ |
| 137 | + --junit-xml="pysdk-test-res.xml" \ |
| 138 | + -v |
| 139 | +
|
| 140 | + - name: Publish pytest coverage |
| 141 | + id: pysdk-cov |
| 142 | + uses: MishaKav/pytest-coverage-comment@main |
| 143 | + if: always() |
| 144 | + with: |
| 145 | + title: EVP Python Application SDK coverage report |
| 146 | + badge-title: Python Application SDK |
| 147 | + coverage-path-prefix: src/python-evp-app-sdk/evp/app/ |
| 148 | + pytest-xml-coverage-path: src/python-evp-app-sdk/pysdk-cov.xml |
| 149 | + junitxml-path: src/python-evp-app-sdk/pysdk-test-res.xml |
| 150 | + junitxml-title: Python Application SDK test report |
| 151 | + |
| 152 | + - name: Publish pytest results to summary |
| 153 | + if: steps.pysdk-cov.outputs.summaryReport |
| 154 | + run: echo ${{ steps.pysdk-cov.outputs.summaryReport }} >> $GITHUB_STEP_SUMMARY |
| 155 | + |
| 156 | + - name: Build Python package |
| 157 | + working-directory: src/python-evp-app-sdk |
| 158 | + run: python3 -m build |
| 159 | + |
| 160 | + - name: SDK Debian package |
| 161 | + working-directory: src/python-evp-app-sdk |
| 162 | + run: python setup.py --command-packages=stdeb.command bdist_deb |
| 163 | + |
| 164 | + - uses: actions/upload-artifact@v4 |
| 165 | + with: |
| 166 | + name: python-sdk-${{ matrix.name }}-${{ matrix.platform }}-${{ github.run_id }} |
| 167 | + path: src/python-evp-app-sdk/dist/* |
| 168 | + |
| 169 | + - uses: actions/upload-artifact@v4 |
| 170 | + with: |
| 171 | + name: python-sdk-deb-${{ matrix.name }}-${{ matrix.platform }}-${{ github.run_id }} |
| 172 | + path: src/python-evp-app-sdk/deb_dist/*.deb |
| 173 | + |
| 174 | + run-static-analysis: |
| 175 | + name: Static Code Analysis |
| 176 | + runs-on: ubuntu-24.04 |
| 177 | + container: |
| 178 | + image: ghcr.io/${{ inputs.package-namespace }}/builder-ubuntu-noble:${{ inputs.builder-tag }} |
| 179 | + options: --user 1001:127 |
| 180 | + timeout-minutes: 8 # the worst case is 3 minutes |
| 181 | + |
| 182 | + steps: |
| 183 | + - name: Checkout source |
| 184 | + uses: actions/checkout@v4 |
| 185 | + with: |
| 186 | + ref: ${{ inputs.ref }} |
| 187 | + |
| 188 | + - name: Run cppcheck analysis |
| 189 | + run: make -j$((`nproc` * 2)) CFLAGS="-Werror" TOOL=cppcheck analysis |
0 commit comments