Skip to content

Commit bbf80bf

Browse files
authored
build: add built-from-source github action for semgrep (#1073)
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
1 parent e42408a commit bbf80bf

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
permissions:
16+
packages: write # to push the docker image
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
steps:
22+
# To update the semgrep version, please apply the following changes:
23+
# change the version tag in the 'name' description
24+
# change the 'ref' field to use the commit hash of that tag
25+
- name: Check out Semgrep v1.113.0 repository
26+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
27+
with:
28+
repository: semgrep/semgrep.git
29+
ref: 4729a05d24bf9cee8face447e8a6d418037d61d8 # v1.113.0
30+
fetch-depth: 1 # only need most recent commits to this tag
31+
submodules: recursive # semgrep uses many of their own ocaml submodules, which are required to build
32+
33+
- name: Build wheel through docker
34+
# we build to the 'semgrep-wheel' target as we don't need the performance testing, and want to extract the wheel
35+
run: |
36+
docker build --target semgrep-wheel -t semgrep .
37+
docker create --name temp semgrep
38+
mkdir -p wheels/
39+
docker cp temp:/semgrep/cli/dist/. wheels/
40+
docker container rm temp
41+
42+
- name: Log in to GitHub Container Registry
43+
run: docker login ghcr.io --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
44+
45+
# The manylinux image will be a static binary built using musl, suitable for Oracle linux
46+
- name: Build and push semgrep wheel image
47+
run: |
48+
cd wheels
49+
WHEEL=$(find . -type f -name 'semgrep-*manylinux*.whl')
50+
echo "FROM scratch
51+
COPY ${WHEEL} /semgrep_wheel.whl" >> Dockerfile.semgrep
52+
docker build -t ghcr.io/macaron/macaron-deps:latest -f Dockerfile.semgrep .
53+
docker push ghcr.io/macaron/macaron-deps:latest

0 commit comments

Comments
 (0)