Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump docker/setup-buildx-action from 1 to 2 #9

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
21 changes: 2 additions & 19 deletions .github/actions/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
#
# Functions:
# - Evaluate all packages to build depending on files defined in ${GH_FILES}.
# - ffmpeg is moved to head of packages to built first if triggered by its own or a dependent.
# - Referenced native and cross packages of the packages to build are added to the download list.

set -o pipefail

echo "::group:: ---- find dependent packages"

# filter for changes made in the spk directories and take unique package name (without spk folder)
SPK_TO_BUILD+=" "
SPK_TO_BUILD+=$(echo "${GH_FILES}" | tr ' ' '\n' | grep -oP "(spk)/\K[^\/]*" | sort -u | tr '\n' ' ')
GH_FILES=$(find -type f -printf '%P\n')
SPK_TO_BUILD=$(echo "${GH_FILES}" | tr ' ' '\n' | grep -oP "(spk)/\K[^\/]*" | sort -u | tr '\n' ' ')

# filter for changes made in the cross and native directories and take unique package name (including cross or native folder)
DEPENDENT_PACKAGES=$(echo "${GH_FILES}" | tr ' ' '\n' | grep -oP "(cross|native)/[^\/]*" | sort -u | tr '\n' ' ')
Expand Down Expand Up @@ -49,22 +48,6 @@ fi
# remove duplicate packages
packages=$(printf %s "${SPK_TO_BUILD}" | tr ' ' '\n' | sort -u | tr '\n' ' ')


# find all packages that depend on spk/ffmpeg is built before.
all_ffmpeg_packages=$(find spk/ -maxdepth 2 -mindepth 2 -name "Makefile" -exec grep -Ho "export FFMPEG_DIR" {} \; | grep -Po ".*spk/\K[^/]*" | sort | tr '\n' ' ')

# if ffmpeg or one of its dependents is to build, ensure
# ffmpeg is first package in the list of packages to build.
for package in ${packages}
do
if [ "$(echo ffmpeg ${all_ffmpeg_packages} | grep -ow ${package})" != "" ]; then
packages_without_ffmpeg=$(echo "${packages}" | tr ' ' '\n' | grep -v "ffmpeg" | tr '\n' ' ')
packages="ffmpeg ${packages_without_ffmpeg}"
break;
fi
done


# find all noarch packages
all_noarch=$(find spk/ -maxdepth 2 -mindepth 2 -name "Makefile" -exec grep -Ho "override ARCH" {} \; | grep -Po ".*spk/\K[^/]*" | sort | tr '\n' ' ')

Expand Down
64 changes: 36 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: Build
on:
workflow_dispatch:
inputs:
package:
description: 'Package to build'
required: true
default: 'syno-magnet'
publish:
description: 'Publish to repository'
required: false
Expand All @@ -18,8 +14,9 @@ on:
- 'native/**'
push:
branches:
- "**"
- master
paths:
- '.github/workflows/*'
- 'spk/**'
- 'cross/**'
- 'native/**'
Expand All @@ -39,26 +36,9 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Get changed files for pull request
if: github.event_name == 'pull_request'
id: getfile_pr
run: |
git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs
echo "::set-output name=files::$(git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs)"

- name: Get changed files for push
if: github.event_name == 'push'
id: getfile
run: |
git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs
echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)"

- name: Evaluate dependencies
id: dependencies
run: ./.github/actions/prepare.sh
env:
GH_FILES: ${{ steps.getfile.outputs.files }} ${{ steps.getfile_pr.outputs.files }}
SPK_TO_BUILD: ${{ github.event.inputs.package }}

- name: Cache downloaded files
uses: actions/cache@v3
Expand Down Expand Up @@ -99,30 +79,42 @@ jobs:
path: distrib
key: distrib-${{ github.run_id }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Build Package (based on changed files)
# We don't want to stop the build on errors.
# Errors are reported in "Build Status"
continue-on-error: true
uses: docker://ghcr.io/synocommunity/spksrc:latest
with:
entrypoint: ./.github/actions/build.sh
env:
ARCH_PACKAGES: ${{ needs.prepare.outputs.arch_packages }}
NOARCH_PACKAGES: ${{ needs.prepare.outputs.noarch_packages }}
PUBLISH: ${{ github.event.inputs.publish }}
API_KEY: ${{ secrets.PUBLISH_API_KEY }}
# https://github.com/SynoCommunity/spksrc/wiki/Compile-and-build-rules
GH_ARCH: ${{ matrix.arch }}
BUILD_ERROR_FILE: /github/workspace/build_errors.txt
BUILD_ERROR_LOGFILE: /github/workspace/build_log_errors.txt
BUILD_UNSUPPORTED_FILE: /github/workspace/build_unsupported.txt
BUILD_SUCCESS_FILE: /github/workspace/build_success.txt
run: |
/usr/bin/docker run --rm --privileged --workdir /github/workspace \
-e ARCH_PACKAGES \
-e NOARCH_PACKAGES \
-e PUBLISH \
-e API_KEY \
-e GH_ARCH \
-e BUILD_ERROR_FILE \
-e BUILD_ERROR_LOGFILE \
-e BUILD_UNSUPPORTED_FILE \
-e BUILD_SUCCESS_FILE \
-e INPUT_ENTRYPOINT -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true --entrypoint "./.github/actions/build.sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/spksrc/spksrc":"/github/workspace" ghcr.io/servarr/spksrc:latest


- name: Build Status
id: build_status
# We need this status since we don't want to stop the build on errors.
# Here we fail on build errors found in the build error file.
uses: docker://ghcr.io/synocommunity/spksrc:latest
uses: docker://ghcr.io/servarr/spksrc:latest
with:
entrypoint: ./.github/actions/build_status.sh
env:
Expand All @@ -135,6 +127,22 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: Packages for ${{ matrix.arch }}
name: ${{ matrix.arch }}
path: packages/*.spk
if-no-files-found: ignore
publish:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v3

- name: Publish release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create -d -p v$GITHUB_RUN_NUMBER --generate-notes --title "Servarr Synology Packages v$GITHUB_RUN_NUMBER" --target $GITHUB_SHA **/*.spk
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
if: github.repository_owner == 'SynoCommunity'
if: github.repository_owner == 'Servarr'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
Expand All @@ -40,4 +40,4 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
with:
push: true
tags: ghcr.io/synocommunity/spksrc:latest
tags: ghcr.io/servarr/spksrc:latest
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
paths-ignore:
- "**.md"
push:
branches:
- master
paths-ignore:
- "**.md"

Expand Down
22 changes: 2 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
check \
cmake \
curl \
cython \
debootstrap \
debootstrap \
debuerreotype \
ed \
expect \
fakeroot \
Expand Down Expand Up @@ -51,18 +51,12 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
mercurial \
moreutils \
ncurses-dev \
ninja-build \
php \
pkg-config \
python3 \
python3-distutils \
rename \
rsync \
scons \
subversion \
sudo \
swig \
texinfo \
unzip \
xmlto \
zlib1g-dev && \
Expand All @@ -72,18 +66,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
adduser user sudo && \
echo "%users ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/users

# Install setuptools, wheel and pip for Python2
RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | python2
# Install virtualenv and httpie for Python2
# Use pip2 as default pip -> python3
RUN pip2 install virtualenv httpie

# Install setuptools, wheel and pip for Python3
# Default pip -> python3 aware for native python wheels builds
RUN wget https://bootstrap.pypa.io/get-pip.py -O - | python3
# Install meson cross-platform build system
RUN pip3 install meson==0.56.0

# Volume pointing to spksrc sources
VOLUME /spksrc

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ dsm-%: local.mk
@grep -q "^DEFAULT_TC.*=.*$*.*" local.mk || sed -i "/^DEFAULT_TC =/s/$$/ $*/" local.mk

setup-synocommunity: setup
@sed -i -e "s|PUBLISH_URL\s*=.*|PUBLISH_URL = https://api.synocommunity.com|" \
-e "s|DISTRIBUTOR\s*=.*|DISTRIBUTOR = SynoCommunity|" \
-e "s|DISTRIBUTOR_URL\s*=.*|DISTRIBUTOR_URL = https://synocommunity.com|" \
-e "s|REPORT_URL\s*=.*|REPORT_URL = https://github.com/SynoCommunity/spksrc/issues|" \
@sed -i -e "s|PUBLISH_URL\s*=.*|PUBLISH_URL = https://syno.servarr.com|" \
-e "s|DISTRIBUTOR\s*=.*|DISTRIBUTOR = Servarr|" \
-e "s|DISTRIBUTOR_URL\s*=.*|DISTRIBUTOR_URL = https://github.com/Servarr/spksrc|" \
-e "s|REPORT_URL\s*=.*|REPORT_URL = https://github.com/Servarr/spksrc/issues|" \
local.mk
23 changes: 23 additions & 0 deletions cross/bubblewrap/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PKG_NAME = bubblewrap
PKG_VERS = 0.6.1
PKG_EXT = tar.xz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/containers/bubblewrap/releases/download/v$(PKG_VERS)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/libcap

HOMEPAGE = https://github.com/containers/bubblewrap
LICENSE = LGPLv2

GNU_CONFIGURE = 1

PRE_CONFIGURE_TARGET = bubblewrap_pre_configure

PATCHES_LEVEL = 1

include ../../mk/spksrc.cross-cc.mk

.PHONY: bubblewrap_pre_configure
bubblewrap_pre_configure:
@$(RUN) ./autogen.sh $(REAL_CONFIGURE_ARGS)
1 change: 1 addition & 0 deletions cross/bubblewrap/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin:bin/bwrap
3 changes: 3 additions & 0 deletions cross/bubblewrap/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bubblewrap-0.6.1.tar.xz SHA1 97058281dcce2fcc749ea406abb0f99d9dacfaec
bubblewrap-0.6.1.tar.xz SHA256 9609c7dc162bc68abc29abfab566934fdca37520a15ed01b675adcf3a4303282
bubblewrap-0.6.1.tar.xz MD5 a481e7981e9c00e6b3eeaa05e9c2dc07
Loading