Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/actions/buildrpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM opensuse/tumbleweed:latest

# Update
RUN zypper patch -y

# Install necessary packages
RUN zypper in -y \
rpm-build rpmdevtools dnf-plugins-core python3 git gcc fdupes \
python311-pip python311-setuptools python311-setuptools_scm python311-wheel \
python312-pip python312-setuptools python312-setuptools_scm python312-wheel \
python313-pip python313-setuptools python313-setuptools_scm python313-wheel

WORKDIR /usr/src/packages

# Copy necessary files to build a rpm package
COPY python-bytecode.spec SPECS/
COPY python-bytecode.tar.gz SOURCES/

# Set up the entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
10 changes: 10 additions & 0 deletions .github/actions/buildrpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Build RPM"
description: "Build RPM package"

outputs:
rpm-package:
description: "Bytecode is a Python module to generate and modify bytecode"

runs:
using: "docker"
image: "Dockerfile"
8 changes: 8 additions & 0 deletions .github/actions/buildrpm/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
cd /usr/src/packages

# Update release verion on spec file
sed -i -e "s/##RPMVERSION##/$RELEASE_VERSION/" SPECS/python-bytecode.spec

rpmbuild -bb SPECS/python-bytecode.spec
mv RPMS/noarch/*.rpm $GITHUB_WORKSPACE
55 changes: 55 additions & 0 deletions .github/actions/buildrpm/python-bytecode.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# spec file for package python-bytecode
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name: python-bytecode
Version: ##RPMVERSION##
Release: 1%{?dist}
Summary: Python module to generate and modify bytecode
License: MIT
URL: https://github.com/mrcaique/bytecode
Source: /github/home/rpmbuild/SOURCES/%{name}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools >= 61.2}
BuildRequires: %{python_module setuptools_scm >= 3.4.3}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildArch: noarch
%python_subpackages

%description
Python module to generate and modify bytecode

%prep
%autosetup -p1 -n bytecode

%build
%pyproject_wheel

%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%files %{python_files}
%doc README.rst
%license COPYING
%{python_sitelib}/bytecode
%{python_sitelib}/bytecode-*.dist-info

%changelog

32 changes: 32 additions & 0 deletions .github/workflows/rpmbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: RPM build

on:
push:
tags:
- 'v*.*.*'

jobs:
build_rpm:
if: ${{ github.event.base_ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set release version env
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_REF

- name: Create source archive
run: >
cd ..
&& tar -czf python-bytecode.tar.gz bytecode
&& mv python-bytecode.tar.gz bytecode/.github/actions/buildrpm

- name: Build RPM package
id: rpm
uses: ./.github/actions/buildrpm

- name: Upload RPM as artifact
uses: actions/upload-artifact@v4
with:
name: python-bytecode-binary-rpm-${{ env.RELEASE_VERSION }}
path: ${{ github.workspace }}/*.rpm