Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pweyck committed Apr 11, 2024
1 parent d458a41 commit ec2e19a
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 8 deletions.
120 changes: 120 additions & 0 deletions .github/actions/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Build and push OCI images
description: Build and push OCI images with kaniko. Almost drop in replacement for docker/build-push-action
author: shopware
branding:
icon: "anchor"
color: "blue"

inputs:
build-args:
description: "List of build-time variables"
required: false
context:
description: "Build's context is the set of files located in the specified PATH or URL"
required: false
file:
description: "Path to the Dockerfile"
required: false
labels:
description: "List of metadata for an image"
required: false
no-cache:
description: "Do not use cache when building the image"
required: false
default: "false"
platforms:
description: "List of target platforms for build"
required: false
provenance:
description: "Generate provenance attestation for the build (shorthand for --attest=type=provenance)"
required: false
pull:
description: "Always attempt to pull all referenced images"
required: false
default: "false"
push:
description: "Push is a shorthand for --output=type=registry"
required: false
default: "false"
secrets:
description: "List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)"
required: false
secret-envs:
description: "List of secret env vars to expose to the build (e.g., key=envname, MY_SECRET=MY_ENV_VAR)"
required: false
secret-files:
description: "List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)"
required: false
tags:
description: "List of tags"
required: false
target:
description: "Sets the target stage to build"
required: false
github-token:
description: "GitHub Token used to authenticate against a repository for Git context"
default: ${{ github.token }}
required: false

# not supported (yet)

annotations:
description: "List of annotation to set to the image"
required: false
attests:
description: "List of attestation parameters (e.g., type=sbom,generator=image)"
required: false
add-hosts:
description: "List of a customs host-to-IP mapping (e.g., docker:10.180.0.1)"
required: false
allow:
description: "List of extra privileged entitlement (e.g., network.host,security.insecure)"
required: false
build-contexts:
description: "List of additional build contexts (e.g., name=path)"
required: false
builder:
description: "Builder instance"
required: false
cache-from:
description: "List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir)"
required: false
cache-to:
description: "List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
required: false
cgroup-parent:
description: "Optional parent cgroup for the container used in the build"
required: false
network:
description: "Set the networking mode for the RUN instructions during build"
required: false
no-cache-filters:
description: "Do not cache specified stages"
required: false
load:
description: "Load is a shorthand for --output=type=docker"
required: false
default: "false"
outputs:
description: "List of output destinations (format: type=local,dest=path)"
required: false
sbom:
description: "Generate SBOM attestation for the build (shorthand for --attest=type=sbom)"
required: false
shm-size:
description: "Size of /dev/shm (e.g., 2g)"
required: false
ssh:
description: "List of SSH agent socket or keys to expose to the build"
required: false
ulimit:
description: "Ulimit options (e.g., nofile=1024:1024)"
required: false

outputs:
imageid:
description: "Image ID"
digest:
description: "Image digest"
metadata:
description: "Build result metadata"
16 changes: 16 additions & 0 deletions .github/split.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

source "$(dirname ${BASH_SOURCE[0]})/../.gitlab/bin/split.sh"

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -o errexit
set -o pipefail

if [ -n "${DEBUG:-}" ]; then
set -x
fi

PLATFORM_DIR="${CI_PROJECT_DIR:-$(pwd)}"

"$@"
fi
2 changes: 2 additions & 0 deletions .github/workflows/02-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches: [ trunk ]
pull_request:
workflow_dispatch:

permissions:
packages: write
Expand Down Expand Up @@ -31,6 +32,7 @@ jobs:
with:
php-version: 8.2
coverage: none
extensions: gd, xml, dom, curl, pdo, mysqli, mbstring, pdo_mysql, bcmath
- uses: actions/setup-node@v4
with:
node-version: 20
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/05-prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Prepare release

on:
workflow_dispatch:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
# if: github.repository == 'shopware/shopware'
# container:
# image: ghcr.io/catthehacker/ubuntu:act-22.04
env:
SHOPWARE_ADMIN_SKIP_SOURCEMAP_GENERATION: "1"
DATABASE_URL: mysql://root:[email protected]:3306/root
services:
database:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
options: '--mount="type=tmpfs,destination=/var/lib/mysql" --health-cmd="mysqladmin ping -h 127.0.0.1" --health-interval=5s --health-timeout=2s --health-retries=3'
ports:
- "3306:3306"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
fetch-tags: 'true'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
extensions: gd, xml, dom, curl, pdo, mysqli, mbstring, pdo_mysql, bcmath
- uses: actions/setup-node@v4
with:
node-version: 20
- name: build shopware
run: |
composer setup
- uses: actions/upload-artifact@v4
with:
name: context
path: |
.
!public
!**/node_modules
!vendor
!vendor-bin
split:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
package: [ Administration, Storefront, Core, Elasticsearch ]
steps:
- uses: actions/download-artifact@v4
with:
name: context
- name: debug platform
run: |
git log -n 10
- name: split
run: |
bash .github/split.bash split_repo "${{ matrix.package }}"
- name: debug 1
run: |
P=${{ matrix.package }}
git -C repos/${P@L} log -n 10
- name: Incldue assets
run: |
bash .gitlab/bin/split.sh include_assets "${{ matrix.package }}"
# split into packages
# build js apps
# push split packages

38 changes: 30 additions & 8 deletions .gitlab/bin/split.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#!/usr/bin/env sh
set -eu

if [ -n "${DEBUG:-}" ]; then
set -x
fi

PLATFORM_DIR="${CI_PROJECT_DIR:-$(pwd)}"

# Transforms input into lowercase-only.
#
Expand Down Expand Up @@ -183,4 +176,33 @@ push() {
fi
}

"$@"
include_assets() {
local package="$1"

if [[ ${package@L} == "administration" || ${package@L} == "storefront" ]]; then
copy_assets $package
fi

check_assets

if [[ ${package@L} == "administration" ]]; then
include_admin_assets
fi

if [[ ${package@L} == "storefront" ]]; then
include_storefront_assets
fi
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -o errexit
set -o pipefail

if [ -n "${DEBUG:-}" ]; then
set -x
fi

PLATFORM_DIR="${CI_PROJECT_DIR:-$(pwd)}"

"$@"
fi

0 comments on commit ec2e19a

Please sign in to comment.