fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

ci: run tests with ctags (#309)

This makes ctags available during testing on CI. The goal is to add tests for scoring which rely on ctags.

The script `install-ctags-alpine.sh`, which is shared between CI and the Dockerfile, is a pointer to the
ctags installer in the sourcegraph/sourcegraph.

+49 -56
+41 -40
.github/workflows/ci.yml
··· 7 7 jobs: 8 8 test: 9 9 runs-on: ubuntu-latest 10 + container: alpine:3.15 10 11 steps: 11 - - name: go 12 - uses: actions/setup-go@v1 13 - with: 14 - go-version: 1.16.x 15 - - name: checkout 16 - uses: actions/checkout@v2 17 - - name: test 18 - run: go test ./... 12 + - name: checkout 13 + uses: actions/checkout@v2 14 + - name: add dependencies 15 + run: apk add go git 16 + - name: install ctags 17 + run: ./install-ctags-alpine.sh 18 + - name: test 19 + run: go test ./... 19 20 20 21 # We build a shared docker image called "zoekt". This is not pushed, but is 21 22 # used for creating the indexserver and webserver images. ··· 24 25 runs-on: ubuntu-latest 25 26 needs: test 26 27 steps: 27 - - name: checkout 28 - uses: actions/checkout@v2 28 + - name: checkout 29 + uses: actions/checkout@v2 29 30 30 - # This is the same tag we used for zoekt in the infrastructure repo. 31 - - name: version 32 - id: version 33 - run: .github/workflows/docker-version.sh 31 + # This is the same tag we used for zoekt in the infrastructure repo. 32 + - name: version 33 + id: version 34 + run: .github/workflows/docker-version.sh 34 35 35 - - name: build-zoekt 36 - uses: docker/build-push-action@v1 37 - with: 38 - repository: zoekt 39 - tags: "latest" 40 - add_git_labels: "true" 41 - push: "false" 42 - build_args: VERSION=${{ steps.version.outputs.value }} 36 + - name: build-zoekt 37 + uses: docker/build-push-action@v1 38 + with: 39 + repository: zoekt 40 + tags: "latest" 41 + add_git_labels: "true" 42 + push: "false" 43 + build_args: VERSION=${{ steps.version.outputs.value }} 43 44 44 - - name: build-push-webserver 45 - uses: docker/build-push-action@v1 46 - with: 47 - repository: sourcegraph/zoekt-webserver 48 - tags: ${{ steps.version.outputs.value }},latest 49 - dockerfile: Dockerfile.webserver 50 - add_git_labels: "true" 51 - username: ${{ secrets.DOCKER_USERNAME }} 52 - password: ${{ secrets.DOCKER_PASSWORD }} 45 + - name: build-push-webserver 46 + uses: docker/build-push-action@v1 47 + with: 48 + repository: sourcegraph/zoekt-webserver 49 + tags: ${{ steps.version.outputs.value }},latest 50 + dockerfile: Dockerfile.webserver 51 + add_git_labels: "true" 52 + username: ${{ secrets.DOCKER_USERNAME }} 53 + password: ${{ secrets.DOCKER_PASSWORD }} 53 54 54 - - name: build-push-indexserver 55 - uses: docker/build-push-action@v1 56 - with: 57 - repository: sourcegraph/zoekt-indexserver 58 - tags: ${{ steps.version.outputs.value }},latest 59 - dockerfile: Dockerfile.indexserver 60 - add_git_labels: "true" 61 - username: ${{ secrets.DOCKER_USERNAME }} 62 - password: ${{ secrets.DOCKER_PASSWORD }} 55 + - name: build-push-indexserver 56 + uses: docker/build-push-action@v1 57 + with: 58 + repository: sourcegraph/zoekt-indexserver 59 + tags: ${{ steps.version.outputs.value }},latest 60 + dockerfile: Dockerfile.indexserver 61 + add_git_labels: "true" 62 + username: ${{ secrets.DOCKER_USERNAME }} 63 + password: ${{ secrets.DOCKER_PASSWORD }}
+2 -4
Dockerfile
··· 18 18 RUN apk update --no-cache && apk upgrade --no-cache && \ 19 19 apk add --no-cache git ca-certificates bind-tools tini jansson 20 20 21 - # Commit from 2022-03-01. Please always pick a commit from the main branch. 22 - ENV SOURCEGRAPH_COMMIT=20497508d57afd4bbd35597629779255d772a7f8 23 - ADD https://raw.githubusercontent.com/sourcegraph/sourcegraph/$SOURCEGRAPH_COMMIT/cmd/symbols/ctags-install-alpine.sh /tmp/ 24 - RUN sh /tmp/ctags-install-alpine.sh && rm /tmp/ctags-install-alpine.sh 21 + COPY install-ctags-alpine.sh . 22 + RUN ./install-ctags-alpine.sh && rm install-ctags-alpine.sh 25 23 26 24 COPY --from=builder /go/bin/* /usr/local/bin/ 27 25
+1 -12
build/e2e_test.go
··· 457 457 458 458 for i := 0; i < 4; i++ { 459 459 nm := fmt.Sprintf("F%d", i) 460 - 461 - // no error checking: the 2nd call will fail 462 460 _ = b.AddFile(nm, []byte(strings.Repeat("01234567\n", 128))) 463 - if i == 1 { 464 - // force writes to fail. 465 - if err := os.Chmod(dir, 0o555); err != nil { 466 - t.Fatalf("chmod(%s): %s", dir, err) 467 - } 468 - } 469 461 } 470 - 471 - if err := os.Chmod(dir, 0o755); err != nil { 472 - t.Fatalf("chmod(%s, writable): %s", dir, err) 473 - } 462 + b.buildError = fmt.Errorf("any error") 474 463 475 464 // No error checking. 476 465 _ = b.Finish()
+5
install-ctags-alpine.sh
··· 1 + #!/bin/sh 2 + set -x 3 + # Commit from 2022-03-01. Please always pick a commit from the main branch. 4 + export SOURCEGRAPH_COMMIT=20497508d57afd4bbd35597629779255d772a7f8 5 + wget -O - https://raw.githubusercontent.com/sourcegraph/sourcegraph/$SOURCEGRAPH_COMMIT/cmd/symbols/ctags-install-alpine.sh | sh