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
19 changes: 19 additions & 0 deletions .github/actions/testrpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM opensuse/tumbleweed:latest

# Update
RUN zypper patch -y

# Install necessary packages
RUN zypper in -y \
python311 python312 python313

WORKDIR /tmp/

# Copy necessary files to build a rpm package
COPY *.noarch.rpm ./

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

ENTRYPOINT ["/entrypoint.sh"]
6 changes: 6 additions & 0 deletions .github/actions/testrpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: "Test RPM package"
description: "Test RPM package on openSUSE Tumbleweed"

runs:
using: "docker"
image: "Dockerfile"
29 changes: 29 additions & 0 deletions .github/actions/testrpm/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/bash
set -e

PRINT_VERSION='import bytecode; print("Bytecode version:", bytecode.__version__)'

HELLO_WORLD="
from bytecode import Instr, Bytecode

bytecode = Bytecode([Instr(\"LOAD_GLOBAL\", (True, 'print')),
Instr(\"LOAD_CONST\", 'Hello World!'),
Instr(\"CALL\", 1),
Instr(\"POP_TOP\"),
Instr(\"LOAD_CONST\", None),
Instr(\"RETURN_VALUE\")])
code = bytecode.to_code()
exec(code)"

PY_VERSIONS=('python3.11' 'python3.12' 'python3.13')

cd /tmp/
rpm -ivh python3*.noarch.rpm

# Test installation, print version, and run hello world
for py in ${PY_VERSIONS[@]}
do
echo "Test $($py --version)"
$py -c "$PRINT_VERSION"
$py -c "$HELLO_WORLD" && echo ""
done
17 changes: 16 additions & 1 deletion .github/workflows/rpmbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,20 @@ jobs:
- name: Upload RPM as artifact
uses: actions/upload-artifact@v4
with:
name: python-bytecode-binary-rpm-${{ env.RELEASE_VERSION }}
name: python-bytecode-binary-rpm
path: ${{ github.workspace }}/*.rpm

test_rpm:
needs: build_rpm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download RPM artifact
uses: actions/download-artifact@v4
with:
name: python-bytecode-binary-rpm
path: ./.github/actions/testrpm

- name: Test RPM package
uses: ./.github/actions/testrpm