From 096db468a6188b93e07e0bc473bc26016e79057d Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 8 Apr 2024 15:52:12 +0100 Subject: [PATCH] [devkits] nim devkit --- .docker/nim.dockerfile | 26 ++++++++++++++++++++++++++ .github/workflows/devkit-nim.yml | 20 ++++++++++++++++++++ .github/workflows/devkit.yml | 23 +++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 .docker/nim.dockerfile create mode 100644 .github/workflows/devkit-nim.yml create mode 100644 .github/workflows/devkit.yml diff --git a/.docker/nim.dockerfile b/.docker/nim.dockerfile new file mode 100644 index 0000000..47798b6 --- /dev/null +++ b/.docker/nim.dockerfile @@ -0,0 +1,26 @@ +ARG NIM_VERSION=2.0.2 + +FROM debian:unstable AS build +RUN apt update && apt install -y build-essential wget git +RUN adduser --disabled-password dev +ARG NIM_VERSION +USER dev +ENV PATH="/home/dev/.nim/bin:$PATH" +# choosenim doesn't work on arm64 D: +#ENV CHOOSENIM_CHOOSE_VERSION=${NIM_VERSION} +#RUN curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y && \ +# nimble refresh +RUN wget -nv https://nim-lang.org/download/nim-${NIM_VERSION}.tar.xz -O - \ + | tar -xJ -C /tmp +RUN cd /tmp/nim-${NIM_VERSION} \ + && ./build.sh \ + && bin/nim c koch \ + && ./koch boot -d:release \ + && ./koch tools \ + && ./install.sh /tmp/install-nim \ + && mv /tmp/install-nim/nim /home/dev/.nim \ + && cp ./bin/nimble /home/dev/.nim/bin/ \ + && nimble refresh + +FROM scratch +COPY --from=build /home/dev/.nim /home/dev/.nim \ No newline at end of file diff --git a/.github/workflows/devkit-nim.yml b/.github/workflows/devkit-nim.yml new file mode 100644 index 0000000..7faeab5 --- /dev/null +++ b/.github/workflows/devkit-nim.yml @@ -0,0 +1,20 @@ +name: Devkit (nim) + +on: + push: + branches: + - master + - main + paths: + - '.docker/nim.dockerfile' + pull_request: + paths: + - '.docker/nim.dockerfile' + workflow_dispatch: + +jobs: + build: + name: Build + uses: ./.github/workflows/devkit.yml + with: + lang: nim diff --git a/.github/workflows/devkit.yml b/.github/workflows/devkit.yml new file mode 100644 index 0000000..c4841cf --- /dev/null +++ b/.github/workflows/devkit.yml @@ -0,0 +1,23 @@ +name: Devkit + +on: + workflow_call: + inputs: + lang: + required: true + type: string + +jobs: + build: + name: Build Container + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Publish + uses: elgohr/Publish-Docker-Github-Action@main + with: + name: shish2k/rosettaboy-devkit-${{ inputs.lang }} + dockerfile: .docker/${{ inputs.lang }}.dockerfile + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }}