diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..d860c11 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,32 @@ +ARG BASE_IMAGE=temurin-21-tools-deps-jammy +FROM clojure:${BASE_IMAGE} + +ENV USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \ + # + # [Optional] Add sudo support. Omit if you don't need to install software after connecting. + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + + +# [Optional] Set the default user. Omit if you want to keep the default as root. +USER $USERNAME +SHELL ["/bin/bash", "-ec"] +ENTRYPOINT ["bash"] + + +# Prepare clojure tools +RUN clojure -Ttools list && \ +clojure -Ttools install io.github.seancorfield/clj-new '{:git/tag "v1.2.404" :git/sha "d4a6508"}' :as clj-new && \ +clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new && \ +clojure -Ttools list + +RUN sudo apt-get update && \ + sudo apt-get install -y lsb-release diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..26e6812 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/scicloj/devcontainer-templates/tree/main/src/basecloj +{ + "name": "Base clojure dev env", + "build": { + "dockerfile": "Dockerfile", + "args": { + "BASE_IMAGE": "temurin-11-tools-deps-jammy", + "USERNAME": "${localEnv:USER:vscode}" + } + }, + "remoteUser": "${localEnv:USER}", + "containerUser": "${localEnv:USER}", + "features": { + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { + "packages": "bash-completion" + }, + "ghcr.io/devcontainers/features/node:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "betterthantomorrow.calva", + "GitHub.vscode-github-actions" + ] + } + } +} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d4196ce..ed411da 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,121 +20,4 @@ jobs: - name: "Install Node Dependencies" run: npm install - name: "ClojureScript Tests" - run: clojure -A:dev:test-cljs - uberjar: - needs: [test] - runs-on: ubuntu-latest - steps: - - name: "Checkout" - uses: actions/checkout@v2 - - name: "Setup Java" - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: "Setup Clojure" - uses: DeLaGuardo/setup-clojure@master - with: - cli: "1.10.1.697" - - name: "Uberjar" - run: clojure -A:uberjar - - name: "Smoke Test" - run: | - java -jar target/mp3-parser-SNAPSHOT-standalone.jar -h - - name: "Upload" - uses: actions/upload-artifact@v2 - with: - name: mp3-parser-standalone - path: target/mp3-parser-SNAPSHOT-standalone.jar - native-image-linux: - needs: [uberjar] - runs-on: ubuntu-latest - steps: - - name: "Checkout" - uses: actions/checkout@v2 - - name: "Setup GraalVM" - uses: DeLaGuardo/setup-graalvm@3 - with: - graalvm-version: "20.2.0.java11" - - name: "Install GraalVM Native Image Deps" - run: | - sudo apt -y update - sudo apt -y install gcc libc6-dev zlib1g-dev libstdc++-8-dev - - name: "Install GraalVM Native Image" - run: gu install native-image - - name: "Download" - uses: actions/download-artifact@v2 - with: - name: mp3-parser-standalone - - name: "Native Image" - run: native-image --verbose --no-server --no-fallback --allow-incomplete-classpath --report-unsupported-elements-at-runtime --initialize-at-build-time -J-Xmx8g -jar mp3-parser-SNAPSHOT-standalone.jar -H:Name=mp3-parser - - name: "Smoke Test" - run: | - chmod +x mp3-parser - ./mp3-parser -h - - name: "Package" - run: tar -czvf mp3-parser-linux.tar.gz mp3-parser - - name: "Upload" - uses: actions/upload-artifact@v2 - with: - name: mp3-parser-linux - path: mp3-parser-linux.tar.gz - native-image-windows: - needs: [uberjar] - runs-on: windows-latest - steps: - - name: "Setup GraalVM" - uses: DeLaGuardo/setup-graalvm@3 - with: - graalvm-version: "20.2.0.java11" - - name: "Install GraalVM Native Image" - run: C:\hostedtoolcache\windows\GraalVM\20.2.0-java11\x64\bin\gu install native-image - - name: "Install Visual C Build Tools Workload for Visual Studio 2017" - run: choco install visualstudio2017-workload-vctools - - name: "Download" - uses: actions/download-artifact@v2 - with: - name: mp3-parser-standalone - - name: "Native Image" - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" - C:\hostedtoolcache\windows\GraalVM\20.2.0-java11\x64\bin\native-image --verbose --no-server --no-fallback --allow-incomplete-classpath --report-unsupported-elements-at-runtime --initialize-at-build-time -J-Xmx8g -jar mp3-parser-SNAPSHOT-standalone.jar -H:Name=mp3-parser - - name: "Smoke Test" - shell: cmd - run: mp3-parser.exe -h - - name: "Package" - run: 7z a mp3-parser-win.zip mp3-parser.exe - - name: "Upload" - uses: actions/upload-artifact@v2 - with: - name: mp3-parser-win - path: mp3-parser-win.zip - native-image-mac: - needs: [uberjar] - runs-on: macos-latest - steps: - - name: "Checkout" - uses: actions/checkout@v2 - - name: "Setup GraalVM" - uses: DeLaGuardo/setup-graalvm@3 - with: - graalvm-version: "20.2.0.java11" - - name: "Install GraalVM Native Image" - run: gu install native-image - - name: "Download" - uses: actions/download-artifact@v2 - with: - name: mp3-parser-standalone - - name: "Native Image" - run: native-image --verbose --no-server --no-fallback --allow-incomplete-classpath --report-unsupported-elements-at-runtime --initialize-at-build-time -J-Xmx8g -jar mp3-parser-SNAPSHOT-standalone.jar -H:Name=mp3-parser - - name: "Smoke Test" - run: | - chmod +x mp3-parser - ./mp3-parser -h - - name: "Package" - run: tar -czvf mp3-parser-macos.tar.gz mp3-parser - - name: "Upload" - uses: actions/upload-artifact@v2 - with: - name: mp3-parser-macos - path: mp3-parser-macos.tar.gz \ No newline at end of file + run: clojure -A:dev:test-cljs \ No newline at end of file diff --git a/.gitignore b/.gitignore index e8028b4..0e06c3d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ node_modules .calva/ .clj-kondo/ /pkg/ +.lsp/ diff --git a/deps.edn b/deps.edn index 42256fc..0ca3acc 100644 --- a/deps.edn +++ b/deps.edn @@ -21,24 +21,6 @@ :test {:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git" :sha "cb96e80f6f3d3b307c59cbeb49bb0dcb3a2a780b"}} :main-opts ["-m" "cognitect.test-runner"]} - :uberjar {:extra-deps {luchiniatwork/cambada {:git/url "https://github.com/xfthhxk/cambada.git" - :sha "c8a01477c856fc28c53f34aa3f268f8eaf683869"}} - :main-opts ["-m" "cambada.uberjar" - "-m" "mp3_parser.cli" - "--app-artifact-id" "mp3-parser" - "--app-version" "SNAPSHOT"]} - :native-image {:extra-deps {luchiniatwork/cambada {:git/url "https://github.com/xfthhxk/cambada.git" - :sha "c8a01477c856fc28c53f34aa3f268f8eaf683869"}} - :main-opts ["-m" "cambada.native-image" - "-m" "mp3_parser.cli" - "--graalvm-opt" - "-verbose" - "--graalvm-opt" - "-allow-incomplete-classpath" - "--graalvm-opt" - "-report-unsupported-elements-at-runtime" - "--graalvm-opt" - "J-Xmx4g"]} :test-cljs {:extra-deps {olical/cljs-test-runner {:mvn/version "3.7.0"}} :main-opts ["-m" "cljs-test-runner.main"]} :compile-cljs {:main-opts ["-m" "cljs.main" "-co" "compile-opts.edn" "-c" "mp3-parser.cli"]}