Skip to content

5.x #175

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

Merged
merged 21 commits into from
Mar 9, 2025
Merged

5.x #175

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
35 changes: 35 additions & 0 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Code analysis

on:
push:
paths:
- '**.php'
- 'phpstan.neon'

permissions:
contents: write

jobs:
php-code-styling:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none

- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist

- name: Run code analysis
run: |
composer run larastan
28 changes: 28 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Code style

on:
push:
paths:
- '**.php'

permissions:
contents: write

jobs:
php-code-styling:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Check code style
uses: aglipanci/laravel-pint-action@v2

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply code style rules
29 changes: 19 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run tests

on:
pull_request_target:
types: [opened, synchronize, labeled]
types: [ opened, synchronize, labeled ]
schedule:
- cron: '0 0 * * *'

Expand Down Expand Up @@ -62,17 +62,22 @@ jobs:
needs: access_check
strategy:
matrix:
db: ['mysql', 'pgsql']
db:
- { driver: 'mysql', version: '8.0' }
- { driver: 'mysql', version: '8.4' }
- { driver: 'pgsql', version: '14' }
- { driver: 'pgsql', version: '15' }
- { driver: 'pgsql', version: '16' }
- { driver: 'pgsql', version: '17' }
payload:
- { queue: 'github-actions-laravel10-php84', laravel: '10.*', php: '8.4', 'testbench': '8.*'}
- { queue: 'github-actions-laravel10-php83', laravel: '10.*', php: '8.3', 'testbench': '8.*'}
- { queue: 'github-actions-laravel10-php82', laravel: '10.*', php: '8.2', 'testbench': '8.*'}
- { queue: 'github-actions-laravel10-php81', laravel: '10.*', php: '8.1', 'testbench': '8.*'}
- { queue: 'github-actions-laravel11-php82', laravel: '11.*', php: '8.2', 'testbench': '9.*' }
- { queue: 'github-actions-laravel11-php83', laravel: '11.*', php: '8.3', 'testbench': '9.*' }
- { queue: 'github-actions-laravel11-php84', laravel: '11.*', php: '8.4', 'testbench': '9.*' }
- { queue: 'github-actions-laravel12-php82', laravel: '12.*', php: '8.2', 'testbench': '10.*' }
- { queue: 'github-actions-laravel12-php83', laravel: '12.*', php: '8.3', 'testbench': '10.*' }
- { queue: 'github-actions-laravel12-php84', laravel: '12.*', php: '8.4', 'testbench': '10.*' }

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

steps:
- name: Checkout code
Expand All @@ -92,12 +97,16 @@ jobs:
CI_SERVICE_ACCOUNT_JSON_KEY: ${{ secrets.CI_SERVICE_ACCOUNT_JSON_KEY }}
run: |
touch .env
MYSQL_PORT=3307 POSTGRES_PORT=5432 docker compose up ${{ matrix.db }} -d
if [ "${{ matrix.db.driver }}" = "mysql" ]; then
MYSQL_PORT=3307 MYSQL_VERSION=${{ matrix.db.version }} docker compose up ${{ matrix.db.driver }} -d
elif [ "${{ matrix.db.driver }}" = "pgsql" ]; then
POSTGRES_PORT=5432 PGSQL_VERSION=${{ matrix.db.version }} docker compose up ${{ matrix.db.driver }} -d
fi
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.payload.laravel }}" "orchestra/testbench:${{ matrix.payload.testbench }}" --no-interaction --no-update
composer update --prefer-stable --prefer-dist --no-interaction
if [ "${{ matrix.db }}" = "mysql" ]; then
if [ "${{ matrix.db.driver }}" = "mysql" ]; then
while ! mysqladmin ping --host=127.0.0.1 --user=cloudtasks --port=3307 --password=cloudtasks --silent; do
echo "Waiting for MySQL..."
sleep 1
Expand All @@ -107,7 +116,7 @@ jobs:
fi
- name: Execute tests
env:
DB_DRIVER: ${{ matrix.db }}
DB_DRIVER: ${{ matrix.db.driver }}
DB_HOST: 127.0.0.1
CI_CLOUD_TASKS_PROJECT_ID: ${{ secrets.CI_CLOUD_TASKS_PROJECT_ID }}
CI_CLOUD_TASKS_QUEUE: ${{ secrets.CI_CLOUD_TASKS_QUEUE }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.idea/
.phpunit.result.cache
.phpunit.cache
.env
.env
/coverage
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@

<img src="/assets/logo.png" width="400">
# Cloud Tasks queue driver for Laravel

[![Run tests](https://github.com/stackkit/laravel-google-cloud-tasks-queue/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stackkit/laravel-google-cloud-tasks-queue/actions/workflows/run-tests.yml)
<a href="https://packagist.org/packages/stackkit/laravel-google-cloud-tasks-queue"><img src="https://poser.pugx.org/stackkit/laravel-google-cloud-tasks-queue/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/stackkit/laravel-google-cloud-tasks-queue"><img src="https://poser.pugx.org/stackkit/laravel-google-cloud-tasks-queue/downloads.svg" alt="Downloads"></a>

This package allows Google Cloud Tasks to be used as the queue driver.

<sub>Companion packages: <a href="https://github.com/stackkit/laravel-google-cloud-scheduler">Cloud Scheduler</a>, <a href="https://github.com/marickvantuil/laravel-google-cloud-logging">Cloud Logging</a></sub>

# Introduction
![Image](https://github.com/user-attachments/assets/d9af0938-43b7-407b-8791-83419420a62b)

This package allows Google Cloud Tasks to be used as the queue driver.

<p align="center">
<img src="/assets/cloud-tasks-home.png" width="100%">
</p>

### Requirements

This package requires Laravel 10 or 11.
This package requires Laravel 11 or 12.

### Installation

Require the package using Composer

```console
```shell
composer require stackkit/laravel-google-cloud-tasks-queue
```

Expand All @@ -45,6 +42,7 @@ Add a new queue connection to `config/queue.php`
'service_account_email' => env('CLOUD_TASKS_SERVICE_EMAIL', ''),

'backoff' => 0,
'after_commit' => false,
],
```

Expand Down Expand Up @@ -178,10 +176,6 @@ Cloud Tasks has it's own retry configuration options: maximum number of attempts

### Authentication

Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable with a path to the credentials file.

More info: https://cloud.google.com/docs/authentication/production

If you're not using your master service account (which has all abilities), you must add the following roles to make it
works:

Expand Down
12 changes: 12 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# From 4.x to 5.x

The package drops support for Laravel 10 and adds support for Laravel 12.

## Configuration type strictness (Impact: low)

The package now uses `config()->string()` and `config()->array()` to enforce receiving the correct types from the Laravel configuration file.

This should not give any problems but you should verify the configuration settings.

There are no other breaking changes.

# From 3.x to 4.x

## Renamed environment names (Impact: high)
Expand Down
Binary file removed assets/cloud-tasks-home.png
Binary file not shown.
Binary file removed assets/logo.png
Binary file not shown.
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
"require": {
"php": "^8.1",
"ext-json": "*",
"phpseclib/phpseclib": "^3.0",
"google/cloud-tasks": "^1.15|^2.0",
"thecodingmachine/safe": "^1.0|^2.0|^3.0"
"google/cloud-tasks": "^2.0",
"thecodingmachine/safe": "^3.0"
},
"require-dev": {
"orchestra/testbench": "^8.0",
"orchestra/testbench": "^10.0",
"thecodingmachine/phpstan-safe-rule": "^1.2",
"laravel/legacy-factories": "^1.3",
"laravel/pint": "^1.13",
"larastan/larastan": "^2.9"
"larastan/larastan": "^3.0"
},
"autoload": {
"psr-4": {
Expand All @@ -28,8 +26,7 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
"Factories\\": "factories/"
"Tests\\": "tests/"
}
},
"extra": {
Expand All @@ -42,8 +39,12 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"l10": [
"composer require laravel/framework:10.* orchestra/testbench:8.* --no-interaction --no-update",
"l11": [
"composer require laravel/framework:11.* orchestra/testbench:9.* --no-interaction --no-update",
"composer update --prefer-stable --prefer-dist --no-interaction"
],
"l12": [
"composer require laravel/framework:12.* orchestra/testbench:10.* --no-interaction --no-update",
"composer update --prefer-stable --prefer-dist --no-interaction"
],
"pint": [
Expand Down
Loading
Loading