diff --git a/.editorconfig b/.editorconfig index b9c69ddd1..14039a4e7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,6 @@ indent_size = 2 [*.md] indent_size = 2 + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index f647cce77..796ca9ff4 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -9,6 +9,7 @@ on: pull_request: branches: - main + workflow_dispatch: jobs: build: diff --git a/.github/workflows/ls-clangd.yml b/.github/workflows/ls-clangd.yml new file mode 100644 index 000000000..f53b44e4e --- /dev/null +++ b/.github/workflows/ls-clangd.yml @@ -0,0 +1,91 @@ +name: Clangd LS Image + +on: + push: + branches: + - 'clangd-example' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + REPO_NAME: ${{ github.repository }} + PATH_CONTEXT: ./packages/examples/resources/clangd + CONTAINER_NAME_CONFIGURE: clangd-wasm-configure + CONTAINER_NAME_BUILD: clangd-wasm-build + +jobs: + images-clangd-wasm: + name: Build & Deploy Clangd LS + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + timeout-minutes: 90 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (configure) + id: meta_configure + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }} + # enforce latest tag for now + tags: | + type=raw,value=latest + + - name: Build & Push (configure) + id: push_configure + uses: docker/build-push-action@v6 + with: + context: ${{ env.PATH_CONTEXT }} + file: ${{ env.PATH_CONTEXT }}/configure.Dockerfile + push: true + tags: ${{ steps.meta_configure.outputs.tags }} + labels: ${{ steps.meta_configure.outputs.labels }} + + - name: Attest (configure) + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }} + subject-digest: ${{ steps.push_configure.outputs.digest }} + push-to-registry: true + + - name: Extract metadata (build) + id: meta_build + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }} + # enforce latest tag for now + tags: | + type=raw,value=latest + + - name: Build & Push (build) + id: push_build + uses: docker/build-push-action@v6 + with: + context: ${{ env.PATH_CONTEXT }} + file: ${{ env.PATH_CONTEXT }}/build.Dockerfile + push: true + tags: ${{ steps.meta_build.outputs.tags }} + labels: ${{ steps.meta_build.outputs.labels }} + + - name: Attest (build) + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }} + subject-digest: ${{ steps.push_build.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/ls-eclipsejdt.yml b/.github/workflows/ls-eclipsejdt.yml new file mode 100644 index 000000000..579e58938 --- /dev/null +++ b/.github/workflows/ls-eclipsejdt.yml @@ -0,0 +1,62 @@ +name: Eclipse JDT LS Image + +on: + push: + branches: + - 'clangd-example' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + REPO_NAME: ${{ github.repository }} + CONTAINER_NAME: eclipse.jdt.ls + +jobs: + image-eclipsejdtls: + name: Build & Deploy Eclipse JDT LS + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }} + # enforce latest tag for now + tags: | + type=raw,value=latest + + - name: Build & Push + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: ./packages/examples/resources/${{ env.CONTAINER_NAME }}/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Attest + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/ls-groovy.yml b/.github/workflows/ls-groovy.yml new file mode 100644 index 000000000..ebaec7788 --- /dev/null +++ b/.github/workflows/ls-groovy.yml @@ -0,0 +1,62 @@ +name: Groovy LS Image + +on: + push: + branches: + - 'clangd-example' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + REPO_NAME: ${{ github.repository }} + CONTAINER_NAME: groovy.ls + +jobs: + image-groovyls: + name: Build & Deploy Groovy LS + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }} + # enforce latest tag for now + tags: | + type=raw,value=latest + + - name: Build & Push + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: ./packages/examples/resources/${{ env.CONTAINER_NAME }}/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Attest + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/README.md b/README.md index 0217cbfb2..9a27ccc11 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,11 @@ npm run start:example:server:python ##### Groovy Language Server -For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it. +For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it. ##### Java Language Server -For the **java-client** example you need to ensure the **java-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Eclipse JDT LS). From the project root run `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml down` to stop it. +For the **java-client** example you need to ensure the **java-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Eclipse JDT LS). From the project root run `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml down` to stop it. ### Verification Examples & Usage diff --git a/packages/examples/package.json b/packages/examples/package.json index 47add8907..15a0b4322 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -116,7 +116,7 @@ "compile": "tsc --build tsconfig.src.json", "resources:download": "vite-node ./build/downloadResources.mts", "build:msg": "echo Building main examples:", - "build": "npm run build:msg && npm run clean && npm run resources:download && npm run compile", + "build": "npm run build:msg && npm run clean && npm run resources:download && npm run extract:docker && npm run compile", "build:bundle": "vite --config vite.bundle.config.ts build", "start:server:json": "vite-node src/json/server/direct.ts", "start:server:python": "vite-node src/python/server/direct.ts", diff --git a/packages/examples/resources/clangd/build.Dockerfile b/packages/examples/resources/clangd/build.Dockerfile index e736c1359..8f50c8ed6 100644 --- a/packages/examples/resources/clangd/build.Dockerfile +++ b/packages/examples/resources/clangd/build.Dockerfile @@ -1,6 +1,6 @@ -FROM clangd-clangd-configure +FROM ghcr.io/typefox/monaco-languageclient/clangd-wasm-configure:latest COPY build-docker.sh /builder/build-docker.sh COPY wait_stdin.patch /builder/wait_stdin.patch -RUN (cd /builder; ./build-docker.sh) +RUN (cd /builder; bash ./build-docker.sh) diff --git a/packages/examples/resources/clangd/build.docker-compose.yml b/packages/examples/resources/clangd/build.docker-compose.yml index 9c3626172..2bc2595cb 100644 --- a/packages/examples/resources/clangd/build.docker-compose.yml +++ b/packages/examples/resources/clangd/build.docker-compose.yml @@ -1,5 +1,6 @@ services: - clangd-build: + clangd-wasm-build: + image: ghcr.io/typefox/monaco-languageclient/clangd-wasm-build:latest build: dockerfile: ./build.Dockerfile context: . @@ -7,4 +8,4 @@ services: platforms: - "linux/amd64" platform: linux/amd64 - container_name: clangd-build + container_name: clangd-wasm-build diff --git a/packages/examples/resources/clangd/configure.Dockerfile b/packages/examples/resources/clangd/configure.Dockerfile index a4d5a5e57..fcdf677ed 100644 --- a/packages/examples/resources/clangd/configure.Dockerfile +++ b/packages/examples/resources/clangd/configure.Dockerfile @@ -15,4 +15,4 @@ RUN volta install node \ RUN mkdir /builder COPY configure-docker.sh /builder/configure-docker.sh -RUN (cd /builder; ./configure-docker.sh) +RUN (cd /builder; bash ./configure-docker.sh) diff --git a/packages/examples/resources/clangd/configure.docker-compose.yml b/packages/examples/resources/clangd/configure.docker-compose.yml index 0c6299ad9..33c84b044 100644 --- a/packages/examples/resources/clangd/configure.docker-compose.yml +++ b/packages/examples/resources/clangd/configure.docker-compose.yml @@ -1,5 +1,6 @@ services: - clangd-configure: + clangd-wasm-configure: + image: ghcr.io/typefox/monaco-languageclient/clangd-wasm-configure:latest build: dockerfile: ./configure.Dockerfile context: . @@ -7,4 +8,4 @@ services: platforms: - "linux/amd64" platform: linux/amd64 - container_name: clangd-configure + container_name: clangd-wasm-configure diff --git a/packages/examples/resources/clangd/scripts/extractDockerFiles.ts b/packages/examples/resources/clangd/scripts/extractDockerFiles.ts index a4c44a03f..64475467f 100644 --- a/packages/examples/resources/clangd/scripts/extractDockerFiles.ts +++ b/packages/examples/resources/clangd/scripts/extractDockerFiles.ts @@ -10,7 +10,7 @@ fs.rmSync(outputDir, { }); fs.mkdirSync(outputDir); -child_process.execFileSync('docker', ['create', '--name', 'extract-clangd', 'clangd-clangd-build']); +child_process.execFileSync('docker', ['create', '--name', 'extract-clangd', 'ghcr.io/typefox/monaco-languageclient/clangd-wasm-build:latest']); child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.js', outputDir]); child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.wasm', outputDir]); child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.js', outputDir]); diff --git a/packages/examples/resources/eclipse.jdt.ls/docker-compose.yml b/packages/examples/resources/eclipse.jdt.ls/docker-compose.yml index 6d18ee918..d0e1d4b36 100644 --- a/packages/examples/resources/eclipse.jdt.ls/docker-compose.yml +++ b/packages/examples/resources/eclipse.jdt.ls/docker-compose.yml @@ -1,5 +1,6 @@ services: eclipsejdtls: + image: ghcr.io/typefox/monaco-languageclient/eclipse.jdt.ls:latest build: dockerfile: ./packages/examples/resources/eclipse.jdt.ls/Dockerfile context: ../../../.. diff --git a/packages/examples/resources/groovy/docker-compose.yml b/packages/examples/resources/groovy/docker-compose.yml index 0ba6691d4..0f4a35df2 100644 --- a/packages/examples/resources/groovy/docker-compose.yml +++ b/packages/examples/resources/groovy/docker-compose.yml @@ -1,5 +1,6 @@ services: groovyls: + image: ghcr.io/typefox/monaco-languageclient/groovy.ls:latest build: dockerfile: ./packages/examples/resources/groovy/Dockerfile context: ../../../..