From dc8667f23bf1195a54bf6ae310dd0c36586688f0 Mon Sep 17 00:00:00 2001 From: Nathan Byrd Date: Sat, 13 Jan 2024 15:32:18 -0600 Subject: [PATCH] Feature: Add development environment setup (#970) --- .devcontainer/Dockerfile | 11 +++++++++++ .devcontainer/devcontainer.json | 28 ++++++++++++++++++++++++++++ .vscode/tasks.json | 12 ++++++++++++ Readme.md | 10 +++++++++- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..fa4afe35 --- /dev/null +++ b/.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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..ac453fa0 --- /dev/null +++ b/.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" + ] + } + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..04418464 --- /dev/null +++ b/.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}" + } + ] +} diff --git a/Readme.md b/Readme.md index efb95355..81e0be1d 100644 --- a/Readme.md +++ b/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`