Skip to content

Commit

Permalink
automated build. Setup .github release creation
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed May 16, 2024
1 parent 8e98f7d commit 9e2f8cb
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Artefact builder
on:
push:
branches:
- internal
tags:
- v*.*.*
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
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: Build
run: |
docker buildx build --platform linux/amd64,linux/arm64 --output=type=local,dest=dist .
mv dist/linux_amd64/app/build/cage dist/cage-amd64
mv dist/linux_arm64/app/build/cage dist/cage-arm64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cage-binaries
path: dist/cage-*
retention-days: 1
- name: create release
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
artifacts: "dist/cage-*"
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/subprojects/**
!/subprojects/*.wrap
!/subprojects/*.wrap
!/subprojects/packagecache
!/subprojects/packagecache/.placeholder
!/subprojects/packagefiles
!/subprojects/packagefiles/*.patch
35 changes: 24 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM debian:12-slim
#debian 12 is required to have a recent-enough built-in meson.
ENV DEBIAN_FRONTEND=noninteractive

# Install build tools
RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
git \
ca-certificates \
build-essential \
cmake \
Expand All @@ -26,13 +28,9 @@ RUN apt-get -qqy update \
quilt \
libexpat1-dev \
libffi-dev \
libxml2-dev \
liblzma-dev \
&& rm -rf /var/lib/apt/lists/*

# wlroots build-deps (https://packages.debian.org/source/bookworm/wlroots)
# - libwayland-dev is required for wayland-scanner, which is set as "native" but could probablyt be force to use the local file.
# (https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/meson.build#L8)
RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
libavformat-dev \
Expand Down Expand Up @@ -63,19 +61,34 @@ RUN apt-get -qqy update \
libx11-xcb-dev \
libxkbcommon-dev \
hwdata \
libwayland-dev \
xwayland \
libxcb-ewmh-dev \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY . /app

RUN rm -rf /app/build
RUN mkdir -p /app/subprojects

RUN meson setup build --prefer-static --default-library=static --buildtype=release -Dwerror=false -Doptimization=2 \
-Dxwayland=enabled \
COPY meson_options.txt meson.build /app/
COPY *.in *.scd .clang-format .clang-format-ignore /app/

COPY subprojects/*.wrap /app/subprojects/
COPY subprojects/packagefiles /app/subprojects/packagefiles
COPY subprojects/packagecache /app/subprojects/packagecache

COPY ./protocol /app/protocol
COPY *.[ch] /app/


# Fix for the use of local wayland-scanner in subsequent builds
ENV PATH="${PATH}:/app/build/subprojects/wayland-1.22.0/src"

RUN meson setup build --prefer-static --default-library=static --buildtype=release -Dwerror=false \
-Dxwayland=enabled -Dinput_calibration=enabled -Dman-pages=disabled \
-Dwlroots:auto_features=enabled -Dwlroots:backends=auto -Dwlroots:renderers=auto \
-Dwayland:documentation=false -Dwayland:tests=false
-Dwayland:documentation=false -Dwayland:dtd_validation=false

RUN ninja -C build

RUN ninja -C build
# Makes the image unusable, but useful to use with `docker buildx build --output=type=local`as we are.
RUN rm -rf /usr /var
Empty file.
25 changes: 25 additions & 0 deletions subprojects/packagefiles/0001-use-local-wayland-scanner.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Use local wayland-scanner instead of looking for the native one in the host system.
Since we don't plan to do cross-compilation and wayland-scanner is built from wayland subproject, we override this.
---
protocol/meson.build | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/protocol/meson.build b/protocol/meson.build
index c60f2b9a..76cfbf24 100644
--- a/protocol/meson.build
+++ b/protocol/meson.build
@@ -5,10 +5,8 @@ wayland_protos = dependency('wayland-protocols',
)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')

-wayland_scanner_dep = dependency('wayland-scanner', native: true)
wayland_scanner = find_program(
- wayland_scanner_dep.get_variable('wayland_scanner'),
- native: true,
+ 'wayland-scanner'
)

protocols = {
--
2.39.2

2 changes: 2 additions & 0 deletions subprojects/wlroots.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ source_url =https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/0.17.2/dow
source_filename = wlroots-0.17.2.tar.xz
source_hash = f4007d3f71e190b9000ab4a30afd87833b034ab2602030a00af4465ffd4e997c

diff_files = 0001-use-local-wayland-scanner.patch

[provide]
wlroots = wlroots

0 comments on commit 9e2f8cb

Please sign in to comment.