Browse Source

Feature: Add development environment setup (#970)

Nathan Byrd 3 months ago
parent
commit
dc8667f23b
4 changed files with 60 additions and 1 deletions
  1. 11 0
      .devcontainer/Dockerfile
  2. 28 0
      .devcontainer/devcontainer.json
  3. 12 0
      .vscode/tasks.json
  4. 9 1
      Readme.md

+ 11 - 0
.devcontainer/Dockerfile

@@ -0,0 +1,11 @@
+FROM library/node:lts-bookworm
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt update && \
+    apt-get install -y nodejs nasm gdb unzip p7zip-full openjdk-17-jre wget python3 qemu-system-x86 git-core build-essential libc6-dev-i386-cross libc6-dev-i386 clang curl time
+RUN npm install -g jshint
+RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
+RUN /root/.cargo/bin/rustup toolchain install stable && \
+    /root/.cargo/bin/rustup target add wasm32-unknown-unknown && \
+    /root/.cargo/bin/rustup component add rustfmt-preview && \
+    /root/.cargo/bin/rustup update && /root/.cargo/bin/rustup update nightly

+ 28 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,28 @@
+{
+	"name": "v86 dev container",
+	"build": {
+		"dockerfile": "Dockerfile",
+		"args": {
+			"VARIANT": "ubuntu"
+		}
+	},
+	"features": {
+		"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
+		"ghcr.io/jungaretti/features/ripgrep:1": {}
+	},
+	"customizations": {
+		"vscode": {
+			"extensions": [
+				"ms-azuretools.vscode-docker",
+				"yzhang.markdown-all-in-one",
+				"DavidAnson.vscode-markdownlint",
+				"christian-kohler.npm-intellisense",
+				"dbaeumer.vscode-eslint",
+				"dustypomerleau.rust-syntax",
+				"serayuzgur.crates",
+				"ms-vscode.makefile-tools",
+				"rust-lang.rust-analyzer"
+			]
+		}
+	}
+}

+ 12 - 0
.vscode/tasks.json

@@ -0,0 +1,12 @@
+{
+    // See https://go.microsoft.com/fwlink/?LinkId=733558
+    // for the documentation about the tasks.json format
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "Fetch images",
+            "type": "shell",
+            "command": "wget -P images/ https://k.copy.sh/{linux3.iso,linux.iso,linux4.iso,buildroot-bzimage.bin,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img}"
+        }
+    ]
+}

+ 9 - 1
Readme.md

@@ -138,12 +138,20 @@ for a full setup on Debian or
 - Then you can simply run `docker run -it -p 8000:8000 v86:alpine-3.14` to start the server.
 - Check `localhost:8000` for hosted server.
 
+### Running via Devcontainer
+
+- If you are using an IDE that supports Devcontainers, such as Github Codespaces, VSCode Remote Container extension, or possibly others such as Jetbrains IDEA, you can setup the development environment in a Dev container.
+- Follow the instructions from your development environment to setup the container.
+- Run the Task "Fetch images" in order to download images for testing.
+
 ## Testing
 
 The disk images for testing are not included in this repository. You can
 download them directly from the website using:
 
-`wget -P images/ https://k.copy.sh/{linux.iso,linux4.iso,buildroot-bzimage.bin,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img}`
+`wget -P images/ https://k.copy.sh/{linux3.iso,linux.iso,linux4.iso,buildroot-bzimage.bin,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img}`
+
+Run integration tests: `make tests`
 
 Run all tests: `make jshint rustfmt kvm-unit-test nasmtests nasmtests-force-jit expect-tests jitpagingtests qemutests rust-test tests`