Skip to content

Commit

Permalink
chore: in-progress changes
Browse files Browse the repository at this point in the history
- remove support for multiple PHP versions
- remove support for Caddy image (see:
  shopware/docker#107)
- finish CI pipeline with image builds and pushes
  to start writing Helm Chart
  • Loading branch information
vindelicus committed Dec 4, 2024
1 parent 09e483e commit 86a1a79
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 70 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Create .env
run: |
make dotenv
- name: Create Shopware execution environment
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./docker/compose-ci.yml"
compose-flags: "--env-file ./env.test"
compose-file: "./compose-ci.yml"

- name: Docker metadata
id: meta
Expand Down
39 changes: 8 additions & 31 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,8 @@ concurrency:
group: "${{ github.workflow }}@${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"

jobs:
version:
name: Determine package version
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.output-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Output version
id: output-version
run: |
VERSION=$(make version)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
test:
runs-on: ubuntu-latest
needs: [ 'version' ]
permissions:
contents: write
strategy:
Expand Down Expand Up @@ -68,39 +50,34 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Get Composer Cache Directory
id: composer-cache
id: cache-dir
run: |
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache Composer
id: composer
id: cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ steps.cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Set composer vars
run: |
{
echo "COMPOSER_DISABLE_NETWORK=${{ steps.composer.outputs.cache-hit && '1' || '0' }}"
echo "COMPOSER_DISABLE_NETWORK=${{ steps.cache.outputs.cache-hit && '1' || '0' }}"
echo "COMPOSER_NO_AUDIT=1"
echo "COMPOSER_FUND=0"
echo "COMPOSER_ROOT_VERSION=${{ needs.version.outputs.version }}"
echo "COMPOSER_ROOT_VERSION=1.0.0"
} >> "$GITHUB_ENV"
- name: Install dependencies
run: |
make init CI=y
- name: Create Shopware execution environment
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./docker/compose-ci.yml"
compose-flags: "--env-file ./env.test"
composer install --ignore-platform-reqs --prefer-dist
- name: Run tests
run: |
make tests
composer run tests
dispatch:
runs-on: ubuntu-latest
Expand Down
83 changes: 47 additions & 36 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ variable "REPOSITORY" {
default = "fmjstudios/shopware"
}

variable "DEFAULT_PHP" {
default = "8.3"
}

# build for multiple PHP versions - can be a comma-separated list of values like 7.4,8.1,8.2 etc.
variable "PHP_VERSIONS" {
default = "8.2,8.3"
default = "8.2,${DEFAULT_PHP}"
}

# ==== Custom Functions ====
Expand Down Expand Up @@ -71,14 +75,6 @@ function "get_tags" {
result = VERSION == null ? flatten(split(",", TAGS)) : concat(flatten(split(",", TAGS)), [VERSION])
}

function "build_tags" {
params = []
result = flatten(concat(
[for tag in get_tags() : "${REPOSITORY}:${tag}"],
[for registry in get_registry() : [for tag in get_tags() : "${registry}/${REPOSITORY}:${tag}"]]
))
}

# determine in which we're going to append for the image
function "get_registry" {
params = []
Expand All @@ -91,18 +87,30 @@ function "tags" {
php,
suffix
]
result = flatten([
for registry in get_registry() :
result = flatten(concat(
[
for tag in get_tags() : [
suffix == "-fcgi" ? php == "${DEFAULT_PHP}" ?
"${REPOSITORY}:${tag}" :
"${REPOSITORY}:${tag}-php${php}" :
"${REPOSITORY}:${tag}-php${php}${suffix}"
]
],
[
for tag in get_tags() :
concat(
tag == "latest" ? suffix == "-fcgi" ? ["${registry}/${REPOSITORY}:${tag}"] : [] : [],
["${registry}/${REPOSITORY}:${tag}-${php}${suffix}"]
)
for registry in get_registry() :
[
for tag in get_tags() : [
suffix == "-fcgi" ? php == "${DEFAULT_PHP}" ?
"${registry}/${REPOSITORY}:${tag}" :
"${registry}/${REPOSITORY}:${tag}-php${php}" :
"${registry}/${REPOSITORY}:${tag}-php${php}${suffix}"
]
]
]
])
))
}


# ==== Bake Groups ====
group "default" {
targets = ["shopware"]
Expand All @@ -125,13 +133,14 @@ target "shopware" {
}
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7",
"linux/arm/v6",
#"linux/riscv64",
"linux/s390x",
"linux/386",
# "linux/ppc64le" gRPC doesn't build on ppc64le
# "linux/arm64",
# uncomment if required
# "linux/arm/v7",
# "linux/arm/v6",
# "linux/riscv64",
# "linux/s390x",
# "linux/386",
# "linux/ppc64le"
]
tags = tags(
php,
Expand All @@ -146,7 +155,7 @@ target "shopware-nginx" {
name = "shopware-nginx-php${replace(php, ".", "-")}"
dockerfile = "docker/nginx.Dockerfile"
contexts = {
base = "docker-image://fmjstudios/shopware:v${VERSION}"
base = "docker-image://fmjstudios/shopware:latest"
}
matrix = {
php = get_php_version()
Expand All @@ -157,11 +166,12 @@ target "shopware-nginx" {
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7",
"linux/arm/v6",
"linux/riscv64",
"linux/s390x",
"linux/386",
# uncomment if required
# "linux/arm/v7",
# "linux/arm/v6",
# "linux/riscv64",
# "linux/s390x",
# "linux/386",
# "linux/ppc64le"
]
tags = tags(
Expand All @@ -177,7 +187,7 @@ target "shopware-caddy" {
name = "shopware-caddy-php${replace(php, ".", "-")}"
dockerfile = "docker/caddy.Dockerfile"
contexts = {
base = "docker-image://fmjstudios/shopware:v${VERSION}"
base = "docker-image://fmjstudios/shopware:latest"
}
matrix = {
php = get_php_version()
Expand All @@ -188,11 +198,12 @@ target "shopware-caddy" {
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7",
"linux/arm/v6",
"linux/riscv64",
"linux/s390x",
"linux/386",
# uncomment if required
# "linux/arm/v7",
# "linux/arm/v6",
# "linux/riscv64",
# "linux/s390x",
# "linux/386",
# "linux/ppc64le"
]
tags = tags(
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env.test');
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}

0 comments on commit 86a1a79

Please sign in to comment.