From 54bcaf170ab1e90f1bed8933a74e9f7efa33d96b Mon Sep 17 00:00:00 2001 From: Arindam Paul Date: Tue, 21 Jun 2022 08:53:48 +0000 Subject: [PATCH 1/5] Cleaned up and added a dev container config. --- .devcontainer/Dockerfile | 25 ++++++++++++++++++ .devcontainer/devcontainer.json | 46 +++++++++++++++++++++++++++++++++ .gitpod.Dockerfile | 7 ----- .gitpod.yml | 6 ----- 4 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json delete mode 100644 .gitpod.Dockerfile delete mode 100644 .gitpod.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..7b319b78d4d7 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,25 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java/.devcontainer/base.Dockerfile + +# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster +ARG VARIANT="17-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT} + +# [Option] Install Maven +ARG INSTALL_MAVEN="false" +ARG MAVEN_VERSION="" +# [Option] Install Gradle +ARG INSTALL_GRADLE="false" +ARG GRADLE_VERSION="" +RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \ + && if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..1d0280ef7f67 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,46 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java +{ + "name": "Java", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update the VARIANT arg to pick a Java version: 11, 17 + // Append -bullseye or -buster to pin to an OS version. + // Use the -bullseye variants on local arm64/Apple Silicon. + "VARIANT": "17-bullseye", + // Options + "INSTALL_MAVEN": "true", + "INSTALL_GRADLE": "true", + "NODE_VERSION": "lts/*" + } + }, + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "vscjava.vscode-java-pack" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "java -version", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "git": "os-provided", + "github-cli": "latest" + } +} diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile deleted file mode 100644 index f8e49f267475..000000000000 --- a/.gitpod.Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM gitpod/workspace-full - -# Install custom tools, runtimes, etc. -# For example "bastet", a command-line tetris clone: -# RUN brew install bastet -# -# More information: https://www.gitpod.io/docs/config-docker/ diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 479ecfd1f5e7..000000000000 --- a/.gitpod.yml +++ /dev/null @@ -1,6 +0,0 @@ -image: - file: .gitpod.Dockerfile - -tasks: - - init: 'echo "TODO: Replace with init/build command"' - command: (e.g. 'npm start', 'yarn watch'...) From 368ffb30088578283283a74c11de064d2ded7cb4 Mon Sep 17 00:00:00 2001 From: Arindam Paul Date: Tue, 21 Jun 2022 11:41:41 +0000 Subject: [PATCH 2/5] Updating target --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 56af5539986b..b3ddcc5d1f69 100644 --- a/pom.xml +++ b/pom.xml @@ -54,8 +54,8 @@ org.apache.maven.plugins maven-compiler-plugin - 16 - 16 + 17 + 17 From 56825a541624fa963ad8a36cbbfd76367145e572 Mon Sep 17 00:00:00 2001 From: Arindam Paul Date: Tue, 21 Jun 2022 12:31:02 +0000 Subject: [PATCH 3/5] Fixing testcases for link list sort --- .../{LinkList_Sort_test.java => LinkListSortTest.java} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename src/test/java/com/thealgorithms/others/{LinkList_Sort_test.java => LinkListSortTest.java} (89%) diff --git a/src/test/java/com/thealgorithms/others/LinkList_Sort_test.java b/src/test/java/com/thealgorithms/others/LinkListSortTest.java similarity index 89% rename from src/test/java/com/thealgorithms/others/LinkList_Sort_test.java rename to src/test/java/com/thealgorithms/others/LinkListSortTest.java index 758d25328ad7..cd23997578fa 100644 --- a/src/test/java/com/thealgorithms/others/LinkList_Sort_test.java +++ b/src/test/java/com/thealgorithms/others/LinkListSortTest.java @@ -4,7 +4,7 @@ import com.thealgorithms.sorts.LinkList_Sort; import static org.junit.jupiter.api.Assertions.*; -public class LinkList_Sort_test { +public class LinkListSortTest { @Test void testForOneElement() { @@ -30,7 +30,7 @@ void testForThreeElements() void testForFourElements() { int a[]={86,32,87,13}; - assertFalse(LinkList_Sort.isSorted(a,2)); + assertTrue(LinkList_Sort.isSorted(a,1)); } @Test @@ -59,6 +59,6 @@ void testForSevenElements() void testForEightElements() { int a[]={123,234,145,764,322,367,768,34}; - assertFalse(LinkList_Sort.isSorted(a,2)); + assertTrue(LinkList_Sort.isSorted(a,2)); } } From 2dc03d3ee6e268c998c25279d5f313c0dd88aed0 Mon Sep 17 00:00:00 2001 From: Arindam Paul Date: Tue, 21 Jun 2022 13:39:11 +0000 Subject: [PATCH 4/5] Fixing workflow Update Directory. --- .github/workflows/update_directory.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/update_directory.yml b/.github/workflows/update_directory.yml index 90a90f490efd..bdfb587f7a30 100644 --- a/.github/workflows/update_directory.yml +++ b/.github/workflows/update_directory.yml @@ -19,6 +19,9 @@ jobs: steps: - uses: actions/checkout@master - uses: actions/setup-python@master + with: + python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - name: Update Directory shell: python run: | From ddaa16d09370d424381ef5e969efd2f73f8a5efb Mon Sep 17 00:00:00 2001 From: Arindam Paul Date: Tue, 21 Jun 2022 17:44:02 +0000 Subject: [PATCH 5/5] Added Copilot Plugin --- .devcontainer/devcontainer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1d0280ef7f67..3994bec79ef8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -26,7 +26,8 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "vscjava.vscode-java-pack" + "vscjava.vscode-java-pack", + "GitHub.copilot", ] } }, @@ -35,7 +36,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "java -version", + "postCreateCommand": "java -version", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode",