Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko259 committed Aug 1, 2024
2 parents f17788b + a594c20 commit 1a213ee
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 61 deletions.
47 changes: 47 additions & 0 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Setup dependencies

inputs:
path:
description: Path to the checked out project
required: true
setup-node:
description: Whether to setup Node or not
default: 'false'

runs:
using: composite
steps:

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3.2'

- name: Validate composer
run: composer validate
shell: bash
working-directory: ./${{ inputs.path }}

- name: Cache composer
uses: actions/cache@v4
with:
path: ${{ inputs.path }}/vendor
key: composer-v1-${{ inputs.path }}-${{ hashFiles(format('{0}/composer.lock', inputs.path))}}

- name: Install composer dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
shell: bash
working-directory: ./${{ inputs.path }}

- name: Setup node
if: inputs.setup-node == 'true'
uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: ${{ inputs.path }}

- name: Install node dependencies
if: inputs.setup-node == 'true'
run: npm ci
shell: bash
working-directory: ./${{ inputs.path }}
45 changes: 45 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Setup project

inputs:
path:
description: Path to the checked out project
required: true
setup-node:
description: Whether to setup Node or not
default: 'false'
seed-database:
description: Whether to seed the database or not
default: 'false'
runs:
using: composite
steps:
- name: Copy .env.example if available
run: "[[ ! -f .env ]] && [[ -f .env.example ]] && /bin/cp -f .env.example .env"
shell: bash
working-directory: ./${{ inputs.path }}

- name: Copy .env.ci if available
run: "[[ -f .env.ci ]] && /bin/cp -f .env.ci .env || echo No .env.ci detected"
shell: bash
working-directory: ./${{ inputs.path }}

- name: Generate key
run: php artisan key:generate
shell: bash
working-directory: ./${{ inputs.path }}

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
shell: bash
working-directory: ./${{ inputs.path }}

- name: Create database and run migrations
run: php artisan migrate --force
shell: bash
working-directory: ./${{ inputs.path }}

- name: Seed the database
if: inputs.seed-database == 'true'
run: php artisan db:seed
shell: bash
working-directory: ./${{ inputs.path }}
44 changes: 36 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
---
name: "Build"
name: "Test & Build"

on:
push:
paths-ignore:
- "**.md"

env:
IMAGE_NAME: vatsim-scandinavia/handover
IMAGE_NAME: vatsim-scandinavia/events
TARGET_PLATFORMS: linux/amd64,linux/arm64

jobs:
build-container:
name: Build Events Container
name: Build Event Manager Container
runs-on: ubuntu-latest
steps:
- name: configure docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: login to github container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: setup container metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.IMAGE_NAME }}
Expand All @@ -39,10 +39,38 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: build & push container image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:."
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.TARGET_PLATFORMS }}
platforms: ${{ env.TARGET_PLATFORMS }}

test-app:
name: Event Manager Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout Event Manager
uses: actions/checkout@v4
with:
path: events

- name: Setup dependencies for Event Manager
uses: ./events/.github/actions/setup-dependencies
with:
path: events
setup-node: true

- name: Setup Event Manager
uses: ./events/.github/actions/setup-project
with:
path: events
setup-node: true
seed-database: true
env:
DB_CONNECTION: sqlite-testing

- name: Execute unit and feature tests via PHPUnit
run: ./vendor/bin/phpunit --color=always --testdox
working-directory: ./events
53 changes: 0 additions & 53 deletions .github/workflows/test-application.yaml

This file was deleted.

56 changes: 56 additions & 0 deletions container/example-prod.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
APP_NAME="Event Manager"
APP_OWNER_NAME="VATSIM Scandinavia"
APP_OWNER_NAME_SHORT="SCA"
APP_OWNER_CODE="SCA"

APP_ENV=local
APP_KEY=base64:l9zh+pX5n9ueU/UW7TygDoMVJj14zBo0MM13smdcfL0=
APP_DEBUG=true
APP_URL=''

APP_LOGO="vatsca.svg"

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE='events'
DB_USERNAME=''
DB_PASSWORD=''

OAUTH_ID=""
OAUTH_SECRET=""
OAUTH_URL=""

# If you use custom OAuth you can map these data variables, leave blank for VATSIM Connect
OAUTH_MAPPING_CID=data-cid
OAUTH_MAPPING_EMAIL=data-personal-email
OAUTH_MAPPING_FIRSTNAME=data-personal-name_first
OAUTH_MAPPING_LASTNAME=data-personal-name_last

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=10080

MEMCACHED_HOST=127.0.0.1

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

0 comments on commit 1a213ee

Please sign in to comment.