···1818 - name: test
1919 run: go test ./...
20202121+ shellcheck:
2222+ name: shellcheck
2323+ runs-on: ubuntu-latest
2424+ steps:
2525+ - uses: actions/checkout@v2
2626+ - name: Run ShellCheck
2727+ uses: ludeeus/action-shellcheck@1.1.0
2828+2129 # We build a shared docker image called "zoekt". This is not pushed, but is
2230 # used for creating the indexserver and webserver images.
2331 docker:
2432 if: github.ref == 'refs/heads/master'
2533 runs-on: ubuntu-latest
2626- needs: test
3434+ needs:
3535+ - "test"
3636+ - "shellcheck"
2737 steps:
2838 - name: checkout
2939 uses: actions/checkout@v2
-51
build-deploy.sh
···11-#!/bin/bash
22-33-# this script packages up all the binaries, and a script (deploy.sh)
44-# to twiddle with the server and the binaries
55-66-set -ex
77-88-# Put the date first so we can sort.
99-if [[ -z "$VERSION" ]]; then
1010- VERSION=$(date --iso-8601=minutes | tr -d ':' | sed 's|\+.*$||')
1111- if [[ -d .git ]]; then
1212- VERSION=${VERSION}-$(git show --pretty=format:%h -q)
1313- fi
1414-fi
1515-1616-set -u
1717-1818-out=zoekt-${VERSION}
1919-mkdir -p ${out}
2020-2121-for d in $(find cmd -maxdepth 1 -type d)
2222-do
2323- go build -tags netgo -ldflags "-X github.com/google/zoekt.Version=$VERSION" -o ${out}/$(basename $d) github.com/google/zoekt/$d
2424-done
2525-2626-cat <<EOF > ${out}/deploy.sh
2727-#!/bin/bash
2828-2929-echo "Set the following in the environment."
3030-echo ""
3131-echo ' export PATH="'$PWD'/bin:$PATH'
3232-echo ""
3333-3434-set -eux
3535-3636-# Allow sandbox to create NS's
3737-sudo sh -c 'echo 1 > /proc/sys/kernel/unprivileged_userns_clone'
3838-3939-# we mmap the entire index, but typically only want the file contents.
4040-sudo sh -c 'echo 1 >/proc/sys/vm/overcommit_memory'
4141-4242-# allow bind to 80 and 443
4343-sudo setcap 'cap_net_bind_service=+ep' bin/zoekt-webserver
4444-4545-EOF
4646-4747-chmod 755 ${out}/*
4848-4949-tar --owner=root --group=root -czf zoekt-deploy-${VERSION}.tar.gz ${out}/*
5050-5151-rm -rf ${out}
+1-1
indexbuilder.go
···3737 data []byte
3838}
39394040-// Filled by the linker (see build-deploy.sh)
4040+// Filled by the linker
4141var Version string
42424343// Store character (unicode codepoint) offset (in bytes) this often.