From 9931216934e65a52da2b0a1c078363011904bf39 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 1 Dec 2024 16:13:30 +1100 Subject: [PATCH] feat: add artifact management - upload/download artifacts instead of building build and deploy jobs - updated uv package with version in url - add ruff/0.8.1 package --- .gitea/workflows/build.yaml | 5 +++++ .gitea/workflows/deploy.yaml | 13 ++++++++++-- rpms/ruff/0.8.1/release | 1 + rpms/ruff/Dockerfile | 24 +++++++++++++++++++++++ rpms/ruff/nfpm.yaml | 38 ++++++++++++++++++++++++++++++++++++ rpms/uv/0.5.5/release | 2 +- rpms/uv/Dockerfile | 2 +- 7 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 rpms/ruff/0.8.1/release create mode 100644 rpms/ruff/Dockerfile create mode 100644 rpms/ruff/nfpm.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 3b2fb9d..59fbacf 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -21,3 +21,8 @@ jobs: - name: Show RPMs run: | find /workspace -type f -name "*.rpm" + + - uses: actions/upload-artifact@v3 + with: + name: rpms + path: /workspace/unkin/rpmbuilder/dist/*/*.rpm diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 71e1853..421d685 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -16,9 +16,18 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Build Packages + - name: Create dist directory run: | - make all + mkdir -p /workspace/unkin/rpmbuilder/dist + + - uses: actions/download-artifact@v2 + with: + name: rpms + path: /workspace/unkin/rpmbuilder/dist/ + + - name: Show RPMs + run: | + find /workspace -type f -name "*.rpm" - name: Upload RPMs to Gitea env: diff --git a/rpms/ruff/0.8.1/release b/rpms/ruff/0.8.1/release new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/rpms/ruff/0.8.1/release @@ -0,0 +1 @@ +1 diff --git a/rpms/ruff/Dockerfile b/rpms/ruff/Dockerfile new file mode 100644 index 0000000..93e10a9 --- /dev/null +++ b/rpms/ruff/Dockerfile @@ -0,0 +1,24 @@ +# Start with the AlmaLinux 8.10 base image +FROM git.query.consul/unkin/almalinux8-buildagent:latest + +# Create output directory for RPMs +RUN mkdir -p /app/dist + +# Set working directory +WORKDIR /app + +ARG PACKAGE_RELEASE +ENV PACKAGE_RELEASE=${PACKAGE_RELEASE} +ARG PACKAGE_VERSION +ENV PACKAGE_VERSION=${PACKAGE_VERSION} + +# Copy nfpm.yaml from the context into the container +COPY nfpm.yaml /app/nfpm.yaml + +# Download the required files +RUN wget -O /app/ruff-x86_64-unknown-linux-gnu.tar.gz https://github.com/astral-sh/ruff/releases/download/${PACKAGE_VERSION}/ruff-x86_64-unknown-linux-gnu.tar.gz && \ + tar xf /app/ruff-x86_64-unknown-linux-gnu.tar.gz && \ + mv /app/ruff-x86_64-unknown-linux-gnu/* /app/ + +# Default command to build RPMs +CMD nfpm pkg --config /app/nfpm.yaml --target /app/dist --packager rpm diff --git a/rpms/ruff/nfpm.yaml b/rpms/ruff/nfpm.yaml new file mode 100644 index 0000000..0e2f923 --- /dev/null +++ b/rpms/ruff/nfpm.yaml @@ -0,0 +1,38 @@ +# nfpm.yaml + +name: ruff +version: ${PACKAGE_VERSION} +release: ${PACKAGE_RELEASE} +arch: amd64 +platform: linux +section: default +priority: extra +description: "An extremely fast Python linter and code formatter, written in Rust." + +maintainer: Astral.sh +homepage: https://docs.astral.sh/ruff/ +license: Apache-2.0 + +disable_globbing: false + +replaces: + - ruff + +provides: + - ruff + +# Files to include in the package +contents: + - src: /app/ruff + dst: /usr/bin/ruff + file_info: + mode: 0755 + owner: root + group: root + +# Scripts to run during installation/removal (optional) +# scripts: +# preinstall: ./scripts/preinstall.sh +# postinstall: ./scripts/postinstall.sh +# preremove: ./scripts/preremove.sh +# postremove: ./scripts/postremove.sh diff --git a/rpms/uv/0.5.5/release b/rpms/uv/0.5.5/release index d00491f..0cfbf08 100644 --- a/rpms/uv/0.5.5/release +++ b/rpms/uv/0.5.5/release @@ -1 +1 @@ -1 +2 diff --git a/rpms/uv/Dockerfile b/rpms/uv/Dockerfile index 27fe188..1583ae1 100644 --- a/rpms/uv/Dockerfile +++ b/rpms/uv/Dockerfile @@ -16,7 +16,7 @@ ENV PACKAGE_VERSION=${PACKAGE_VERSION} COPY nfpm.yaml /app/nfpm.yaml # Download the required files -RUN wget -O /app/uv-x86_64-unknown-linux-gnu.tar.gz https://github.com/astral-sh/uv/releases/download/0.5.5/uv-x86_64-unknown-linux-gnu.tar.gz && \ +RUN wget -O /app/uv-x86_64-unknown-linux-gnu.tar.gz https://github.com/astral-sh/uv/releases/download/${PACKAGE_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz && \ tar xf /app/uv-x86_64-unknown-linux-gnu.tar.gz && \ mv /app/uv-x86_64-unknown-linux-gnu/* /app/