From edcd2d540d9f5aebb00d79c36040b8cdf3c13b16 Mon Sep 17 00:00:00 2001 From: Liora Milbaum Date: Fri, 14 Apr 2023 16:12:52 +0300 Subject: [PATCH] chore(devcontainer): Fixed errors and added CI workflow --- .devcontainer/Dockerfile | 9 +++++++++ .devcontainer/devcontainer.json | 29 ++++++++++++++++----------- .github/workflows/devcontainer.yml | 17 ++++++++++++++++ docs/development/local-development.md | 10 +++++++-- 4 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/devcontainer.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index bc9853f54eeec2..690eb6adcee68a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,5 +2,14 @@ FROM ghcr.io/containerbase/node:18.16.0@sha256:fc48ac97eb5d0dee207d4a336a52d7d3b USER root +COPY . . + +RUN apt update; \ + apt install -y make g++ + +# renovate: datasource=github-releases +RUN install-tool python 3.11.3 + # renovate: datasource=npm RUN install-tool yarn 1.22.19 +RUN yarn install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 306cb29b34a443..5aacfcf607639e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,26 +1,31 @@ { "hostRequirements": { "cpus": 4, - "memory": "8gb", + "memory": "7gb", "storage": "32gb" }, "name": "Renovate", "dockerFile": "Dockerfile", - "settings": { - "terminal.integrated.profiles.linux": { "bash": { "path": "/bin/bash" } }, - "terminal.integrated.defaultProfile.linux": "bash" + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { "path": "/bin/bash" } + }, + "terminal.integrated.defaultProfile.linux": "bash" + }, + "extensions": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "orta.vscode-jest", + "EditorConfig.editorconfig" + ] + } }, - "extensions": [ - "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode", - "orta.vscode-jest", - "EditorConfig.editorconfig" - ], "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--privileged" - ], - "postCreateCommand": "yarn install" + ] } diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml new file mode 100644 index 00000000000000..058b2aa34442b4 --- /dev/null +++ b/.github/workflows/devcontainer.yml @@ -0,0 +1,17 @@ +name: 'devcontainer' +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.5.2 + + - name: Build and run dev container task + uses: devcontainers/ci@v0.3.1900000328 + with: + runCmd: yarn test diff --git a/docs/development/local-development.md b/docs/development/local-development.md index a141a9b3a537aa..3ad6e5bc1668cf 100644 --- a/docs/development/local-development.md +++ b/docs/development/local-development.md @@ -47,9 +47,9 @@ If you already installed a part, skip the corresponding step. PS C:\Windows\system32> yarn --version ``` -#### VS Code Remote Development +#### VSCode Remote Development -If you are using [VS Code](https://code.visualstudio.com/) you can skip installing [the prerequisites](#prerequisites) and work in a [development container](https://code.visualstudio.com/docs/remote/containers) instead. +If you are using [VSCode](https://code.visualstudio.com/) you can skip installing [the prerequisites](#prerequisites) and work in a [development container](https://code.visualstudio.com/docs/remote/containers) instead. - Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and [check its system requirements](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers#system-requirements) - Open the repository folder in VS Code @@ -57,6 +57,12 @@ If you are using [VS Code](https://code.visualstudio.com/) you can skip installi The VS Code [integrated terminal](https://code.visualstudio.com/docs/editor/integrated-terminal) is now running in the container and can be used to run additional commands. +To run unit tests inside the container: + +```shell +yarn test +``` + #### Local Docker If, for some reason, you can't run the relevant versions on your local machine, you can run everything from a Docker image.