diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 779eb23..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Create and publish Docker image - -on: [push] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - strategy: - fail-fast: true - matrix: - docker: - - { dockerfile: 'Dockerfile-ubuntu', suffix: '' } - - { dockerfile: 'Dockerfile-manylinux', suffix: '-manylinux' } - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Checkout Lite XL - uses: actions/checkout@v4 - with: - repository: lite-xl/lite-xl - path: lite-xl - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}${{ matrix.docker.suffix }} - - - name: Build Docker image - uses: docker/build-push-action@v6 - with: - context: . - file: ${{ matrix.docker.dockerfile }} - load: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Test Docker Image - run: | - docker run --entrypoint /entrypoint.sh -v "$(pwd)/lite-xl":"/lite-xl" --rm \ - "${DOCKER_METADATA_OUTPUT_TAGS%%$'\n'*}" cd /lite-xl '&&' meson setup --wrap-mode=forcefallback build - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - if: startsWith(github.ref, 'refs/tags/v') - with: - context: . - file: ${{ matrix.docker.dockerfile }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b381743 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,186 @@ +name: CI + +on: [push] + +env: + REGISTRY: ghcr.io + IMAGE_BASE: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + strategy: + fail-fast: false + matrix: + suffix: + - "ubuntu" + - "manylinux" + platform: + - linux/arm64 + - linux/amd64 + + steps: + - name: Prepare + id: prepare + run: | + digest_key="${{ matrix.suffix }}_${{ matrix.platform }}" + echo "DIGEST_KEY=${digest_key//\//-}" >> $GITHUB_OUTPUT + echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}-${{ matrix.suffix }}" >> $GITHUB_OUTPUT + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ steps.prepare.outputs.IMAGE_NAME }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Set up container cache + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-${{ steps.prepare.outputs.DIGEST_KEY }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ steps.prepare.outputs.DIGEST_KEY }}-buildx- + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build Docker image + id: build + uses: docker/build-push-action@v6 + with: + context: docker + file: docker/Dockerfile-${{ matrix.suffix }} + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ steps.prepare.outputs.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Fix Buildx cache not being cleared + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ steps.prepare.outputs.DIGEST_KEY }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: [build] + + permissions: + contents: read + packages: write + + strategy: + fail-fast: false + matrix: + image: + - { suffix: "", original: "ubuntu" } + - { suffix: "-ubuntu", original: "ubuntu" } + - { suffix: "-manylinux", original: "manylinux" } + + steps: + - name: Prepare + id: prepare + run: | + digest_key="${{ matrix.image.original }}" + echo "DIGEST_KEY=${digest_key//\//-}" >> $GITHUB_OUTPUT + echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}${{ matrix.image.suffix }}" >> $GITHUB_OUTPUT + echo "ORIGINAL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}-${{ matrix.image.original }}" >> $GITHUB_OUTPUT + + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-${{ steps.prepare.outputs.DIGEST_KEY }}* + merge-multiple: true + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ steps.prepare.outputs.IMAGE_NAME }} + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create \ + $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ steps.prepare.outputs.ORIGINAL_IMAGE_NAME }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ steps.prepare.outputs.IMAGE_NAME }}:${{ steps.meta.outputs.version }} + + smoke-test: + runs-on: ubuntu-latest + needs: [merge] + + strategy: + matrix: + platform: + - linux/arm64 + - linux/amd64 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Checkout Lite XL + uses: actions/checkout@v4 + with: + repository: lite-xl/lite-xl + path: lite-xl + + - name: Configure Lite XL + uses: ./ + with: + platform: ${{ matrix.platform }} + run: | + cd lite-xl + meson setup --wrap-mode=forcefallback build diff --git a/Dockerfile-manylinux b/Dockerfile-manylinux deleted file mode 100644 index 6cde447..0000000 --- a/Dockerfile-manylinux +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 2023 Lite XL Contributors -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -FROM quay.io/pypa/manylinux2014_x86_64 - -# these files are from RHEL8 -ADD libdecor-devel-0.1.0-3.el8.x86_64.rpm libdecor-0.1.0-3.el8.x86_64.rpm / - -# install deps -RUN yum -y update && yum clean all && \ - yum -y install wget curl zip unzip rh-python38 ccache fuse fuse3 sudo \ - libX11-devel libXi-devel libXcursor-devel libxkbcommon-devel libXrandr-devel wayland-devel wayland-protocols-devel dbus-devel ibus-devel SDL2-devel \ - gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu binutils-aarch64-linux-gnu - -# install meson and ninja -RUN source /opt/rh/rh-python38/enable && pip3 install meson ninja - -# install libdecor -RUN rpm -ivh --nodeps libdecor-devel-0.1.0-3.el8.x86_64.rpm -RUN rpm -ivh --nodeps libdecor-0.1.0-3.el8.x86_64.rpm - -ADD entrypoint-manylinux.sh /entrypoint.sh - diff --git a/Dockerfile-ubuntu b/Dockerfile-ubuntu deleted file mode 100644 index 0b9abd6..0000000 --- a/Dockerfile-ubuntu +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 2023 Lite XL Contributors -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -FROM ubuntu:18.04 - -# these files are from ubuntu 20.04 -ADD libdecor-0-dev_0.1.0-3build1_amd64.deb libdecor-0-0_0.1.0-3build1_amd64.deb / - -# install deps -RUN apt-get update && apt-get -y upgrade && \ - apt-get install -y sudo ccache curl wget python3.7 python3-pip build-essential \ - zip unzip git cmake wayland-protocols libsdl2-dev software-properties-common clang gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu && \ - python3.7 -m pip install meson ninja - -# update git -RUN sudo add-apt-repository -y ppa:git-core/ppa && \ - sudo apt-get update -y && sudo apt-get --with-new-pkgs upgrade -y git - -# install libdecor -RUN dpkg --force-all -i libdecor-0-dev_0.1.0-3build1_amd64.deb libdecor-0-0_0.1.0-3build1_amd64.deb - -ADD entrypoint-ubuntu.sh /entrypoint.sh - diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..493f6e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023-Present Lite XL Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 3a5fd83..a7e1ba0 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,22 @@ # Lite XL Build Box -> **Note** +> [!IMPORTANT] > The Ubuntu variant of the build box is considered obsolete and will be removed in the future. > Please migrate to the CentOS variant. This is a Docker image of the setup used to build Lite XL. It is based on manylinux_2014 with some workarounds to ensure libdecor support. -## Notes - -Before installing anything, -you will need to uninstall `libdecor-devel` to prevent -any broken dependencies error during installation. - # Installed packages +- Python 3.11 (provided by manylinux) - `wget` - `curl` - `zip` - `unzip` - `ccache` - `sudo` -- `rh-python38` (configured as `python3`) -- `pip` (provided by `rh-python38`) +- `pip` (provided by `cp311-cp311`) - `git` - `cmake` - `meson` @@ -43,7 +37,32 @@ any broken dependencies error during installation. - `gcc-aarch64-linux-gnu` - `gcc-c++-aarch64-linux-gnu` - `binutils-aarch64-linux-gnu` -- `libdecor-devel` (package yanked from RHEL8) +- `libdecor-devel` (package yanked from Raven Extras) + +# GitHub Actions + +The recommended way of using this build box is via the `lite-xl-build-box` Action. +This action sets up the container environment correctly and runs a script in the container. + +```yaml +- name: Set up QEMU + uses: docker/setup-qemu-action@v3 + +- name: Build AppImages + uses: lite-xl/lite-xl-build-box@v3 + with: + run: | + bash scripts/appimage.sh --debug --static --version ${INSTALL_REF} --release + bash scripts/appimage.sh --debug --nobuild --addons --version ${INSTALL_REF} + +- name: Build AppImages (aarch64) + uses: lite-xl/lite-xl-build-box@v3 + with: + platform: linux/arm64 + run: | + bash scripts/appimage.sh --debug --static --version ${INSTALL_REF} --release + bash scripts/appimage.sh --debug --nobuild --addons --version ${INSTALL_REF} +``` # Step Entrypoint @@ -53,7 +72,7 @@ you can pass a script directly, similar to `run` by specifying ```yaml - name: Build AppImages - uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:v2.2.0 + uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:latest with: entrypoint: /entrypoint.sh args: | @@ -67,12 +86,6 @@ into a single line.
Instructions for Ubuntu -## Notes - -Before installing anything, -you will need to uninstall `libdecor-0-dev` and `libdecor-0` to prevent -any broken dependencies error during installation. - # Installed packages - `ccache` @@ -90,7 +103,6 @@ any broken dependencies error during installation. - `clang` - `gcc-aarch64-linux-gnu` - `binutils-aarch64-linux-gnu` -- `libdecor-0` (package yanked from Ubuntu 20.04) - `libdecor-0-dev` (package yanked from Ubuntu 20.04) # Step Entrypoint diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..bd18a77 --- /dev/null +++ b/action.yml @@ -0,0 +1,66 @@ +# action.yml +name: "Lite XL Build Box Action" +description: "Runs a command inside Lite XL Build Box." +inputs: + image: + description: "Image name." + required: false + default: ghcr.io/${{ github.repository }}-manylinux:latest + volumes: + description: "A list of volumes to mount." + required: false + options: + description: 'Extra options passed to "docker run".' + required: false + run: + description: 'A list of commands to run inside the container (mutually exclusive with "run-args").' + required: false + run_args: + description: 'A list of arguments passed to "docker run" after the image name (mutually exclusive with "run").' + required: false + shell: + description: "Use a specific shell or entrypoint." + required: false + default: bash + platform: + description: "The platform to run the container on." + required: false + registry: + description: "Container Registry." + required: false + username: + description: "Username." + required: false + password: + description: "Password." + required: false + docker_network: + description: "Docker Network ID." + default: ${{ job.container.network }} + required: false +runs: + using: "composite" + steps: + - name: Login into registry + if: inputs.username != '' && inputs.password != '' && inputs.registry != '' + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry }} + username: ${{ inputs.username }} + password: ${{ inputs.password }} + + - name: Run Docker + shell: bash + env: + INPUT_IMAGE: ${{ inputs.image }} + INPUT_VOLUMES: ${{ inputs.volumes }} + INPUT_OPTIONS: ${{ inputs.options }} + INPUT_RUN: ${{ inputs.run }} + INPUT_RUN_ARGS: ${{ inputs.run_args }} + INPUT_SHELL: ${{ inputs.shell }} + INPUT_REGISTRY: ${{ inputs.registry }} + INPUT_USERNAME: ${{ inputs.username }} + INPUT_PASSWORD: ${{ inputs.password }} + INPUT_DOCKER_NETWORK: ${{ inputs.docker_network }} + INPUT_PLATFORM: ${{ inputs.platform }} + run: "$GITHUB_ACTION_PATH/entrypoint.sh" diff --git a/docker/Dockerfile-manylinux b/docker/Dockerfile-manylinux new file mode 100644 index 0000000..df75fc7 --- /dev/null +++ b/docker/Dockerfile-manylinux @@ -0,0 +1,61 @@ +# Copyright (c) 2023-Present Lite XL Contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# https://github.com/lukewiwa/manylinux2014 +# this image supports multi-platform builds +FROM docker.io/lukewiwa/manylinux2014 + +# add the entrypoint into the image +COPY entrypoint.sh / + +# use CPython 3.11 +ARG PYTHON_VERSION=cp311-cp311 + +# get TARGETARCH from buildx +ARG TARGETARCH + +# use the manylinux built-in CPython +ENV PATH="/opt/python/$PYTHON_VERSION/bin:$PATH" + +# install epel on aarch64 because it is not included +RUN if [[ $TARGETARCH = 'arm64' ]]; then \ + yum -y update && \ + yum -y install "https://archives.fedoraproject.org/pub/archive/epel/7/$(rpm --eval '%{_arch}')/Packages/e/epel-release-7-12.noarch.rpm" && \ + yum -y clean all && \ + rm -fr /var/cache; \ + fi + +# install deps +RUN yum -y update && \ + yum -y install wget curl zip unzip ccache fuse fuse3 sudo \ + libX11-devel libXi-devel libXcursor-devel libxkbcommon-devel libXrandr-devel wayland-devel wayland-protocols-devel dbus-devel ibus-devel SDL2-devel \ + gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu binutils-aarch64-linux-gnu && \ + yum -y clean all && \ + rm -fr /var/cache + +# install meson and ninja +RUN pip install --no-cache-dir --no-compile meson ninja + +# pretend to have libdecor installed +RUN rpm -i --force --nodeps --ignorearch "https://pkgs.sysadmins.ws/el8/extras/x86_64/libdecor-devel-0.1.0-3.el8.x86_64.rpm" && \ + touch /usr/lib64/libdecor-0.so /usr/lib64/libdecor-0.so.0 && \ + yum -y history sync && \ + yum -y clean all && \ + rm -fr /var/cache \ No newline at end of file diff --git a/docker/Dockerfile-ubuntu b/docker/Dockerfile-ubuntu new file mode 100644 index 0000000..01673d6 --- /dev/null +++ b/docker/Dockerfile-ubuntu @@ -0,0 +1,53 @@ +# Copyright (c) 2023-Present Lite XL Contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM ubuntu:18.04 + +ARG TARGETARCH + +# copy entrypoint into image +COPY entrypoint.sh / + +# install deps +RUN apt-get update && apt-get -y upgrade && \ + apt-get install -y software-properties-common && \ + add-apt-repository -y ppa:git-core/ppa && \ + apt-get update && apt-get -y upgrade && \ + apt-get install -y sudo ccache curl wget python3.8 python3-pip build-essential \ + zip unzip git cmake wayland-protocols libsdl2-dev clang && \ + rm -rf /var/lib/apt/lists/* + +# install cross compiler +RUN if [ $TARGETARCH = 'amd64' ]; then \ + apt-get update && apt-get -y upgrade && \ + apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu && \ + rm -rf /var/lib/apt/lists/*; \ + fi + +# install meson and ninja +RUN python3.8 -m pip install --no-cache-dir --no-compile --upgrade pip && \ + python3.8 -m pip install --no-cache-dir --no-compile meson ninja + +# pretend to have libdecor +RUN wget "http://archive.ubuntu.com/ubuntu/pool/main/libd/libdecor-0/libdecor-0-dev_0.1.0-3build1_amd64.deb" && \ + dpkg --force-all -i "libdecor-0-dev_0.1.0-3build1_amd64.deb" && \ + rm -f "libdecor-0-dev_0.1.0-3build1_amd64.deb" && \ + perl -i~ -pe 's|\QDepends: libdecor-0-0 (= 0.1.0-3build1), libwayland-dev\E\n||g' /var/lib/dpkg/status && \ + touch /usr/lib/$(dpkg-architecture -q DEB_TARGET_MULTIARCH)/libdecor-0.so /usr/lib/$(dpkg-architecture -q DEB_TARGET_MULTIARCH)/libdecor-0.so.0 \ No newline at end of file diff --git a/entrypoint-ubuntu.sh b/docker/entrypoint.sh similarity index 83% rename from entrypoint-ubuntu.sh rename to docker/entrypoint.sh index 9970e1c..758d3da 100755 --- a/entrypoint-ubuntu.sh +++ b/docker/entrypoint.sh @@ -1,8 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash SCRIPT="$(mktemp)" printf '%s' "$*" >> "$SCRIPT" exec /bin/bash --login -e -o pipefail "$SCRIPT" - diff --git a/entrypoint-manylinux.sh b/entrypoint-manylinux.sh deleted file mode 100755 index 29ef5bb..0000000 --- a/entrypoint-manylinux.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SCRIPT="$(mktemp)" - -printf '%s' "$*" >> "$SCRIPT" - -source /opt/rh/rh-python38/enable - -exec /bin/bash --login -e -o pipefail "$SCRIPT" - diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..95bdd9c --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +set -eo pipefail +IFS=$'\n\t' + +# adapted from https://github.com/addnab/docker-run-action/blob/main/entrypoint.sh + +main() { + local COLOR_RED="\e[0;31m" + local COLOR_RESET="\e[0m" + + local script + IFS=" " read -r -a argv <<< "$INPUT_OPTIONS" + IFS=" " read -r -a run_args <<< "$INPUT_RUN_ARGS" + + # try to guard against both run and run_args being specified + if [[ -n "$INPUT_RUN" ]] && [[ -n "$INPUT_RUN_ARGS" ]]; then + echo -e "${COLOR_RED}error: run and run-args are mutually exclusive.${COLOR_RESET}" + fi + + # pull the image + if [[ -n "$INPUT_PLATFORM" ]]; then + docker pull -q --platform "$INPUT_PLATFORM" "$INPUT_IMAGE" + else + docker pull -q "$INPUT_IMAGE" + fi + + # set required parameters + argv+=(--rm --workdir /github/workspace --entrypoint "$INPUT_SHELL") + + # set network + if [[ -n "$INPUT_DOCKER_NETWORK" ]]; then + argv+=(--network "$INPUT_DOCKER_NETWORK") + fi + + # set the platform + if [[ -n "$INPUT_PLATFORM" ]]; then + argv+=(--platform "$INPUT_PLATFORM") + fi + + # load all environment variables + for prefix in GITHUB_ RUNNER_ ACTIONS_; do + while IFS= read -r env; do + argv+=(-e "$env") + done <<< "$(env | grep -o "^${prefix}[^=]*")" + done + + # load extra environment variables + argv+=(-e HOME -e CI=true -e GITHUB_ACTIONS=true) + + # add important volumes + # some directories here are taken from action steps that uses docker:// protocols + DOCKER_HOST="${DOCKER_HOST:-unix:///var/run/docker.sock}" + DOCKER_HOST="${DOCKER_HOST#unix://}" + argv+=( + -v "$DOCKER_HOST:$DOCKER_HOST" + -v "$RUNNER_TEMP/_github_home:/github/home" + -v "$RUNNER_TEMP/_github_workflow:/github/workflow" + -v "$RUNNER_TEMP/_runner_file_commands:/github/file_commands" + -v "$GITHUB_WORKSPACE:/github/workspace" + ) + + # add user defined volumes + while IFS= read -r line; do + if [[ -n "${line// }" ]]; then + argv+=('-v' "$line") + fi + done <<< "$INPUT_VOLUMES" + + # create the script file and mount it in the container + if [[ -n "$INPUT_RUN" ]]; then + script="$(mktemp -t script.sh.XXXXXX)" + printf '%s' "$INPUT_RUN" > "$script" + run_args=('--login' '-e' '-o' 'pipefail' '/script.sh') + argv+=('-v' "$script:/script.sh:ro") + fi + + exec docker run "${argv[@]}" "$INPUT_IMAGE" "${run_args[@]}" +} + +main "$@" \ No newline at end of file diff --git a/libdecor-0-0_0.1.0-3build1_amd64.deb b/libdecor-0-0_0.1.0-3build1_amd64.deb deleted file mode 100644 index ba03ecc..0000000 Binary files a/libdecor-0-0_0.1.0-3build1_amd64.deb and /dev/null differ diff --git a/libdecor-0-dev_0.1.0-3build1_amd64.deb b/libdecor-0-dev_0.1.0-3build1_amd64.deb deleted file mode 100644 index 8ee27a2..0000000 Binary files a/libdecor-0-dev_0.1.0-3build1_amd64.deb and /dev/null differ diff --git a/libdecor-0.1.0-3.el8.x86_64.rpm b/libdecor-0.1.0-3.el8.x86_64.rpm deleted file mode 100644 index b83e675..0000000 Binary files a/libdecor-0.1.0-3.el8.x86_64.rpm and /dev/null differ diff --git a/libdecor-devel-0.1.0-3.el8.x86_64.rpm b/libdecor-devel-0.1.0-3.el8.x86_64.rpm deleted file mode 100644 index 50c3663..0000000 Binary files a/libdecor-devel-0.1.0-3.el8.x86_64.rpm and /dev/null differ