From 45c1c68d57b2b4086866051536bbbcb1f6ce4432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindstr=C3=B6m?= Date: Sat, 11 May 2024 20:11:27 +0200 Subject: [PATCH] Add ccls language server From https://github.com/MaskRay/ccls (cherry picked from commit 601937c45fbe1a26f98c26e771985b4b23c9fb5e) Add build action to publish from my account until it's been merged upstream. --- .github/workflows/build-image.yml | 120 ++++-------------------------- docker-compose.yaml | 5 ++ servers/ccls/Dockerfile | 20 +++++ 3 files changed, 38 insertions(+), 107 deletions(-) create mode 100644 servers/ccls/Dockerfile diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index e7eaae8..faf22ab 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,11 +1,13 @@ -name: Push LSP Docker Images +--- +name: Build and push LSP Docker Images on: pull_request: push: - branches: [main] + branches: + - main schedule: - - cron: '0 3 * * *' + - cron: '0 3 0 * *' jobs: build_and_push: @@ -15,112 +17,16 @@ jobs: fail-fast: false matrix: include: - - context: bashls - tag: bash-language-server - - - context: clangd - tag: clangd-language-server - - - context: denols - tag: denols - - - context: dockerls - tag: docker-language-server - - - context: eslintls - tag: eslint-language-server - - - context: gopls - tag: gopls - - - context: graphql-lsp - tag: graphql-language-service-cli - - - context: html - tag: html-language-server - - - context: intelephense - tag: intelephense - - - context: jsonls - tag: json-language-server - - - context: lemminx - tag: lemminx - - - context: omnisharp - tag: omnisharp - - - context: powershell_es - tag: powershell-language-server - - - context: prisma - tag: prisma-language-server - - - context: pylsp - tag: python-lsp-server - - - context: pyright - tag: pyright-langserver - - - context: rust_analyzer - tag: rust-analyzer - - - context: solargraph - tag: solargraph - - - context: sumneko_lua - tag: lua-language-server - - - context: svelteserver - tag: svelte-language-server - - - context: tailwindcss - tag: tailwindcss-language-server - - - context: terraformls - tag: terraform-ls - - - context: tsserver - tag: typescript-language-server - - - context: volar - tag: volar - - - context: vuels - tag: vue-language-server - - - context: yamlls - tag: yaml-language-server - + - context: ccls + tag: ccls steps: - name: Check out the repo uses: actions/checkout@v4 - # TODO: Replace w/ Github Action - https://github.com/lspcontainers/dockerfiles/runs/2724936969?check_suite_focus=true#step:4:7 - - name: Run hadolint - run: > - docker container run - --entrypoint hadolint - --rm - --volume $(pwd):/code - --workdir /code - hadolint/hadolint:latest-alpine - servers/${{ matrix.context }}/Dockerfile - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - if: ${{ github.ref == 'refs/heads/main' }} - - - name: Build and push to Docker Hub - uses: docker/build-push-action@v5 + - name: Build and push image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: - context: servers/${{ matrix.context }} - push: ${{ github.ref == 'refs/heads/main' }} - tags: lspcontainers/${{ matrix.tag }}:latest + context: servers/${{matrix.context}} + file: ./Dockerfile + push: true + outputs: type=image,name=${{matrix.tag}},annotation-index.org.opencontainers.image.description=ccls diff --git a/docker-compose.yaml b/docker-compose.yaml index 9bb80e1..e595be7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,6 +6,11 @@ services: build: context: servers/bashls + ccls: + image: lspcontainers/ccls + build: + context: servers/clangd + clangd: image: lspcontainers/clangd-language-server build: diff --git a/servers/ccls/Dockerfile b/servers/ccls/Dockerfile new file mode 100644 index 0000000..00148a8 --- /dev/null +++ b/servers/ccls/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine as builder + +RUN apk add --no-cache clang17-dev clang17-static llvm17-dev llvm17-static llvm17-gtest cmake make git +RUN git clone --depth=1 --recursive https://github.com/MaskRay/ccls /ccls + +WORKDIR /ccls + +RUN cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/bin/clang++-17 \ + -DCMAKE_PREFIX_PATH=/usr/lib/llvm17 +RUN cmake --build Release +RUN cmake --build Release --target install + +FROM alpine + +RUN apk add --no-cache clang17 + +COPY --from=builder /usr/local/bin/ccls /usr/local/bin/ccls + +CMD ["/usr/local/bin/ccls"]