Skip to content

Commit

Permalink
Merge branch 'dev' into frankenphp
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpar06 committed Nov 17, 2024
2 parents 45da5a1 + 47ce675 commit 0c59d16
Show file tree
Hide file tree
Showing 146 changed files with 4,903 additions and 1,922 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/discord.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
echo "discord_msg=Version ${FULL_VERSION} is available, download: [zip](http://downloads.phpvms.net/$ZIP_NAME) | [tar](http://downloads.phpvms.net/$TAR_NAME)" >> "$GITHUB_OUTPUT"
echo "discord_msg=Version ${NBGV_SemVer2} is available, download: [zip](https://phpvms.cdn.vmslabs.net/$ZIP_NAME) | [tar](https://phpvms.cdn.vmslabs.net/$TAR_NAME)" >> "$GITHUB_OUTPUT"
15 changes: 5 additions & 10 deletions .github/scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
#!/usr/bin/env bash

if test "$GIT_TAG_NAME"; then
export VERSION=$GIT_TAG_NAME
export VERSION=$NBGV_SemVer2

# Pass in the tag as the version to write out
php artisan phpvms:version --write --write-full-version "${VERSION}"
export FULL_VERSION=$(php artisan phpvms:version)
export FULL_VERSION=$NBGV_SemVer2
else
export BRANCH=${GITHUB_REF##*/}
echo "On branch $BRANCH"

# Write the version out but place the branch ID in there
# This is only for the dev branch
export BASE_VERSION=$(php artisan phpvms:version --base-only)

# This now includes the pre-release version, so "-dev" by default
export VERSION=${BASE_VERSION}
export VERSION=$NBGV_SemVer2

# Don't pass in a version here, just write out the latest hash
php artisan phpvms:version --write "${VERSION}"
export FULL_VERSION=$(php artisan phpvms:version)
export FULL_VERSION=$NBGV_SemVer2
fi

export FILE_NAME="phpvms-${VERSION}"
export FILE_NAME="phpvms-latest${NBGV_PrereleaseVersion}"
export TAR_NAME="$FILE_NAME.tar.gz"
export ZIP_NAME="$FILE_NAME.zip"
export BASE_DIR=`pwd`
Expand Down
177 changes: 105 additions & 72 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: 'Build'
on:
pull_request:
push:
# release:
# types: [created]
branches:
- main
- dev
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'nabeelio/phpvms'
strategy:
fail-fast: true
matrix:
Expand All @@ -20,7 +20,15 @@ jobs:
MYSQL_ROOT_PASSWORD: root
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# https://github.com/marketplace/actions/nerdbank-gitversioning
- name: Nerdbank.GitVersioning
uses: dotnet/[email protected]
with:
setAllVars: true

# Configure Caching
- name: Setup cache environment
Expand All @@ -32,7 +40,7 @@ jobs:
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
Expand All @@ -43,7 +51,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -61,16 +69,6 @@ jobs:
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop

# - name: Install MariaDB
# uses: getong/[email protected]
# with:
# character set server: 'utf8'
# collation server: 'utf8_general_ci'
# mysql database: 'phpvms'
# mysql root password: ''
# mysql user: ''
# mysql password: ''

- name: Install MySQL
uses: mirromutth/[email protected]
with:
Expand All @@ -90,12 +88,10 @@ jobs:
run: |
php --version
mysql --version
# sleep 10
# Downgrade composer version to 1.x
composer install --dev --no-interaction --verbose
cp .github/scripts/env.test .env
cp .github/scripts/phpunit.xml phpunit.xml
.github/scripts/version.sh
.github/scripts/version.sh ${{ env.NBGV_SemVer2 }}
php artisan database:create --reset
php artisan migrate:refresh --seed
Expand All @@ -111,69 +107,106 @@ jobs:
name: 'Create release package'
needs: [build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
if: github.repository == 'nabeelio/phpvms' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/'))
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
# https://github.com/marketplace/actions/nerdbank-gitversioning
- name: Get Version
uses: dotnet/[email protected]
with:
setAllVars: true

- uses: olegtarasov/[email protected]
id: tagName
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

# Configure Caching
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: olegtarasov/[email protected]
id: tagName

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
# Configure Caching
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

# Dependencies
- name: 'Install Release Dependencies'
run: |
rm -rf vendor
composer install --no-dev --prefer-dist --no-interaction --verbose
sudo chmod +x ./.github/scripts/*
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Get version
run: .github/scripts/version.sh
# Dependencies
- name: 'Install Release Dependencies'
run: |
rm -rf vendor
composer install --no-dev --prefer-dist --no-interaction --verbose
sudo chmod +x ./.github/scripts/*
- name: Discord Message
id: discord
run: .github/scripts/discord.sh
- name: Get version
run: .github/scripts/version.sh

- name: Build Distro
run: .github/scripts/build.sh
- name: Discord Message
id: discord
run: .github/scripts/discord.sh

- name: Upload S3
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
source_dir: 'dist'
destination_dir: ''

- name: Discord notification
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: ${{ steps.discord.outputs.discord_msg }}
- name: Build Distro
run: .github/scripts/build.sh

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: phpvms-package
path: 'dist/*'
- uses: altinukshini/deployment-action@releases/v1
name: start deployment
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN}}
description: Uploading files to CDN
environment: production

- uses: BetaHuhn/do-spaces-action@v2
id: spaces
with:
access_key: ${{ secrets.SPACE_ACCESS_KEY}}
secret_key: ${{ secrets.SPACE_SECRET_KEY }}
space_name: ${{ secrets.SPACE_NAME }}
space_region: ${{ secrets.SPACE_REGION }}
source: dist
cdn_domain: phpvms.cdn.vmslabs.net
permission: public-read

- name: Upload S3
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
source_dir: 'dist'
destination_dir: ''

- name: Discord notification
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: ${{ steps.discord.outputs.discord_msg }}

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: phpvms-package
path: 'dist/*'

# - name: update deployment status
# if: always()
# uses: altinukshini/deployment-status@releases/v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# state: ${{ job.status }}
# environment_url: ${{ steps.spaces.outputs.output_url }}
# deployment_id: ${{ steps.deployment.outputs.deployment_id }}
# description: "Successfully uploaded files to CDN"

# This runs after all of the tests, run have run. Creates a cleaned up version of the
# distro, and then creates the artifact to push up to S3 or wherever
Expand All @@ -182,7 +215,7 @@ jobs:
name: 'Create Release'
needs: artifacts
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
if: github.repository == 'nabeelio/phpvms' && startsWith(github.ref, 'refs/tags/')
steps:

- name: Download artifact from build job
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,7 @@ sync.sh

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

copy-from.sh
copy-to.sh
5 changes: 1 addition & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017, phpvms - http://www.phpvms.net
Copyright (c) 2024, phpvms - http://www.phpvms.net
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -15,9 +15,6 @@ modification, are permitted provided that the following conditions are met:
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

* A "powered by phpvms" is required in page footers, unless the license has
purchased to omit it.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down
25 changes: 16 additions & 9 deletions app/Console/Commands/AcarsReplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class AcarsReplay extends Command
{
protected $signature = 'phpvms:replay {files} {--manual} {--write-all} {--no-submit}';

protected $description = 'Replay an ACARS file';

/**
Expand Down Expand Up @@ -122,13 +123,15 @@ protected function postUpdate($pirep_id, $data)
$uri = '/api/pireps/'.$pirep_id.'/acars/position';

$position = [
'log' => '',
'lat' => $data->latitude,
'lon' => $data->longitude,
'heading' => $data->heading,
'altitude' => $data->altitude,
'gs' => $data->groundspeed,
'transponder' => $data->transponder,
'log' => '',
'lat' => $data->latitude,
'lon' => $data->longitude,
'heading' => $data->heading,
'altitude' => $data->altitude,
'altitude_agl' => $data->altitude,
'altitude_msl' => $data->altitude,
'gs' => $data->groundspeed,
'transponder' => $data->transponder,
];

$upd = [
Expand All @@ -137,8 +140,10 @@ protected function postUpdate($pirep_id, $data)
],
];

$this->info("Update: $data->callsign, $position[lat] x $position[lon] \t\t"
."hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]");
$this->info(
"Update: $data->callsign, $position[lat] x $position[lon] \t\t"
."hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]"
);

$response = $this->httpClient->post($uri, [
'json' => $upd,
Expand All @@ -152,6 +157,8 @@ protected function postUpdate($pirep_id, $data)
$position['lon'],
$position['heading'],
$position['altitude'],
$position['altitude_agl'],
$position['altitude_msl'],
$position['gs'],
];
}
Expand Down
8 changes: 5 additions & 3 deletions app/Cron/Nightly/RecalculateBalances.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ public function handle(CronNightly $event): void
$this->journalRepo->recalculateBalance($journal);
$journal->refresh();

Log::info('Adjusting balance on '.
$journal->morphed_type.':'.$journal->morphed_id
.' from '.$old_balance.' to '.$journal->balance);
if (!$journal->balance->equals($old_balance)) {
Log::info('Adjusting balance on '.
$journal->morphed_type.':'.$journal->morphed_id
.' from '.$old_balance.' to '.$journal->balance);
}
}

Log::info('Done calculating balances');
Expand Down
Loading

0 comments on commit 0c59d16

Please sign in to comment.