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
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Test

on: [push, pull_request]

env:
DEBIAN_FRONTEND: noninteractive
DIST_DIR: dist

jobs:
build:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
steps:
- uses: actions/checkout@v4

- name: Install build dependencies
run: |
apt-get update -qq
apt-get install -yqq --no-install-recommends \
ca-certificates curl git \
debhelper devscripts dpkg-dev meson pkg-config \
python3-all-dev python3-pip python3-setuptools python3-venv python3-wheel \
libpcre3-dev
curl -sLO https://launchpad.net/~kxstudio-debian/+archive/ubuntu/toolchain/+files/meson_1.9.1-1kxstudio2_all.deb
dpkg -i meson_1.9.1-1kxstudio2_all.deb

- name: Build
run: ./scripts/build.sh

- name: Test
run: ./scripts/test.sh

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: lilvlib-packages
path: dist/
retention-days: 30
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.deb
*.ddeb
.idea/
*.egg-info
build
dist
dist
__pycache__
82 changes: 67 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,73 @@
# This Dockerfile can be used to build lilvlib using:
# - Ubuntu 18
# - Python 3.6
# Multi-stage Dockerfile for building and testing lilvlib
# Usage:
# docker build -t lilvlib-build .
# docker run --rm -v $(pwd)/dist:/dist lilvlib-build
#
# To run only the build stage (skip tests):
# docker build --target builder -t lilvlib-builder .

FROM moddevices/devtools:ub18-py36
# =============================================================================
# Stage 1: Builder - compile python3-lilv and build wheel
# =============================================================================
FROM ubuntu:22.04 AS builder

LABEL Alexandre Cunha <ale@moddevices.com>
ENV DEBIAN_FRONTEND=noninteractive

RUN mkdir /root/.ssh
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
debhelper \
devscripts \
dpkg-dev \
git \
libpcre3-dev \
meson \
pkg-config \
python3-all-dev \
python3-pip \
python3-setuptools \
python3-wheel \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get install --no-install-recommends -qy libpcre3-dev \
devscripts pkg-config swig debhelper python3-numpy \
&& apt-get clean
# Ubuntu 22.04's meson (0.61.2) is incompatible with the build
RUN curl -sLO https://launchpad.net/~kxstudio-debian/+archive/ubuntu/toolchain/+files/meson_1.9.1-1kxstudio2_all.deb \
&& dpkg -i meson_1.9.1-1kxstudio2_all.deb \
&& rm meson_1.9.1-1kxstudio2_all.deb

COPY . /lilvlib
WORKDIR /lilvlib
WORKDIR /src
COPY . .

RUN ./build-python3-lilv.sh
RUN pip3 wheel -w wheelhouse .
ENV DIST_DIR=/artifacts
RUN ./scripts/build.sh

# =============================================================================
# Stage 2: Tester - validate artifacts in a clean environment
# =============================================================================
FROM ubuntu:22.04 AS tester

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /src
COPY --from=builder /artifacts /artifacts
COPY --from=builder /src/test.py /src/
COPY --from=builder /src/lilvlib /src/lilvlib
COPY --from=builder /src/scripts /src/scripts

ENV DIST_DIR=/artifacts
RUN apt-get update && ./scripts/test.sh && rm -rf /var/lib/apt/lists/*

# =============================================================================
# Final Stage: Artifacts - extract build outputs (runs after tests pass)
# =============================================================================
FROM ubuntu:22.04

WORKDIR /artifacts
COPY --from=tester /artifacts /artifacts

CMD ["sh", "-c", "cp -v /artifacts/* /dist/ 2>/dev/null || echo 'Mount a volume to /dist to extract artifacts: docker run --rm -v $(pwd)/dist:/dist <image>'"]
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This repository contains a build script for lilvlib and its python3-lilv dependency, using the latest development version from git.

The reason why you need this script is because most distros have an outdated lilv binary, don't build lilv python modules or build the python2 modules instead of our required python3 version.
The reason why you need this script is because most distros have an outdated lilv binary or don't build lilv python modules.

To start simply run:

Expand All @@ -15,12 +15,13 @@ The generated package will contain `python3-lilv` and also everything needed for
This includes:

- LV2 headers and definitions
- MOD-SDK LV2 definitions
- Dargklass LV2 definitions
- KXStudio LV2 definitions
- MOD Audio LV2 definitions
- sord_validate (static binary)
- sord_validate_mod
- lv2_validate_mod

The `sord_validate_mod` is a helper script that runs `sord_validate` with the correct bundles.
The `lv2_validate_mod` is a helper script that runs `lv2_validate` with extra Darkglass, KXStudio and MOD Audio related bundles.

Because this package uses the definitions copied during build (in `/opt`), it does not depend on any external resources.

Expand All @@ -35,13 +36,15 @@ Install
dpkg -i python3-lilv_0.22.1+git20170620_amd64.deb
```

## Testing

Use

```bash
/usr/bin/python3
```

```python
```python
import lilvlib
lilvlib.get_plugin_info_helper('')
```
Loading