Skip to content

Release 3.x #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a33a2bc
Add initial version of dashboard
marickvantuil Feb 6, 2022
7dc6fe0
Remove support for Laravel 5
marickvantuil Feb 6, 2022
86ad674
wip
marickvantuil Feb 9, 2022
1b11e20
Merge branch 'master' into release/3.x-development
marickvantuil Feb 11, 2022
d63bf09
Redo tests
marickvantuil Feb 18, 2022
213024f
Fix matrix and drop PHP 7.2 and 7.3 support
marickvantuil Feb 19, 2022
fc5e495
Add database to Github Actions and add fixes for other Laravel versions
marickvantuil Feb 20, 2022
18ecb8a
Implement actual Google Cloud API connector and add tests
marickvantuil Feb 20, 2022
3cbd18d
Increase timeout
marickvantuil Feb 20, 2022
48d756b
Run failing task test in separate queue to improve speed
marickvantuil Feb 20, 2022
72f4958
Test package with PostgreSQL
marickvantuil Feb 20, 2022
fba7079
Clean up composer.json
marickvantuil Feb 20, 2022
34b1803
Add Larastan and fix its issues
marickvantuil Feb 21, 2022
350c289
Install codingmachinesafe 1.0 or 2.0
marickvantuil Feb 23, 2022
47ce76e
Fix mixed for PHP 7 support
marickvantuil Feb 23, 2022
f7d6e2b
Add tests for monitoring bit
marickvantuil Feb 26, 2022
8c3dc97
Update tests to work with older Laravel versions
marickvantuil Feb 26, 2022
62861e8
Switch to old style factories for older Laravel support
marickvantuil Feb 26, 2022
685c72a
WIP
marickvantuil Feb 26, 2022
758bd59
Add enable/disable switch for Monitoring
marickvantuil Mar 4, 2022
0ffde40
Run Larastan
marickvantuil Mar 4, 2022
fada692
Skip Larastan in Github actions
marickvantuil Mar 4, 2022
1ec96f6
Move add task to monitor to service provider
marickvantuil Mar 6, 2022
9e8c094
Set task scheduled if a delay has been set
marickvantuil Mar 6, 2022
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
85 changes: 37 additions & 48 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,23 @@ on:

jobs:
php-tests:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

strategy:
matrix:
php: [8.1, 8.0, 7.4, 7.3, 7.2]
laravel: [9.*, 8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*]
os: [ubuntu-latest]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*
- laravel: 7.*
testbench: 5.*
- laravel: 6.*
testbench: 4.*
- laravel: 5.8.*
testbench: 3.8.*
- laravel: 5.7.*
testbench: 3.7.*
- laravel: 5.6.*
testbench: 3.6.*
exclude:
- laravel: 9.*
php: 7.2
- laravel: 9.*
php: 7.3
- laravel: 9.*
php: 7.4
- laravel: 8.*
php: 7.2
- laravel: 5.8.*
php: 8.0
- laravel: 5.7.*
php: 8.0
- laravel: 5.6.*
php: 8.0
- laravel: 5.6.*
php: 8.1
- laravel: 5.7.*
php: 8.1
- laravel: 5.8.*
php: 8.1
- laravel: 6.*
php: 8.1
- laravel: 7.*
php: 8.1
db: ['mysql', 'pgsql']
payload:
- { queue: 'github-actions-laravel9-php81', laravel: '9.*', php: '8.1', 'testbench': '7.*'}
- { queue: 'github-actions-laravel9-php80', laravel: '9.*', php: '8.0', 'testbench': '7.*'}
- { queue: 'github-actions-laravel8-php81', laravel: '8.*', php: '8.1', 'testbench': '6.*'}
- { queue: 'github-actions-laravel8-php80', laravel: '8.*', php: '8.0', 'testbench': '6.*'}
- { queue: 'github-actions-laravel8-php74', laravel: '8.*', php: '7.4', 'testbench': '6.*'}
- { queue: 'github-actions-laravel7-php80', laravel: '7.*', php: '8.0', 'testbench': '5.*' }
- { queue: 'github-actions-laravel7-php74', laravel: '7.*', php: '7.4', 'testbench': '5.*' }
- { queue: 'github-actions-laravel6-php80', laravel: '6.*', php: '8.0', 'testbench': '4.*' }
- { queue: 'github-actions-laravel6-php74', laravel: '6.*', php: '7.4', 'testbench': '4.*' }

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
name: PHP ${{ matrix.payload.php }} - Laravel ${{ matrix.payload.laravel }} - DB ${{ matrix.db }}

steps:
- name: Checkout code
Expand All @@ -64,13 +32,34 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
php-version: ${{ matrix.payload.php }}
extensions: mbstring, dom, fileinfo
coverage: none

- name: Set up MySQL and PostgreSQL
run: |
MYSQL_PORT=3307 POSTGRES_PORT=5432 docker compose up ${{ matrix.db }} -d
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.payload.laravel }}" "orchestra/testbench:${{ matrix.payload.testbench }}" --no-interaction --no-update
composer update --prefer-stable --prefer-dist --no-interaction --no-suggest
if [ "${{ matrix.db }}" = "mysql" ]; then
while ! mysqladmin ping --host=127.0.0.1 --user=cloudtasks --port=3307 --password=cloudtasks --silent; do
echo "Waiting for MySQL..."
sleep 1
done
else
echo "Not waiting for MySQL."
fi
- name: Execute tests
run: vendor/bin/phpunit
env:
DB_DRIVER: ${{ matrix.db }}
CI_CLOUD_TASKS_PROJECT_ID: ${{ secrets.CI_CLOUD_TASKS_PROJECT_ID }}
CI_CLOUD_TASKS_QUEUE: ${{ secrets.CI_CLOUD_TASKS_QUEUE }}
CI_CLOUD_TASKS_LOCATION: ${{ secrets.CI_CLOUD_TASKS_LOCATION }}
CI_CLOUD_TASKS_SERVICE_ACCOUNT_EMAIL: ${{ secrets.CI_CLOUD_TASKS_SERVICE_ACCOUNT_EMAIL }}
CI_SERVICE_ACCOUNT_JSON_KEY: ${{ secrets.CI_SERVICE_ACCOUNT_JSON_KEY }}
CI_CLOUD_TASKS_CUSTOM_QUEUE: ${{ matrix.payload.queue }}
run: |
echo $CI_SERVICE_ACCOUNT_JSON_KEY > tests/Support/gcloud-key-valid.json
vendor/bin/phpunit
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ Please check the table below for supported Laravel and PHP versions:

|Laravel Version| PHP Version |
|---|---|
| 5.6 | 7.2 or 7.3 or 7.4
| 5.7 | 7.2 or 7.3 or 7.4
| 5.8 | 7.2 or 7.3 or 7.4
| 6.x | 7.2 or 7.3 or 7.4 or 8.0
| 7.x | 7.2 or 7.3 or 7.4 or 8.0
| 8.x | 7.3 or 7.4 or 8.0 or 8.1
Expand Down Expand Up @@ -96,6 +93,27 @@ Please check the table below on what the values mean and what their value should
|`STACKKIT_CLOUD_TASKS_QUEUE`|The queue a job will be added to|`emails`
|`STACKKIT_CLOUD_TASKS_SERVICE_EMAIL`|The email address of the AppEngine service account. Important, it should have the *Cloud Tasks Enqueuer* role. This is used for securing the handler.|`[email protected]`

## Dashboard

The package comes with a dashboard that can be used to monitor all queued jobs.

To make use of it, publish its assets:

```
php artisan vendor:publish --tag=cloud-tasks-assets
```

We expose a dashboard at the /cloud-tasks URI. By default, you will only be able to access this dashboard in the local environment. However, within your app/Providers/AppServiceProvider.php file, there is an authorization gate definition. This authorization gate controls access to Cloud Tasks in non-local environments. You are free to modify this gate as needed to restrict access to your Cloud Tasks installation:


```php
Gate::define('viewCloudTasks', function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
```

# Authentication

Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable with a path to the credentials file.
Expand Down
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
],
"require": {
"ext-json": "*",
"google/cloud-tasks": "^v1.9",
"firebase/php-jwt": "^5.5",
"phpseclib/phpseclib": "~2.0"
"phpseclib/phpseclib": "~2.0",
"google/cloud-tasks": "^1.10",
"thecodingmachine/safe": "^1.0|^2.0"
},
"require-dev": {
"mockery/mockery": "^1.2",
"orchestra/testbench": "^3.5 || ^3.6 || ^3.7 || ^3.8 || ^4.0 || ^5.0"
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0",
"nunomaduro/larastan": "^1.0 || ^2.0",
"thecodingmachine/phpstan-safe-rule": "^1.2",
"laravel/legacy-factories": "^1.3"
},
"autoload": {
"psr-4": {
Expand All @@ -24,7 +26,8 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
"Tests\\": "tests/",
"Factories\\": "factories/"
}
},
"extra": {
Expand Down
9 changes: 9 additions & 0 deletions config/cloud-tasks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

return [
'monitor' => [
'enabled' => env('CLOUD_TASKS_MONITOR_ENABLED', false),
],
];
4 changes: 4 additions & 0 deletions dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.DS_Store
dist-ssr
*.local
6 changes: 6 additions & 0 deletions dashboard/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
}
7 changes: 7 additions & 0 deletions dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Vue 3 + Vite

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
Loading