From f9ce232114d61568b7a7b520a009a28dd7d02bab Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 5 Apr 2024 17:31:37 +0530 Subject: [PATCH 01/17] :rocket: Add configured Dockerfile --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c4ecbc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM python:3.11.9-slim + +WORKDIR / + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc \ + clang \ + git \ + wget \ + dos2unix \ + && rm -rf /var/lib/apt/lists/* + +COPY scripts/ci/tools/linux/install_go.sh /install_go.sh +RUN chmod +x /install_go.sh && \ + dos2unix /install_go.sh && \ + /install_go.sh + +COPY scripts/ci/tools/linux/install_zig.sh /install_zig.sh +RUN chmod +x /install_zig.sh && \ + dos2unix /install_zig.sh && \ + /install_zig.sh + +RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions@main && \ + cd hugo-python-distributions && \ + python -m venv venv && \ + source venv/bin/activate && \ + pip install -e . && \ + pip install . + +WORKDIR /hugo-python-distributions + +CMD ["source", "venv/bin/activate"] From a589fe6ec8e9e258682f03b2e6a20b17c4598623 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 5 Apr 2024 17:33:29 +0530 Subject: [PATCH 02/17] :writing_hand: Propose some changes in `install_go.sh` script to make it compatible to Dockerfile --- scripts/ci/tools/linux/install_go.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ci/tools/linux/install_go.sh b/scripts/ci/tools/linux/install_go.sh index e36c50e..3681e39 100644 --- a/scripts/ci/tools/linux/install_go.sh +++ b/scripts/ci/tools/linux/install_go.sh @@ -1,14 +1,14 @@ -# !#/bin/bash +#!/bin/bash # Small script to install Golang into a PyPA manylinux2014 Docker container -yum install -y wget +apt-get update && apt-get install -y wget arch=$(uname -m) if [ "$arch" == "x86_64" ]; then tarball="go1.22.1.linux-amd64.tar.gz" -elif [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then +elif [ "$arch" == "aarch64" ] || [ "$arch" == "arm64" ]; then tarball="go1.22.1.linux-arm64.tar.gz" else echo "Unsupported architecture: $arch" From d99a35c5ccec2c965bf8d6c0d0137ca21443cb10 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 5 Apr 2024 23:19:19 +0530 Subject: [PATCH 03/17] :nail_care: Add `install_zig.sh` script to install zig --- scripts/ci/tools/linux/install_zig.sh | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts/ci/tools/linux/install_zig.sh diff --git a/scripts/ci/tools/linux/install_zig.sh b/scripts/ci/tools/linux/install_zig.sh new file mode 100644 index 0000000..373fe5f --- /dev/null +++ b/scripts/ci/tools/linux/install_zig.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Small script to install Zig into a PyPA manylinux2014 Docker container + +apt-get update && apt-get install -y wget xz-utils + +arch=$(uname -m) + +if [ "$arch" == "x86_64" ]; then + tarball="zig-linux-x86_64-0.11.0.tar.xz" +elif [ "$arch" == "aarch64" ] || [ "$arch" == "arm64" ]; then + tarball="zig-linux-aarch64-0.11.0.tar.xz" +else + echo "Unsupported architecture: $arch" + exit 1 +fi + +wget "https://ziglang.org/download/0.11.0/$tarball" +mkdir -p "$HOME/zig_installed/" +tar -C "$HOME/zig_installed/" -xf "$tarball" +rm "$tarball" # Remove the downloaded tarball after extraction + +echo 'export PATH=$PATH:$HOME/zig_installed/' >> ~/.bashrc +echo 'export PATH=$PATH:$HOME/zig_installed/' >> ~/.bash_profile + +source ~/.bashrc +source ~/.bash_profile + +# zig version From 2c50a0dd52a60aa276399fc9c6731d8cb34fa878 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 19 Apr 2024 11:57:21 +0530 Subject: [PATCH 04/17] :pushpin: Modify Preliminary Dockerfile --- Dockerfile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c4ecbc..a7497dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,25 +9,27 @@ RUN apt-get update && \ git \ wget \ dos2unix \ + xz-utils \ && rm -rf /var/lib/apt/lists/* -COPY scripts/ci/tools/linux/install_go.sh /install_go.sh -RUN chmod +x /install_go.sh && \ - dos2unix /install_go.sh && \ - /install_go.sh +RUN wget https://golang.org/dl/go1.22.1.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz && \ + rm go1.22.1.linux-amd64.tar.gz -COPY scripts/ci/tools/linux/install_zig.sh /install_zig.sh -RUN chmod +x /install_zig.sh && \ - dos2unix /install_zig.sh && \ - /install_zig.sh +ENV PATH="${PATH}:/usr/local/go/bin" -RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions@main && \ +RUN wget https://ziglang.org/builds/zig-linux-x86_64-0.11.0.tar.xz && \ + tar -C /usr/local -xf zig-linux-x86_64-0.11.0.tar.xz && \ + rm zig-linux-x86_64-0.11.0.tar.xz + +ENV PATH="${PATH}:/usr/local/zig-linux-x86_64-0.11.0" + +RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ cd hugo-python-distributions && \ python -m venv venv && \ - source venv/bin/activate && \ - pip install -e . && \ - pip install . + /hugo-python-distributions/venv/bin/python -m pip install -e . && \ + /hugo-python-distributions/venv/bin/python -m pip install . WORKDIR /hugo-python-distributions -CMD ["source", "venv/bin/activate"] +CMD ["/hugo-python-distributions/venv/bin/python", "-m", "venv/bin/activate"] From 0645456302326cf124cb8c06a2cc7ba510ca9bbe Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 19 Apr 2024 12:05:35 +0530 Subject: [PATCH 05/17] =?UTF-8?q?=E2=86=A9=EF=B8=8F=20Revert=20changes=20i?= =?UTF-8?q?n=20`install=5Fgo.sh`=20&=20remove=20`install=5Fzig.sh`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/tools/linux/install_go.sh | 12 +++++------ scripts/ci/tools/linux/install_zig.sh | 29 --------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 scripts/ci/tools/linux/install_zig.sh diff --git a/scripts/ci/tools/linux/install_go.sh b/scripts/ci/tools/linux/install_go.sh index 3681e39..b78cae3 100644 --- a/scripts/ci/tools/linux/install_go.sh +++ b/scripts/ci/tools/linux/install_go.sh @@ -1,15 +1,15 @@ -#!/bin/bash +# !#/bin/bash # Small script to install Golang into a PyPA manylinux2014 Docker container -apt-get update && apt-get install -y wget +yum install -y wget arch=$(uname -m) if [ "$arch" == "x86_64" ]; then - tarball="go1.22.1.linux-amd64.tar.gz" -elif [ "$arch" == "aarch64" ] || [ "$arch" == "arm64" ]; then - tarball="go1.22.1.linux-arm64.tar.gz" + tarball="go1.22.2.linux-amd64.tar.gz" +elif [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then + tarball="go1.22.2.linux-arm64.tar.gz" else echo "Unsupported architecture: $arch" exit 1 @@ -20,4 +20,4 @@ mkdir $HOME/go_installed/ tar -C $HOME/go_installed/ -xzf $tarball export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile -go version +go version \ No newline at end of file diff --git a/scripts/ci/tools/linux/install_zig.sh b/scripts/ci/tools/linux/install_zig.sh deleted file mode 100644 index 373fe5f..0000000 --- a/scripts/ci/tools/linux/install_zig.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Small script to install Zig into a PyPA manylinux2014 Docker container - -apt-get update && apt-get install -y wget xz-utils - -arch=$(uname -m) - -if [ "$arch" == "x86_64" ]; then - tarball="zig-linux-x86_64-0.11.0.tar.xz" -elif [ "$arch" == "aarch64" ] || [ "$arch" == "arm64" ]; then - tarball="zig-linux-aarch64-0.11.0.tar.xz" -else - echo "Unsupported architecture: $arch" - exit 1 -fi - -wget "https://ziglang.org/download/0.11.0/$tarball" -mkdir -p "$HOME/zig_installed/" -tar -C "$HOME/zig_installed/" -xf "$tarball" -rm "$tarball" # Remove the downloaded tarball after extraction - -echo 'export PATH=$PATH:$HOME/zig_installed/' >> ~/.bashrc -echo 'export PATH=$PATH:$HOME/zig_installed/' >> ~/.bash_profile - -source ~/.bashrc -source ~/.bash_profile - -# zig version From a2bcfe562bfe3a77507d610edab58bc09fc33138 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 10:05:40 +0000 Subject: [PATCH 06/17] =?UTF-8?q?=F0=9F=AA=A9=20Automated=20fixes=20from?= =?UTF-8?q?=20https://pre-commit.ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/tools/linux/install_go.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/tools/linux/install_go.sh b/scripts/ci/tools/linux/install_go.sh index b78cae3..2d4c619 100644 --- a/scripts/ci/tools/linux/install_go.sh +++ b/scripts/ci/tools/linux/install_go.sh @@ -20,4 +20,4 @@ mkdir $HOME/go_installed/ tar -C $HOME/go_installed/ -xzf $tarball export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile -go version \ No newline at end of file +go version From 341dee5ba41555a3cb3fd94080f884686682e6fd Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 19 Apr 2024 15:54:50 +0530 Subject: [PATCH 07/17] :heavy_plus_sign: Install `g++` required for `libsaas` --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a7497dc..75161e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ WORKDIR / RUN apt-get update && \ apt-get install -y --no-install-recommends \ gcc \ + g++ \ clang \ git \ wget \ From 76b2cb56beed511ecaaf915ae512c73458440b30 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Mon, 22 Apr 2024 14:24:03 +0530 Subject: [PATCH 08/17] :memo: Update Dockerfile to set `GO_VERSION` and `ZIG_VERSION` environment variables and use them in wget commands --- Dockerfile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75161e6..415dab4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.11.9-slim +ENV GO_VERSION=1.22.1 +ENV ZIG_VERSION=0.11.0 + WORKDIR / RUN apt-get update && \ @@ -13,17 +16,17 @@ RUN apt-get update && \ xz-utils \ && rm -rf /var/lib/apt/lists/* -RUN wget https://golang.org/dl/go1.22.1.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz && \ - rm go1.22.1.linux-amd64.tar.gz +RUN wget "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" && \ + tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" && \ + rm "go${GO_VERSION}.linux-amd64.tar.gz" ENV PATH="${PATH}:/usr/local/go/bin" -RUN wget https://ziglang.org/builds/zig-linux-x86_64-0.11.0.tar.xz && \ - tar -C /usr/local -xf zig-linux-x86_64-0.11.0.tar.xz && \ - rm zig-linux-x86_64-0.11.0.tar.xz +RUN wget "https://ziglang.org/builds/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ + tar -C /usr/local -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ + rm "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" -ENV PATH="${PATH}:/usr/local/zig-linux-x86_64-0.11.0" +ENV PATH="${PATH}:/usr/local/zig-linux-x86_64-${ZIG_VERSION}" RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ cd hugo-python-distributions && \ @@ -33,4 +36,4 @@ RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ WORKDIR /hugo-python-distributions -CMD ["/hugo-python-distributions/venv/bin/python", "-m", "venv/bin/activate"] +CMD ["/bin/bash", "--rcfile", "/hugo-python-distributions/venv/bin/activate"] From 752013e3731dec22f37215ebdbd103a06449673a Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Mon, 22 Apr 2024 14:28:00 +0530 Subject: [PATCH 09/17] :airplane: Get rid of venv --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 415dab4..24a403f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,10 +30,9 @@ ENV PATH="${PATH}:/usr/local/zig-linux-x86_64-${ZIG_VERSION}" RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ cd hugo-python-distributions && \ - python -m venv venv && \ - /hugo-python-distributions/venv/bin/python -m pip install -e . && \ - /hugo-python-distributions/venv/bin/python -m pip install . + pip install -e . && \ + pip install . WORKDIR /hugo-python-distributions -CMD ["/bin/bash", "--rcfile", "/hugo-python-distributions/venv/bin/activate"] +CMD ["/bin/bash"] From 494673ddf955125707f02a5078939e74ac3c7f78 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Mon, 22 Apr 2024 18:24:03 +0530 Subject: [PATCH 10/17] :whale: Add workflow to build & push docker image --- .github/workflows/docker.yml | 42 ++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..750584a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,42 @@ +name: Build and push Docker images to Docker Hub + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + build_docker_image: + # This workflow is only of value to Owner and would always be skipped in forks + if: github.repository_owner == 'agriyakhetarpal' + name: Build image + runs-on: buildjet-2vcpu-ubuntu-2204-arm + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image to Docker Hub + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + tags: agriyakhetarpal/hugo:latest # To be updated with exact Docker Hub username and image name + push: true + platforms: linux/amd64, linux/arm64 + + - name: List built image(s) + run: docker images diff --git a/Dockerfile b/Dockerfile index 24a403f..24a1b0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.11.9-slim -ENV GO_VERSION=1.22.1 +ENV GO_VERSION=1.22.2 ENV ZIG_VERSION=0.11.0 WORKDIR / From 8a3f01c30768be8906e2c13fa099a6f974879b1f Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 2 Jun 2024 20:52:49 +0530 Subject: [PATCH 11/17] :twisted_rightwards_arrows: Two separate Dockerfiles --- Dockerfile => Dockerfile.amd64 | 9 ++------- Dockerfile.arm64 | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) rename Dockerfile => Dockerfile.amd64 (75%) create mode 100644 Dockerfile.arm64 diff --git a/Dockerfile b/Dockerfile.amd64 similarity index 75% rename from Dockerfile rename to Dockerfile.amd64 index 24a1b0b..e0aced6 100644 --- a/Dockerfile +++ b/Dockerfile.amd64 @@ -1,6 +1,6 @@ +# /Dockerfile.amd64 FROM python:3.11.9-slim -ENV GO_VERSION=1.22.2 ENV ZIG_VERSION=0.11.0 WORKDIR / @@ -14,14 +14,9 @@ RUN apt-get update && \ wget \ dos2unix \ xz-utils \ + musl-tools \ && rm -rf /var/lib/apt/lists/* -RUN wget "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" && \ - tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" && \ - rm "go${GO_VERSION}.linux-amd64.tar.gz" - -ENV PATH="${PATH}:/usr/local/go/bin" - RUN wget "https://ziglang.org/builds/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ tar -C /usr/local -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ rm "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 new file mode 100644 index 0000000..c8594d4 --- /dev/null +++ b/Dockerfile.arm64 @@ -0,0 +1,33 @@ +# /Dockerfile.arm64 +FROM python:3.11.9-slim + +ENV ZIG_VERSION=0.11.0 + +WORKDIR / + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc \ + g++ \ + clang \ + git \ + wget \ + dos2unix \ + xz-utils \ + musl-tools \ + && rm -rf /var/lib/apt/lists/* + +RUN wget "https://ziglang.org/builds/zig-linux-aarch64-${ZIG_VERSION}.tar.xz" && \ + tar -C /usr/local -xf "zig-linux-aarch64-${ZIG_VERSION}.tar.xz" && \ + rm "zig-linux-aarch64-${ZIG_VERSION}.tar.xz" + +ENV PATH="${PATH}:/usr/local/zig-linux-aarch64-${ZIG_VERSION}" + +RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ + cd hugo-python-distributions && \ + pip install -e . && \ + pip install . + +WORKDIR /hugo-python-distributions + +CMD ["/bin/bash"] From 227652f64992379e9dffbcc83d46324bb145dfd4 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 7 Jun 2024 17:24:15 +0530 Subject: [PATCH 12/17] :heavy_plus_sign: Consolidate two Dockerfiles into one using build-time arg `TARGETARCH` --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ Dockerfile.amd64 | 33 --------------------------------- Dockerfile.arm64 | 33 --------------------------------- 3 files changed, 40 insertions(+), 66 deletions(-) create mode 100644 Dockerfile delete mode 100644 Dockerfile.amd64 delete mode 100644 Dockerfile.arm64 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c4f85fc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM python:3.11.9-slim + +ENV ZIG_VERSION=0.11.0 + +WORKDIR / + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc \ + g++ \ + clang \ + git \ + wget \ + dos2unix \ + xz-utils \ + musl-tools \ + && rm -rf /var/lib/apt/lists/* + +ARG TARGETARCH=x86_64 + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + wget "https://ziglang.org/builds/zig-linux-aarch64-${ZIG_VERSION}.tar.xz" && \ + tar -C /usr/local -xf "zig-linux-aarch64-${ZIG_VERSION}.tar.xz" && \ + rm "zig-linux-aarch64-${ZIG_VERSION}.tar.xz"; \ + else \ + wget "https://ziglang.org/builds/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ + tar -C /usr/local -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ + rm "zig-linux-x86_64-${ZIG_VERSION}.tar.xz"; \ + fi + +ENV PATH="${PATH}:/usr/local/zig-linux-${TARGETARCH}-${ZIG_VERSION}" + +RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ + cd hugo-python-distributions && \ + pip install -e . && \ + pip install . + +WORKDIR /hugo-python-distributions + +CMD ["/bin/bash"] diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 deleted file mode 100644 index e0aced6..0000000 --- a/Dockerfile.amd64 +++ /dev/null @@ -1,33 +0,0 @@ -# /Dockerfile.amd64 -FROM python:3.11.9-slim - -ENV ZIG_VERSION=0.11.0 - -WORKDIR / - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - gcc \ - g++ \ - clang \ - git \ - wget \ - dos2unix \ - xz-utils \ - musl-tools \ - && rm -rf /var/lib/apt/lists/* - -RUN wget "https://ziglang.org/builds/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ - tar -C /usr/local -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" && \ - rm "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" - -ENV PATH="${PATH}:/usr/local/zig-linux-x86_64-${ZIG_VERSION}" - -RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ - cd hugo-python-distributions && \ - pip install -e . && \ - pip install . - -WORKDIR /hugo-python-distributions - -CMD ["/bin/bash"] diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 deleted file mode 100644 index c8594d4..0000000 --- a/Dockerfile.arm64 +++ /dev/null @@ -1,33 +0,0 @@ -# /Dockerfile.arm64 -FROM python:3.11.9-slim - -ENV ZIG_VERSION=0.11.0 - -WORKDIR / - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - gcc \ - g++ \ - clang \ - git \ - wget \ - dos2unix \ - xz-utils \ - musl-tools \ - && rm -rf /var/lib/apt/lists/* - -RUN wget "https://ziglang.org/builds/zig-linux-aarch64-${ZIG_VERSION}.tar.xz" && \ - tar -C /usr/local -xf "zig-linux-aarch64-${ZIG_VERSION}.tar.xz" && \ - rm "zig-linux-aarch64-${ZIG_VERSION}.tar.xz" - -ENV PATH="${PATH}:/usr/local/zig-linux-aarch64-${ZIG_VERSION}" - -RUN git clone https://github.com/agriyakhetarpal/hugo-python-distributions && \ - cd hugo-python-distributions && \ - pip install -e . && \ - pip install . - -WORKDIR /hugo-python-distributions - -CMD ["/bin/bash"] From d33a66708e3e73eca6d137d22bec0f6205e98c15 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 7 Jun 2024 17:52:23 +0530 Subject: [PATCH 13/17] :writing_hand: Change BUILDING_FOR_WINDOWS -> BUILD_STATIC --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3e24f9e..be0afef 100644 --- a/setup.py +++ b/setup.py @@ -196,11 +196,11 @@ def run(self): # Build a static binary on Windows to avoid missing DLLs from MinGW, # i.e., libgcc_s_seh-1.dll, libstdc++-6.dll, etc. - BUILDING_FOR_WINDOWS = ( + BUILD_STATIC = ( os.environ.get("GOOS") == "windows" or sys.platform == "win32" ) - if BUILDING_FOR_WINDOWS: + if BUILD_STATIC: ldflags.append("-extldflags '-static'") if not (Path(HUGO_CACHE_DIR).resolve() / f"hugo-{HUGO_VERSION}").exists(): From f82aa83bb0ddc23fe986f6f31e583afcdd8af02d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:22:33 +0000 Subject: [PATCH 14/17] =?UTF-8?q?=F0=9F=AA=A9=20Automated=20fixes=20from?= =?UTF-8?q?=20https://pre-commit.ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index be0afef..12f1229 100644 --- a/setup.py +++ b/setup.py @@ -196,9 +196,7 @@ def run(self): # Build a static binary on Windows to avoid missing DLLs from MinGW, # i.e., libgcc_s_seh-1.dll, libstdc++-6.dll, etc. - BUILD_STATIC = ( - os.environ.get("GOOS") == "windows" or sys.platform == "win32" - ) + BUILD_STATIC = os.environ.get("GOOS") == "windows" or sys.platform == "win32" if BUILD_STATIC: ldflags.append("-extldflags '-static'") From 33bb90982726780d3a1103acd3ebdcee7b2890ae Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 9 Jun 2024 08:28:39 +0530 Subject: [PATCH 15/17] :checkered_flag: Check for `linux-musl` in `CC` & `CXX` environment variable --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 12f1229..743078a 100644 --- a/setup.py +++ b/setup.py @@ -196,7 +196,9 @@ def run(self): # Build a static binary on Windows to avoid missing DLLs from MinGW, # i.e., libgcc_s_seh-1.dll, libstdc++-6.dll, etc. - BUILD_STATIC = os.environ.get("GOOS") == "windows" or sys.platform == "win32" + BUILD_STATIC = "linux-musl" in os.environ.get( + "CC", "" + ) or "linux-musl" in os.environ.get("CXX", "") if BUILD_STATIC: ldflags.append("-extldflags '-static'") From 0478067033c661aacdfb01ac3a5a2cee0f05bde8 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Mon, 1 Jul 2024 13:13:14 +0530 Subject: [PATCH 16/17] :mag: Check for windows as well in `BUILD_STATIC` --- .github/workflows/cd.yml | 34 +++++++++++++++++----------------- .github/workflows/ci.yml | 14 +++++++------- .pre-commit-config.yaml | 4 ++-- setup.py | 12 +++++++----- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5317a64..e77074f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -26,7 +26,7 @@ jobs: name: sdist runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: 3.12 @@ -44,7 +44,7 @@ jobs: name: amd64-windows runs-on: windows-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: go-version: '1.22.2' @@ -53,7 +53,7 @@ jobs: - name: Install MinGW compiler(s) run: choco install mingw - - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -76,8 +76,8 @@ jobs: name: amd64-manylinux runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -107,12 +107,12 @@ jobs: name: arm64-manylinux runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 with: platforms: all - - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -142,13 +142,13 @@ jobs: name: s390x-manylinux runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 with: platforms: all - name: Build binary distribution (wheel) on Linux (s390x) - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -178,13 +178,13 @@ jobs: name: ppc64le-manylinux runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 with: platforms: all - name: Build binary distribution (wheel) on Linux (ppc64le) - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -214,14 +214,14 @@ jobs: name: amd64-macos runs-on: macos-13 steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: go-version: '1.22.2' cache: false check-latest: true - - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -242,14 +242,14 @@ jobs: name: arm64-macos runs-on: macos-14 steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: go-version: '1.22.2' cache: false check-latest: true - - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -295,7 +295,7 @@ jobs: path: upload/ merge-multiple: true - - uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14 + - uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 if: github.event_name == 'release' && github.event.action == 'published' with: # Comment this line out to publish to PyPI @@ -310,7 +310,7 @@ jobs: ./upload/*.tar.gz - name: Publish to GitHub Releases - uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v2.0.5 + uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v2.0.6 if: github.event_name == 'release' && github.event.action == 'published' with: # This will contain not only the wheel and sdist, but also the signature files diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0524f11..81772de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: 3.12 @@ -54,7 +54,7 @@ jobs: runs-on: macos-14 steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: ${{ matrix.python-version }} @@ -93,7 +93,7 @@ jobs: name: linux-aarch64-buildjet-python-3.12 runs-on: buildjet-2vcpu-ubuntu-2204-arm steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: buildjet/setup-python@v5 - uses: buildjet/setup-go@af85c03c2736c2267d5afe4d5952023a3b64bf89 # v5.0.0 with: @@ -138,7 +138,7 @@ jobs: - python-version: "3.13" runs-on: windows-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: ${{ matrix.python-version }} @@ -182,7 +182,7 @@ jobs: if: matrix.runs-on == 'windows-latest' && matrix.architecture == 'arm64' # We need to use cibuildwheel because it has experimental support for cross-compiling # to arm64 and setup-python does not have arm64 support on Windows right now - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -202,7 +202,7 @@ jobs: # do not need to do that manually unless we use setup-python instead. - name: Build binary distribution (wheel) on Windows (i686) if: matrix.runs-on == 'windows-latest' && matrix.architecture == 'i686' - uses: pypa/cibuildwheel@ba8be0d98853f5744f24e7f902c8adef7ae2e7f3 # v2.18.1 + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 with: package-dir: . output-dir: wheelhouse @@ -230,7 +230,7 @@ jobs: name: inspect-sdist-wheel-contents runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: 3.12 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 374cef9..682926f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.5" + rev: "v0.4.10" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -27,7 +27,7 @@ repos: types_or: [python, pyi] - repo: https://github.com/asottile/pyupgrade - rev: "v3.15.2" + rev: "v3.16.0" hooks: - id: pyupgrade diff --git a/setup.py b/setup.py index 743078a..ee117c8 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ # ------ Hugo build configuration and constants ------------------------------------ -HUGO_VERSION = "0.126.3" +HUGO_VERSION = "0.128.0" # The Go toolchain will download the tarball into the hugo_cache/ directory. # We will point the build command to that location to build Hugo from source HUGO_CACHE_DIR = "hugo_cache" @@ -196,10 +196,12 @@ def run(self): # Build a static binary on Windows to avoid missing DLLs from MinGW, # i.e., libgcc_s_seh-1.dll, libstdc++-6.dll, etc. - BUILD_STATIC = "linux-musl" in os.environ.get( - "CC", "" - ) or "linux-musl" in os.environ.get("CXX", "") - + BUILD_STATIC = ( + os.environ.get("GOOS") == "windows" + or sys.platform == "win32" + or "linux-musl" in os.environ.get("CC", "") + or "linux-musl" in os.environ.get("CXX", "") + ) if BUILD_STATIC: ldflags.append("-extldflags '-static'") From 4e39c5014851dae786bd3262fbb85b74a9632480 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Mon, 1 Jul 2024 21:14:58 +0530 Subject: [PATCH 17/17] :test_tube: Run tests inside the built Docker image --- .github/workflows/docker.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 750584a..0dc3acb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -35,8 +35,13 @@ jobs: context: . file: Dockerfile tags: agriyakhetarpal/hugo:latest # To be updated with exact Docker Hub username and image name - push: true + push: false platforms: linux/amd64, linux/arm64 + - name: Run tests inside the built Docker image + run: | + docker run --rm agriyakhetarpal/hugo:latest hugo version + docker run --rm agriyakhetarpal/hugo:latest hugo env + - name: List built image(s) run: docker images