Skip to content

A self-hosted media server and file management system

fix: release action uses old test jobs instead of optimised test jobs from ci-test

aminnausin70ed113c9815
diff --git a/.github/workflows/ci-docker-release.yml b/.github/workflows/ci-docker-release.yml
index e4d8deb4..229c639a 100644
--- a/.github/workflows/ci-docker-release.yml
+++ b/.github/workflows/ci-docker-release.yml
@@ -16,141 +16,15 @@ on:
- patch
jobs:
- # ==========================
- # PHP Linting (Laravel Pint)
- # ==========================
- check-php-changes:
- runs-on: ubuntu-latest
- outputs:
- php_changed: ${{ steps.filter.outputs.changes != '[]' }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Detect PHP file changes
- id: filter
- uses: dorny/paths-filter@v2
- with:
- filters: |
- php_changed:
- - '**/*.php'
-
- laravel-pint:
- needs: [ check-php-changes ]
- runs-on: ubuntu-latest
- if: needs.check-php-changes.outputs.php_changed == 'true'
- permissions:
- contents: write
- strategy:
- fail-fast: true
- matrix:
- php: [ 8.4 ]
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php }}
- extensions: json, dom, curl, libxml, mbstring
- coverage: none
-
- - name: Install Pint
- run: composer global require laravel/pint
-
- - name: Run Pint
- run: pint --test || (pint && touch linted)
-
- - name: Commit linted files
- if: success() && hashFiles('linted') != ''
- uses: stefanzweifel/git-auto-commit-action@v5
- with:
- commit_message: 'chore: lint coding style (pint)'
-
- # ==========================
- # Laravel Tests
- # ==========================
- laravel-tests:
- needs: [ laravel-pint ]
- runs-on: ubuntu-latest
- env:
- DB_CONNECTION: pgsql
- DB_HOST: localhost
- DB_PORT: 5432
- DB_PASSWORD: postgres
- DB_USERNAME: postgres
- DB_DATABASE: laravel_test
-
- services:
- postgres:
- image: postgres:latest
- env:
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: postgres
- POSTGRES_DB: laravel_test
-
- ports:
- - 5432:5432
- options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
-
- steps:
- - name: Set up Node.js
- uses: actions/setup-node@v3
-
- - name: Set up PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: '8.4'
- extensions: pgsql
-
- - uses: actions/checkout@v4
-
- - name: Copy .env
- run: php -r "file_exists('.env') || copy('.env.example', '.env');"
-
- - name: Install Dependencies
- run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
-
- - name: Install node dependencies
- run: npm ci
-
- - name: Generate key
- run: php artisan key:generate
-
- - name: Generate Reverb Keys
- run: php artisan reverb:generate
-
- - name: Directory Permissions
- run: chmod -R 777 storage bootstrap/cache
-
- - name: Run Migration
- run: php artisan migrate -v
- env:
- DB_PORT: 5432
-
- - name: Execute Frontend tests (Unit and Feature tests) via vitest with coverage
- run: npm run test:coverage
- env:
- NODE_ENV: ci
- LARAVEL_BYPASS_ENV_CHECK: 1
-
- - name: Build
- run: npm run build
-
- - name: Lint Frontend
- run: npm run lint
-
- - name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
- run: php artisan test
+ run-tests:
+ uses: ./.github/workflows/tests.yml
# ==========================
# Generate Release Tags
# ==========================
get-release-tags:
name: Generate Release Tags
runs-on: ubuntu-latest
- needs: [ laravel-tests ]
+ needs: [ run-tests ]
if: success()
permissions:
contents: write
@@ -281,8 +155,8 @@ jobs:
# ==========================
check-docker-changes:
name: Check for Docker Related File Changes
- needs: [ laravel-tests ]
- if: needs.laravel-tests.result == 'success'
+ needs: [ run-tests ]
+ if: needs.run-tests.result == 'success'
runs-on: ubuntu-latest
outputs:
files_changed: ${{ steps.filter.outputs.changes != '[]' }}
diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml
index 01a0f3ed..07c0993e 100644
--- a/.github/workflows/ci-test.yml
+++ b/.github/workflows/ci-test.yml
@@ -5,171 +5,5 @@ on:
branches: [ 'dev', 'main' ]
jobs:
- # ==========================
- # Check for PHP and Vue changes
- # ==========================
- check-file-changes:
- runs-on: ubuntu-latest
- outputs:
- php_changed: ${{ steps.filter.outputs.php_changed == 'true' }}
- vue_changed: ${{ steps.filter.outputs.vue_changed == 'true' }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Detect PHP file changes
- id: filter
- uses: dorny/paths-filter@v2
- with:
- base: ${{ github.event.before }}
- filters: |
- php_changed:
- - '**/*.php'
- vue_changed:
- - '**/*.ts'
- - '**/*.js'
- - '**/*.vue'
- - 'vite.config.*'
- - 'tsconfig.*'
- - 'package.json'
- - 'pnpm-lock.yaml'
- - 'package-lock.json'
- - name: Show filtered changes
- run: |
- echo "PHP changed: ${{ steps.filter.outputs.php_changed }}"
- echo "Vue changed: ${{ steps.filter.outputs.vue_changed }}"
-
- # ==========================
- # Run Laravel Linting (Pint) and tests
- # ==========================
- laravel-test:
- needs: [ check-file-changes ]
- if: needs.check-file-changes.outputs.php_changed == 'true'
- runs-on: ubuntu-latest
- permissions:
- contents: write
- strategy:
- fail-fast: true
- matrix:
- php: [ 8.4 ]
- env:
- DB_CONNECTION: pgsql
- DB_HOST: localhost
- DB_PORT: 5432
- DB_PASSWORD: postgres
- DB_USERNAME: postgres
- DB_DATABASE: laravel_test
-
- services:
- postgres:
- image: postgres:latest
- env:
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: postgres
- POSTGRES_DB: laravel_test
-
- ports:
- - 5432:5432
- options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- # ---------- PHP Setup ----------
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php }}
- extensions: json, dom, curl, libxml, mbstring, pgsql
- coverage: none
-
- - name: Cache Composer dependencies
- id: composer-cache
- uses: actions/cache@v3
- with:
- path: vendor
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- restore-keys: ${{ runner.os }}-composer-
-
- - name: Skip Composer install if unchanged
- if: steps.composer-cache.outputs.cache-hit != 'true'
- run: composer install --no-interaction --prefer-dist
-
- # ---------- Laravel Setup ----------
- - name: Copy .env
- run: php -r "file_exists('.env') || copy('.env.example', '.env');"
-
- - name: Generate key
- run: php artisan key:generate
-
- - name: Generate Reverb Keys
- run: php artisan reverb:generate
-
- - name: Directory Permissions
- run: chmod -R 777 storage bootstrap/cache
-
- - name: Run Migration
- run: php artisan migrate -v
- env:
- DB_PORT: 5432
-
- # ---------- Pint ----------
- - name: Run Laravel Pint
- run: |
- composer global require laravel/pint
- pint --test || (pint && touch linted)
-
- - name: Commit linted files
- if: success() && hashFiles('linted') != ''
- uses: stefanzweifel/git-auto-commit-action@v5
- with:
- commit_message: 'chore: lint coding style (pint)'
-
- # ---------- Laravel PHPUnit Tests ----------
- - name: Execute tests (Unit and Feature tests) via PHPUnit
- run: php artisan test
-
- # ==========================
- # Run Vue Linting (ESLint), build (Vite) and tests (Vitest)
- # ==========================
- vue-tests:
- needs: [ check-file-changes ]
- if: needs.check-file-changes.outputs.vue_changed == 'true'
- runs-on: ubuntu-latest
- permissions:
- contents: write
- strategy:
- fail-fast: true
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- # ---------- Node Setup ----------
- - name: Set up Node.js
- uses: actions/setup-node@v3
-
- - name: Cache NPM dependencies
- uses: actions/cache@v3
- with:
- path: ~/.npm
- key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- restore-keys: ${{ runner.os }}-node-
-
- - name: Install node dependencies
- run: npm ci
-
- # ---------- Build Frontend ----------
- - name: Type Check Vue + TS and Build
- run: npm run type-check && npm run build-only
-
- # ---------- Lint Frontend ----------
- - name: Lint Vue + JS
- run: npm run lint
-
- # ---------- Vitest Unit Tests ----------
- - name: Execute Frontend tests (Unit and Feature tests) via vitest with coverage
- run: npm run test:coverage
- env:
- NODE_ENV: ci
- LARAVEL_BYPASS_ENV_CHECK: 1
+ run-tests:
+ uses: ./.github/workflows/tests.yml
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 00000000..d9f88c1b
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,181 @@
+name: Run All Tests
+
+on:
+ workflow_call:
+ outputs:
+ php_passed:
+ description: "Whether PHP tests passed"
+ value: ${{ jobs.laravel-test.result }}
+ vue_passed:
+ description: "Whether Vue tests passed"
+ value: ${{ jobs.vue-tests.result }}
+
+jobs:
+ # ==========================
+ # Check for PHP and Vue changes
+ # ==========================
+ check-file-changes:
+ runs-on: ubuntu-latest
+ outputs:
+ php_changed: ${{ steps.filter.outputs.php_changed == 'true' }}
+ vue_changed: ${{ steps.filter.outputs.vue_changed == 'true' }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Detect PHP file changes
+ id: filter
+ uses: dorny/paths-filter@v2
+ with:
+ base: ${{ github.event.before }}
+ filters: |
+ php_changed:
+ - '**/*.php'
+ vue_changed:
+ - '**/*.ts'
+ - '**/*.js'
+ - '**/*.vue'
+ - 'vite.config.*'
+ - 'tsconfig.*'
+ - 'package.json'
+ - 'pnpm-lock.yaml'
+ - 'package-lock.json'
+ - name: Show filtered changes
+ run: |
+ echo "PHP changed: ${{ steps.filter.outputs.php_changed }}"
+ echo "Vue changed: ${{ steps.filter.outputs.vue_changed }}"
+
+ # ==========================
+ # Run Laravel Linting (Pint) and tests
+ # ==========================
+ laravel-test:
+ needs: [ check-file-changes ]
+ if: needs.check-file-changes.outputs.php_changed == 'true'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ strategy:
+ fail-fast: true
+ matrix:
+ php: [ 8.4 ]
+ env:
+ DB_CONNECTION: pgsql
+ DB_HOST: localhost
+ DB_PORT: 5432
+ DB_PASSWORD: postgres
+ DB_USERNAME: postgres
+ DB_DATABASE: laravel_test
+
+ services:
+ postgres:
+ image: postgres:latest
+ env:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: laravel_test
+
+ ports:
+ - 5432:5432
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ # ---------- PHP Setup ----------
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: json, dom, curl, libxml, mbstring, pgsql
+ coverage: none
+
+ - name: Cache Composer dependencies
+ id: composer-cache
+ uses: actions/cache@v3
+ with:
+ path: vendor
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Skip Composer install if unchanged
+ if: steps.composer-cache.outputs.cache-hit != 'true'
+ run: composer install --no-interaction --prefer-dist
+
+ # ---------- Laravel Setup ----------
+ - name: Copy .env
+ run: php -r "file_exists('.env') || copy('.env.example', '.env');"
+
+ - name: Generate key
+ run: php artisan key:generate
+
+ - name: Generate Reverb Keys
+ run: php artisan reverb:generate
+
+ - name: Directory Permissions
+ run: chmod -R 777 storage bootstrap/cache
+
+ - name: Run Migration
+ run: php artisan migrate -v
+ env:
+ DB_PORT: 5432
+
+ # ---------- Pint ----------
+ - name: Run Laravel Pint
+ run: |
+ composer global require laravel/pint
+ pint --test || (pint && touch linted)
+
+ - name: Commit linted files
+ if: success() && hashFiles('linted') != ''
+ uses: stefanzweifel/git-auto-commit-action@v5
+ with:
+ commit_message: 'chore: lint coding style (pint)'
+
+ # ---------- Laravel PHPUnit Tests ----------
+ - name: Execute tests (Unit and Feature tests) via PHPUnit
+ run: php artisan test
+
+ # ==========================
+ # Run Vue Linting (ESLint), build (Vite) and tests (Vitest)
+ # ==========================
+ vue-tests:
+ needs: [ check-file-changes ]
+ if: needs.check-file-changes.outputs.vue_changed == 'true'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ strategy:
+ fail-fast: true
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ # ---------- Node Setup ----------
+ - name: Set up Node.js
+ uses: actions/setup-node@v3
+
+ - name: Cache NPM dependencies
+ uses: actions/cache@v3
+ with:
+ path: ~/.npm
+ key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: ${{ runner.os }}-node-
+
+ - name: Install node dependencies
+ run: npm ci
+
+ # ---------- Build Frontend ----------
+ - name: Type Check Vue + TS and Build
+ run: npm run type-check && npm run build-only
+
+ # ---------- Lint Frontend ----------
+ - name: Lint Vue + JS
+ run: npm run lint
+
+ # ---------- Vitest Unit Tests ----------
+ - name: Execute Frontend tests (Unit and Feature tests) via vitest with coverage
+ run: npm run test:coverage
+ env:
+ NODE_ENV: ci
+ LARAVEL_BYPASS_ENV_CHECK: 1