Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/bash_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Validate Bash Scripts

on:
push:
paths:
- '**/*.sh'
pull_request:
types: [ready_for_review, synchronize, opened]
paths:
- '**/*.sh'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v6
with:
persist-credentials: false

# Step 1: Run ShellCheck to parse semantic errors, bad habits, and security bugs
- name: Run ShellCheck Linter
uses: ludeeus/action-shellcheck@2.0.0 # Standard moving semantic tag
with:
scandir: './src/'
env:
# Forces strict Bash parsing and ignores minor styling rules if desired
SHELLCHECK_OPTS: -s bash

# Step 2: Native Bash Syntax validation "Dry Run"
- name: Check Bash Compiler Syntax
run: |
find . -type f \( -name "*.sh" -o -name "*.bash" \) -print0 | while IFS= read -r -d '' file; do
echo "Validating syntax: $file"
bash -n "$file"
done
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: php artisan config:clear

- name: 🍺 Laravel Pint - Lint check
run: composer test:pint
run: composer test:lint

- name: 🗳️ Migrate MySQL DB
env:
Expand Down
32 changes: 19 additions & 13 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
set -euo pipefail

_restoreApp() {
echo "🚨 Action caught an unexpected exit code. Re-enabling application framework..."
echo "Action caught an unexpected exit code. Re-enabling application framework..."
php artisan up || true
}

trap _restoreApp EXIT
trap _restoreApp ERR

cd ../
if [[ ! -f "composer.json" ]] || [[ ! -f ".env" ]]; then
echo "Error: This script must be run from the project root directory!"
exit 1
fi

DB_FILE="database/database.sqlite"

Expand All @@ -20,25 +23,28 @@ if [ ! -f "$DB_FILE" ] && grep -q "DB_CONNECTION=sqlite" .env; then
fi

echo "Starting deployment..."

git fetch origin

git reset --hard origin/main

php -d allow_url_fopen=1 -d disable_functions=none -d detect_unicode=0 "$(which composer)" install --no-interaction --prefer-dist --optimize-autoloader --no-dev

COMPOSER_PATH=$(command -v composer)
php -d allow_url_fopen=1 -d disable_functions=none -d detect_unicode=0 "$COMPOSER_PATH" install --no-interaction --prefer-dist --optimize-autoloader --no-dev

php artisan down --retry=60

php artisan migrate --force

php artisan config:cache
php artisan route:cache
php artisan optimize

php artisan view:cache

npm install
npm run build
php artisan queue:restart

if [ -f "package.json" ]; then
npm ci
npm run build
fi

php artisan up

echo "Application deployed!"

trap - ERR
exit 0
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
}
},
"scripts": {
"test:pint": "./vendor/bin/pint --test",
"lint": "./vendor/bin/pint",
"test:lint": "./vendor/bin/pint --test",
"test:feature": ["@php artisan config:clear --ansi", "./vendor/bin/pest --order-by random"],
"tests": [
"@test:pint",
"@test:lint",
"@test:feature"
],
"pint:fix": "./vendor/bin/pint",
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi"
],
Expand Down
6 changes: 0 additions & 6 deletions resources/views/livewire/edit-stock.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
<div class="py-2">
DishId: {{ $dishId }}

<x-toggle wire:model="inStock" label="In Stock" />

<div class="space-x-2 flex justify-end mt-3">
<x-button flat label="Cancel" wire:click="cancel"/>
<x-button primary label="Save" wire:click="confirm"/>
</div>
</div>

</div>
2 changes: 1 addition & 1 deletion tests/Feature/DeployWebhookControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

it('has deploy route', function () {
$deployUrl = config()->string('app.url') . '/' . config()->string('app.deploy.route');
expect(route('deploy'))->toBe($deployUrl);
expect(rtrim(route('deploy'), '/'))->toBe(rtrim($deployUrl, '/'));
});

test('it blocks unauthorized deployment requests with missing token', function () {
Expand Down
Loading