forked from semgrep/semgrep
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (81 loc) · 3.43 KB
/
build-test-windows-x86.yml
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
# 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