Skip to content

Commit

Permalink
Merge pull request #54 from cybex-gmbh/main
Browse files Browse the repository at this point in the history
Release v0.4.0
  • Loading branch information
mszulik authored Jun 12, 2024
2 parents c14441f + 1f45e86 commit 3f3cf6c
Show file tree
Hide file tree
Showing 123 changed files with 15,128 additions and 14,215 deletions.
78 changes: 78 additions & 0 deletions .env.amigor
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
APP_NAME="Transmorpher Amigor"
APP_ENV=production
APP_KEY=base64:rE8A8OivXEW/wCiRS5D0SMTr3LO/NA2KSZPSsBzPZ2I=
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=https://transmorpher.test

# Docker
APP_SERVICE=app
DOCKER_CONTAINER_NAME=transmorpher-amigor
#DOCKER_PHP_VERSION=8.3
# Use different DB ports if you need to expose more than one DB container
#FORWARD_DB_PORT=3306

# Transmorpher
TRANSMORPHER_AUTH_TOKEN=setThisViaTransmorpherPullPreviewWorkflow
TRANSMORPHER_S2S_API_BASE_URL=http://transmorpher/api
TRANSMORPHER_WEB_API_BASE_URL=setThisInTransmorpherPullPreviewDockerCompose
TRANSMORPHER_WEB_DELIVERY_BASE_URL=setThisInTransmorpherPullPreviewDockerCompose
TRANSMORPHER_WEB_PLACEHOLDER_URL=https://placehold.co/400

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=amigor-mysql-1
DB_PORT=3306
DB_DATABASE=amigor
DB_USERNAME=amigor
DB_PASSWORD=password

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ APP_URL=http://transmorpher.test
# Docker
APP_SERVICE=app
DOCKER_CONTAINER_NAME=transmorpher
#DOCKER_PHP_VERSION=8.1
#DOCKER_PHP_VERSION=8.2
# Use different DB ports if you need to expose more than one DB container
#FORWARD_DB_PORT=3306

Expand All @@ -21,6 +21,7 @@ TRANSMORPHER_SIGNING_KEYPAIR=
TRANSMORPHER_OPTIMIZER_TIMEOUT=10
# More information: https://github.com/cybex-gmbh/transmorpher/tree/release/v0#configuration-options
VIDEO_TRANSCODING_WORKERS_AMOUNT=1
#CACHE_INVALIDATION_COUNTER_FILE_PATH="cacheInvalidationCounter"

# AWS
AWS_ACCESS_KEY_ID=
Expand Down Expand Up @@ -53,6 +54,7 @@ BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
DB_QUEUE_CONNECTION=mysql
SESSION_DRIVER=file
SESSION_LIFETIME=120

Expand Down
2 changes: 1 addition & 1 deletion .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ APP_URL=http://transmorpher.test
# Docker
APP_SERVICE=app
DOCKER_CONTAINER_NAME=transmorpher
#DOCKER_PHP_VERSION=8.1
#DOCKER_PHP_VERSION=8.2
# Use different DB ports if you need to expose more than one DB container
#FORWARD_DB_PORT=3306

Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* text=auto
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
Expand Down
40 changes: 7 additions & 33 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,13 @@ name: Docker Image CI

on:
release:
types: [published]
types: [ published ]

jobs:
build-push-docker-image:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Checkout code
uses: actions/checkout@v4

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
cybexwebdev/transmorpher
flavor: |
latest=auto
tags: |
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
type=sha
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
file: ./docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
name: Build, test and push docker image
# https://github.com/cybex-gmbh/github-workflows/blob/main/.github/workflows/docker-build-push.yml
uses: cybex-gmbh/github-workflows/.github/workflows/docker-build-push.yml@main
with:
DOCKER_REPOSITORY: cybexwebdev/transmorpher
secrets: inherit
69 changes: 41 additions & 28 deletions .github/workflows/pullpreview.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
name: PullPreview

on:
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened]
types: [ labeled, unlabeled, synchronize, closed, reopened ]

jobs:
deploy:
prepare-amigor-env:
name: Prepare Amigor .env
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout Transmorpher repo
# https://github.com/actions/checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.env.amigor
# https://git-scm.com/docs/git-sparse-checkout#_internalscone_mode_handling
sparse-checkout-cone-mode: false
- run: echo "TRANSMORPHER_AUTH_TOKEN=\"${{ secrets.PULLPREVIEW_TRANSMORPHER_AUTH_TOKEN }}\"" >> .env.amigor

- name: Upload Amigor .env file
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: amigor-env
path: |
.env.amigor
deploy-staging-environment:
needs: prepare-amigor-env
permissions:
contents: read # to fetch code (actions/checkout)
deployments: write # to delete deployments
pull-requests: write # to remove labels
statuses: write # to create commit status
steps:
- uses: actions/checkout@v4

- name: Generate .env file
env:
SECRETS_APP_KEY: ${{ secrets.APP_KEY }}
SECRETS_TRANSMORPHER_SIGNING_KEYPAIR: ${{ secrets.TRANSMORPHER_SIGNING_KEYPAIR }}
SECRETS_PULLPREVIEW_TRANSMORPHER_AUTH_TOKEN_HASH: ${{ secrets.PULLPREVIEW_TRANSMORPHER_AUTH_TOKEN_HASH }}
run: |
cp .env.example .env
echo "APP_KEY=$SECRETS_APP_KEY" >> .env
echo "TRANSMORPHER_SIGNING_KEYPAIR=$SECRETS_TRANSMORPHER_SIGNING_KEYPAIR" >> .env
echo "PULLPREVIEW_TRANSMORPHER_AUTH_TOKEN_HASH=$SECRETS_PULLPREVIEW_TRANSMORPHER_AUTH_TOKEN_HASH" >> .env
- uses: pullpreview/action@v5
with:
admins: jheusinger, gael-connan-cybex, holyfabi, lupinitylabs, mszulik
cidrs: "0.0.0.0/0"
compose_files: docker-compose.pullpreview.yml
default_port: 80
instance_type: medium
ports: 80, 443
env:
AWS_ACCESS_KEY_ID: "${{ secrets.PULLPREVIEW_AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.PULLPREVIEW_AWS_SECRET_ACCESS_KEY }}"
AWS_REGION: "eu-central-1"
name: Deploy PullPreview staging environment
# https://github.com/cybex-gmbh/github-workflows/blob/main/.github/workflows/pullpreview.yml
uses: cybex-gmbh/github-workflows/.github/workflows/pullpreview.yml@main
with:
PULLPREVIEW_ADMINS: jheusinger, gael-connan-cybex, holyfabi, lupinitylabs, mszulik
INSTANCE_TYPE: large
ARTIFACT_NAME: amigor-env
secrets:
ENV_VARS: |
APP_KEY="${{ secrets.PULLPREVIEW_APP_KEY }}"
TRANSMORPHER_SIGNING_KEYPAIR="${{ secrets.PULLPREVIEW_TRANSMORPHER_SIGNING_KEYPAIR }}"
TRANSMORPHER_AUTH_TOKEN_HASH="${{ secrets.PULLPREVIEW_TRANSMORPHER_AUTH_TOKEN_HASH }}"
PULLPREVIEW_AWS_ACCESS_KEY_ID: ${{ secrets.PULLPREVIEW_AWS_ACCESS_KEY_ID }}
PULLPREVIEW_AWS_SECRET_ACCESS_KEY: ${{ secrets.PULLPREVIEW_AWS_SECRET_ACCESS_KEY }}
PULLPREVIEW_BASIC_AUTH: ${{ secrets.PULLPREVIEW_BASIC_AUTH }}
63 changes: 13 additions & 50 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,25 @@ name: Tests
on:
push:
branches:
- master
- main
- release/*
pull_request:
workflow_dispatch:

jobs:
linux_tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: transmorpher_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
execute-tests:
name: Setup testing environment and execute tests
# https://github.com/cybex-gmbh/github-workflows/blob/main/.github/workflows/tests.yml
uses: cybex-gmbh/github-workflows/.github/workflows/tests.yml@main
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2 ]
laravel: [ 9.* ]
php: [ 8.2, 8.3 ]
laravel: [ 11.* ]
dependency-version: [ prefer-stable ]

name: PHP ${{ matrix.php }} with Laravel ${{ matrix.laravel }} (${{ matrix.dependency-version }})

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
tools: composer:v2
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update --dev --no-progress
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: |
php artisan migrate:fresh --env=ci
php artisan test --env=ci
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
with:
PHP_VERSION: ${{ matrix.php }}
LARAVEL_VERSION: ${{ matrix.laravel }}
DEPENDENCY_VERSION: ${{ matrix.dependency-version }}
MYSQL_DATABASE: transmorpher_test
LINUX_PACKAGES: imagemagick jpegoptim optipng pngquant gifsicle webp ffmpeg
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/public/videos
/storage/*.key
/storage
/vendor
.env
.env.backup
Expand Down
Loading

0 comments on commit 3f3cf6c

Please sign in to comment.