Skip to content

build-test-windows-x86 #8

build-test-windows-x86

build-test-windows-x86 #8

# AUTOGENERATED FROM build-test-windows-x86.jsonnet DO NOT MODIFY
jobs:
job:
defaults:
run:
shell: bash
runs-on: windows-latest
steps:
- run: git config --system core.longpaths true
- name: Make checkout speedy
run: git config --global fetch.parallel 50
- uses: actions/checkout@v3
with:
submodules: true
- uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: "4.14"
opam-local-packages: dont_install_local_packages.opam
opam-repositories: |
opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
default: https://github.com/ocaml/opam-repository.git
- env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
name: Set GHA cache for OPAM in _opam
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ runner.arch }}-opam-deps-4.14.0-${{ hashFiles('semgrep.opam') }}
path: _opam
- env:
CC: x86_64-w64-mingw32-gcc
name: Build tree-sitter
run: |
cd libs/ocaml-tree-sitter-core
./configure
./scripts/download-tree-sitter --lazy
prefix="$(pwd)/tree-sitter"
cd downloads/tree-sitter
make PREFIX="$prefix" CFLAGS="-O3 -Wall -Wextra"
make PREFIX="$prefix" install
- name: Install OPAM deps
run: |
export PATH="${CYGWIN_ROOT_BIN}:${PATH}"
make install-deps-WINDOWS-for-semgrep-core
make install-opam-deps
- name: Build semgrep-core
run: |
export PATH=\"${CYGWIN_ROOT_BIN}:${PATH}\"
export TREESITTER_INCDIR=$(pwd)/libs/ocaml-tree-sitter-core/tree-sitter/include
export TREESITTER_LIBDIR=$(pwd)/libs/ocaml-tree-sitter-core/tree-sitter/lib
# We have to strip rpath from the tree-sitter projects because there's no
# equivalent in Windows
# TODO: investigate removing rpath from the tree-sitter projects
for filename in $(find ./languages/ ./libs/ocaml-tree-sitter-core/ -name dune); do
grep -v rpath $filename > $filename.new
mv $filename.new $filename
done
opam exec -- dune build _build/install/default/bin/semgrep-core.exe
- name: Test semgrep-core
run: |
echo 'print(\"foo\")' > test.py
_build/install/default/bin/semgrep-core.exe -e 'print($X)' -lang python -json test.py
- name: Package semgrep-core
run: |
mkdir archive
cp _build/install/default/bin/semgrep-core.exe archive/
# TODO: somehow upgrade to the latest flexdll, which should allow us to statically link these libraries
cp d:/cygwin/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll archive/
cp d:/cygwin/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll archive/
cp d:/cygwin/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll archive/
cp d:/cygwin/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpcre-1.dll archive/
cp d:/cygwin/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgmp-10.dll archive/
cd archive
tar czvf ocaml-build-artifacts.tgz *.exe *.dll
- uses: actions/upload-artifact@v3
with:
name: ocaml-build-artifacts-release-w64
path: archive/ocaml-build-artifacts.tgz
name: build-test-windows-x86
"on":
workflow_call: null
workflow_dispatch: null