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
28 changes: 19 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- '*'

permissions: {}

concurrency:
group: global
cancel-in-progress: false

jobs:
latest:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # required for gh release

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
with:
php-version: '7.4'
tools: composer:v2
Expand All @@ -33,7 +40,10 @@ jobs:
- name: Generate phar
run: make dist

- name: Release
uses: softprops/action-gh-release@v1
with:
files: dist/roger-q.phar
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" ./dist/roger-q.phar \
--title "$GITHUB_REF_NAME" \
--notes "Stable release."
14 changes: 12 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ on:
- '*.x'
pull_request:

permissions: {}

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

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
Expand All @@ -26,7 +34,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: GitHub Actions Security Analysis with zizmor 🌈

# to upgrade repository actions with a new hash, either manually look up the hash in their releases,
# or run zizmor --fix with the --gh-token parameter to have it fetch those hashes from GitHub.

on:
push:
branches: ["main"]
pull_request:
branches: ["**"]

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

permissions: {}

jobs:
zizmor:
name: Run zizmor 🌈
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Run zizmor 🌈
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
6 changes: 3 additions & 3 deletions src/Command/Dedupe.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{
/** @var string[] $fields */
$fields = $input->getArgument('field');
\assert(\is_array($fields));

Check failure on line 30 in src/Command/Dedupe.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to function is_array() with array<string> will always evaluate to true.

Check failure on line 30 in src/Command/Dedupe.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to function assert() with true will always evaluate to true.

$data = $this->readStdin();
$messages = Json::decode($data, true);
Expand All @@ -46,7 +46,7 @@
$output->writeln(Json::encode($cleanMessages));

if ($output instanceof ConsoleOutputInterface && $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$output->getErrorOutput()->writeln(sprintf(
$output->getErrorOutput()->writeln(\sprintf(
'Removed <info>%d</info> duplicated messages out of <info>%d</info> total messages, resulting in <info>%d</info> messages',
$removedMessagesCount,
\count($messages),
Expand Down Expand Up @@ -79,15 +79,15 @@
private function isDuplicatedMessage(array $fields, array $message, array &$seenValues, int $messageNum): bool
{
if (!\array_key_exists('payload', $message)) {
throw new \UnexpectedValueException(sprintf('Message #%d does not have a payload (%s)', $messageNum, Json::encode($message)));
throw new \UnexpectedValueException(\sprintf('Message #%d does not have a payload (%s)', $messageNum, Json::encode($message)));
}

$payload = Json::decode($message['payload'], true);

// Check that all given fields exist in the payload:
foreach ($fields as $field) {
if (!\array_key_exists($field, $payload)) {
throw new \UnexpectedValueException(sprintf('Payload of message #%d does not have the required fields %s (%s)', $messageNum, implode(',', $fields), $message['payload']));
throw new \UnexpectedValueException(\sprintf('Payload of message #%d does not have the required fields %s (%s)', $messageNum, implode(',', $fields), $message['payload']));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Command/Dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$data['count'] = \PHP_INT_MAX;
}

$response = $guzzle->request('POST', sprintf('/api/queues/%s/%s/get', $vHost, $queueName), [
$response = $guzzle->request('POST', \sprintf('/api/queues/%s/%s/get', $vHost, $queueName), [
RequestOptions::HEADERS => [
'Accept-Encoding' => 'gzip',
'Transfer-Encoding' => 'chunked',
Expand All @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($output instanceof ConsoleOutputInterface && $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$output->getErrorOutput()->writeln(sprintf(
$output->getErrorOutput()->writeln(\sprintf(
'Dumped <info>%s</info> bytes (gzip) from queue <info>%s</info>',
$response->hasHeader('x-encoded-content-length') ? $response->getHeaderLine('x-encoded-content-length') : 'unspecified',
$queueName
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($output instanceof ConsoleOutputInterface && $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$output->getErrorOutput()->writeln(sprintf(
$output->getErrorOutput()->writeln(\sprintf(
'Published <info>%s</info> messages to queue <info>%s</info>',
\count($messages),
$queueName
Expand Down