Unverified Commit b0cbb44d authored by Diego Hernandes's avatar Diego Hernandes Committed by GitHub
Browse files

Merge pull request #126 from codecasts/master

Fix tmpfs preventing builds on Alpine v3.10
parents 94626edf 51a55652
name: "build-alpine-v3.10"
# workflow env.
env:
ALPINE_ARCH: x86_64
APK_MAINTAINER: ${{ secrets.APK_MAINTAINER }}
APK_PACKAGER: ${{ secrets.APK_PACKAGER }}
BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
APORTS_SCRIPTS: /home/sandbox/scripts
on:
push:
branches:
- master
- publish
jobs:
build:
runs-on: ubuntu-latest
env:
ALPINE_VERSION: ${{ matrix.alpine }}
PHP_VERSION: ${{ matrix.php }}
PHP_MINOR_VERSION: ${{ matrix.release }}
ALPINE_VERSION_SLUG: v${{ matrix.alpine }}
PHP_VERSION_SLUG: php-${{ matrix.php }}
PA_ARCH: ${{ matrix.arch }}
PA_BUILD_SLUG: v${{ matrix.alpine }}_php-${{ matrix.php }}_${{ matrix.arch }}
PA_BUILD_PATH: repo/v${{ matrix.alpine }}/php-${{ matrix.php }}/${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include:
# Alpine v3.12
# PHP 7.4
- alpine: "3.10"
php: "7.4"
release: "7.4.14"
arch: "x86_64"
# PHP 7.3
- alpine: "3.10"
php: "7.3"
release: "7.3.26"
arch: "x86_64"
steps:
# checkout repository.
- name: git-checkout
uses: actions/checkout@v2
# cache packages.
- name: cache
uses: actions/cache@v2
with:
path: ${{ env.PA_BUILD_PATH }}
key: ${{ env.PA_BUILD_SLUG }}
# debug info.
- name: debug-info
run: |
echo -e "Job strategy: "
echo -e "Alpine Linux: v${{ env.ALPINE_VERSION }}"
echo -e "PHP Version: ${{ env.PHP_VERSION }}"
echo -e "PHP Release: ${{ env.PHP_MINOR_VERSION }}"
# build packages.
- name: build
run: |
echo "" > .env
echo -e "${{ secrets.PHP_ALPINE_RSA }}" > .abuild/php-alpine.rsa
echo -e "${{ secrets.PHP_ALPINE_RSA_PUB }}" > .abuild/php-alpine.rsa.pub
docker-compose run sandbox buildrepo -a /home/sandbox/scripts -p ${{ env.PHP_VERSION_SLUG }}
# upload artifacts.
- name: upload
uses: actions/upload-artifact@v2
with:
name: ${{ env.PA_BUILD_SLUG }}
path: ${{ env.PA_BUILD_PATH }}
# publish to bintray.
- name: bintray
if: github.ref == 'refs/heads/publish'
run: |
echo -e "Publishing to Bintray"
./publish-zip.sh
name: "build"
name: "build-alpine-v3.11"
# workflow env.
env:
......@@ -16,7 +16,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
ALPINE_VERSION: ${{ matrix.alpine }}
......@@ -29,21 +29,9 @@ jobs:
PA_BUILD_PATH: repo/v${{ matrix.alpine }}/php-${{ matrix.php }}/${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include:
# Alpine v3.12
# PHP 8.0
- alpine: "3.12"
php: "8.0"
release: "8.0.1"
arch: "x86_64"
# PHP 7.4
- alpine: "3.12"
php: "7.4"
release: "7.4.14"
arch: "x86_64"
# Alpine v3.11
# PHP 8.0
- alpine: "3.11"
......@@ -63,19 +51,6 @@ jobs:
release: "7.3.26"
arch: "x86_64"
# Alpine v3.12
# PHP 7.4
- alpine: "3.10"
php: "7.4"
release: "7.4.14"
arch: "x86_64"
# PHP 7.3
- alpine: "3.10"
php: "7.3"
release: "7.3.26"
arch: "x86_64"
steps:
# checkout repository.
- name: git-checkout
......@@ -102,8 +77,7 @@ jobs:
echo "" > .env
echo -e "${{ secrets.PHP_ALPINE_RSA }}" > .abuild/php-alpine.rsa
echo -e "${{ secrets.PHP_ALPINE_RSA_PUB }}" > .abuild/php-alpine.rsa.pub
docker-compose run sandbox pa-fix-permissions.sh
docker-compose run sandbox buildrepo -a /home/sandbox/scripts -p -k ${{ env.PHP_VERSION_SLUG }}
docker-compose run sandbox buildrepo -a /home/sandbox/scripts -p ${{ env.PHP_VERSION_SLUG }}
# upload artifacts.
- name: upload
......
name: "build-alpine-v3.12"
# workflow env.
env:
ALPINE_ARCH: x86_64
APK_MAINTAINER: ${{ secrets.APK_MAINTAINER }}
APK_PACKAGER: ${{ secrets.APK_PACKAGER }}
BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
APORTS_SCRIPTS: /home/sandbox/scripts
on:
push:
branches:
- master
- publish
jobs:
build:
runs-on: ubuntu-20.04
env:
ALPINE_VERSION: ${{ matrix.alpine }}
PHP_VERSION: ${{ matrix.php }}
PHP_MINOR_VERSION: ${{ matrix.release }}
ALPINE_VERSION_SLUG: v${{ matrix.alpine }}
PHP_VERSION_SLUG: php-${{ matrix.php }}
PA_ARCH: ${{ matrix.arch }}
PA_BUILD_SLUG: v${{ matrix.alpine }}_php-${{ matrix.php }}_${{ matrix.arch }}
PA_BUILD_PATH: repo/v${{ matrix.alpine }}/php-${{ matrix.php }}/${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include:
# Alpine v3.12
# PHP 8.0
- alpine: "3.12"
php: "8.0"
release: "8.0.1"
arch: "x86_64"
# PHP 7.4
- alpine: "3.12"
php: "7.4"
release: "7.4.14"
arch: "x86_64"
steps:
# checkout repository.
- name: git-checkout
uses: actions/checkout@v2
# cache packages.
- name: cache
uses: actions/cache@v2
with:
path: ${{ env.PA_BUILD_PATH }}
key: ${{ env.PA_BUILD_SLUG }}
# debug info.
- name: debug-info
run: |
echo -e "Job strategy: "
echo -e "Alpine Linux: v${{ env.ALPINE_VERSION }}"
echo -e "PHP Version: ${{ env.PHP_VERSION }}"
echo -e "PHP Release: ${{ env.PHP_MINOR_VERSION }}"
# build packages.
- name: build
run: |
echo "" > .env
echo -e "${{ secrets.PHP_ALPINE_RSA }}" > .abuild/php-alpine.rsa
echo -e "${{ secrets.PHP_ALPINE_RSA_PUB }}" > .abuild/php-alpine.rsa.pub
docker-compose run sandbox buildrepo -a /home/sandbox/scripts -p ${{ env.PHP_VERSION_SLUG }}
# upload artifacts.
- name: upload
uses: actions/upload-artifact@v2
with:
name: ${{ env.PA_BUILD_SLUG }}
path: ${{ env.PA_BUILD_PATH }}
# publish to bintray.
- name: bintray
if: github.ref == 'refs/heads/publish'
run: |
echo -e "Publishing to Bintray"
./publish-zip.sh
#!/usr/bin/env bash
# stop on errors.
set -e
# define starting directory.
PA_SOURCES_PATH="${APORTS:-/home/sandbox/scripts}"
# source helpers.
# shellcheck disable=SC1090
source "${BASH_SOURCE%/*}/helpers/colors.sh"
# ensure starts on sources path.
# shellcheck disable=SC2164
cd "${PA_SOURCES_PATH}"
# find all package directories
PACKAGE_DIRS=$(find . -name "APKBUILD" | xargs -I % readlink -f % | xargs -I % dirname %)
# loop packages and build each one.
for PACKAGE_DIR in $PACKAGE_DIRS; do
cd "${PACKAGE_DIR}" && abuild checksum
done
# echo -e "${PACKAGE_DIRS}"
......@@ -16,8 +16,6 @@ services:
image: "codecasts/php-alpine:sandbox-v${ALPINE_VERSION}"
# enable tty.
tty: true
tmpfs:
'/tmp:exec,mode=1755'
# build config.
build:
context: "sandbox"
......
......@@ -55,10 +55,9 @@ RUN adduser -D -u 1000 sandbox && \
ln -s /var/cache/apk /etc/apk/cache && \
echo "sandbox ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers && \
echo "Set disable_coredump false" >> /etc/sudo.conf && \
sed -i "/export JOBS=.*/c\export JOBS=$(cat /proc/cpuinfo | grep '^processor\s*:\s[0-9]*$' | wc -l)" /etc/abuild.conf && \
sed -i "/#USE_CCACHE=.*/c\USE_CCACHE=1" /etc/abuild.conf && \
sed -i "/#PACKAGER=.*/c\PACKAGER=\"${APK_PACKAGER}\"" /etc/abuild.conf && \
sed -i "/#MAINTAINER=.*/c\MAINTAINER=\"${APK_MAINTAINER}\"" /etc/abuild.conf && \
echo 'export PATH="/opt/php-alpine/bin:$PATH"' > /etc/profile.d/php-bin.sh && \
chown -R sandbox:sandbox /home/sandbox && \
chown -R sandbox:sandbox /opt/php-alpine
......@@ -81,4 +80,4 @@ ENTRYPOINT ["/opt/php-alpine/entrypoint.sh"]
WORKDIR "/home/sandbox/scripts"
# use bash as default command.
CMD ["/usr/bin/env", "ash"]
CMD ["/bin/sh"]
#!/usr/bin/env ash
#!/bin/sh
# set php-alpine bin directory on path.
export PATH=/opt/php-alpine/bin:$PATH
# source /etc/profile
. /etc/profile
# trust the locally mounted public key and fix permissions.
sudo cp /home/sandbox/.abuild/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
......@@ -11,9 +11,9 @@ sudo chmod u=rw,go=r /etc/apk/keys/php-alpine.rsa.pub
sudo chown -R sandbox:sandbox /home/sandbox
# determine cpu count.
ABUILD_JOBS=$(grep -c '^processor\s*:\s[0-9]*$' < /proc/cpuinfo)
# ABUILD_JOBS=$(grep -c '^processor\s*:\s[0-9]*$' < /proc/cpuinfo)
# configure JOBS variable as cpu count on abuild.conf file.
sudo sed -i "/export JOBS=.*/c\export JOBS=$ABUILD_JOBS" /etc/abuild.conf
# sudo sed -i "/export JOBS=.*/c\export JOBS=$ABUILD_JOBS" /etc/abuild.conf
# source env files generated during docker build.
if [ -f ~/.build_env ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment