|
| 1 | +# Copyright (c) 2025 - 2025, Oracle and/or its affiliates. All rights reserved. |
| 2 | +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. |
| 3 | + |
| 4 | +name: Build Semgrep Wheel Artifact |
| 5 | + |
| 6 | +on: workflow_dispatch |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-semgrep-wheel: |
| 13 | + name: Build Semgrep wheel |
| 14 | + runs-on: ubuntu-latest |
| 15 | + defaults: |
| 16 | + run: |
| 17 | + shell: bash |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Install git # for cloning Semgrep repository |
| 21 | + run: | |
| 22 | + sudo apt-get install git |
| 23 | +
|
| 24 | + - name: Clone Semgrep v1.113.0 repository |
| 25 | + run: | |
| 26 | + git init |
| 27 | + git remote add origin https://github.com/semgrep/semgrep.git |
| 28 | + git fetch --depth 1 origin 4729a05d24bf9cee8face447e8a6d418037d61d8 |
| 29 | + git checkout FETCH_HEAD |
| 30 | + git submodule update --init --recursive --depth 1 |
| 31 | +
|
| 32 | + - name: Build wheel through docker |
| 33 | + run: | |
| 34 | + docker build --target semgrep-wheel -t semgrep . |
| 35 | + docker create --name temp semgrep |
| 36 | + mkdir -p dist/ |
| 37 | + docker cp temp:/semgrep/cli/dist/ dist/ |
| 38 | + docker container rm temp |
| 39 | +
|
| 40 | + - name: Get wheel name |
| 41 | + run: | |
| 42 | + WHEELS=($(find ./dist -type f -name "*manylinux*.whl")) |
| 43 | + if [ "${WHEELS[@]}" -ne 1]; then |
| 44 | + echo "Expected a single wheel file built by semgrep dockerfile" |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | + echo "WHEEL_PATH=${WHEELS[0]}" >> "$GITHUB_ENV" |
| 48 | +
|
| 49 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 50 | + with: |
| 51 | + name: semgrep_wheel_manylinux.whl |
| 52 | + path: ${{ env.WHEEL_PATH }} |
| 53 | + if-no-files-found: error |
| 54 | + compression-level: 0 # don't compress the wheel file |
| 55 | + retention-days: 90 # uploaded wheel valid for 90 days, before workflow must be run again |
0 commit comments