Skip to content

Commit 1a16670

Browse files
committed
fix #4 : use float instead of string for fps when present
1 parent c258aa5 commit 1a16670

6 files changed

Lines changed: 74 additions & 50 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
name: Lint
1+
name: Coding standards
22
on: [push]
33
jobs:
44
lint:
5-
name: PHP Lint
5+
name: Coding standards
66
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
php: [ '8.2', '8.3' ]
11+
712
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
816
- name: Setup PHP
917
uses: shivammathur/setup-php@v2
1018
with:
11-
php-version: 8.1
19+
php-version: ${{ matrix.php }}
20+
tools: composer:v2
21+
22+
- name: Setup cache
23+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
1224

13-
- name: Cache Composer dependencies
25+
- name: Cache dependencies installed with composer
1426
uses: actions/cache@v2
1527
with:
16-
path: /tmp/composer-cache
17-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
28+
path: ${{ env.COMPOSER_CACHE_DIR }}
29+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
30+
restore-keys: |
31+
php${{ matrix.php }}-composer-latest-
32+
33+
- name: Update composer
34+
run: composer self-update
35+
36+
- name: Install dependencies with composer
37+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
1838

19-
- uses: actions/checkout@master
20-
- name: lint
39+
- name: Run code quality analysis
2140
run: make lint

.github/workflows/test.yaml

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
name: Test
1+
name: Tests
22
on: [push]
33
jobs:
4-
lint:
5-
name: PHP Test
6-
runs-on: ubuntu-latest
7-
steps:
8-
- name: Setup PHP
9-
uses: shivammathur/setup-php@v2
10-
with:
11-
php-version: 8.1
4+
test:
5+
name: Tests
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
php: [ '8.2', '8.3' ]
1211

13-
- name: Cache Composer dependencies
14-
uses: actions/cache@v2
15-
with:
16-
path: /tmp/composer-cache
17-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
1815

19-
- uses: actions/checkout@master
20-
- name: test
21-
run: make test
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php }}
20+
tools: composer:v2
21+
22+
- name: Setup cache
23+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
24+
25+
- name: Cache dependencies installed with composer
26+
uses: actions/cache@v2
27+
with:
28+
path: ${{ env.COMPOSER_CACHE_DIR }}
29+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
30+
restore-keys: |
31+
php${{ matrix.php }}-composer-latest-
32+
33+
- name: Update composer
34+
run: composer self-update
35+
36+
- name: Install dependencies with composer
37+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
38+
39+
- name: Run tests
40+
run: make test

Makefile

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
.DEFAULT_GOAL := help
22

3-
# -----------------------------------
4-
# Variables
5-
# -----------------------------------
6-
is_docker := $(shell docker info > /dev/null 2>&1 && echo 1)
7-
user := $(shell id -u)
8-
group := $(shell id -g)
9-
10-
ifeq ($(is_docker), 1)
11-
php := USER_ID=$(user) GROUP_ID=$(group) docker-compose run --rm --no-deps php
12-
composer := $(php) composer
13-
else
14-
php := php
15-
composer := composer
16-
endif
17-
183
# -----------------------------------
194
# Recipes
205
# -----------------------------------
@@ -24,17 +9,17 @@ help: ## affiche cet aide
249

2510
.PHONY: lint
2611
lint: vendor/autoload.php ## affiche les erreurs de formatage de code
27-
$(php) vendor/bin/ecs
28-
$(php) vendor/bin/phpstan
12+
php vendor/bin/ecs
13+
php vendor/bin/phpstan
2914

3015
.PHONY: test
3116
test: vendor/autoload.php ## lance les tests
32-
$(php) vendor/bin/phpunit
17+
php vendor/bin/phpunit
3318

3419
.PHONY: lint-fix
3520
lint-fix: vendor/autoload.php ## corrige les erreurs de formatage de code
36-
$(php) vendor/bin/ecs --fix
21+
php vendor/bin/ecs --fix
3722

3823
vendor/autoload.php: composer.lock # installe les dépendances PHP
39-
$(composer) update
40-
$(composer) dump-autoload
24+
composer update
25+
composer dump-autoload

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"symfony/var-dumper": "^6.1|^7.0"
3535
},
3636
"require": {
37-
"php": ">=8.1",
37+
"php": ">=8.2",
3838
"symfony/http-client": "^6.1|^7.0",
3939
"symfony/serializer": "^6.1|^7.0",
4040
"symfony/property-access": "^6.1|^7.0",

src/Data/VideoFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final class VideoFile
4646
public string $link;
4747

4848
/**
49-
* @var string|null frame rate of the video_file.
49+
* @var float|null frame rate of the video_file.
5050
*/
51-
public ?string $fps = null;
51+
public ?float $fps = null;
5252
}

tests/responses/video.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"file_type": "video/mp4",
1818
"width": 1080,
1919
"height": 1920,
20-
"link": "https://player.vimeo.com/external/342571552.hd.mp4?s=6aa6f164de3812abadff3dde86d19f7a074a8a66&profile_id=175&oauth2_token_id=57447761"
20+
"link": "https://player.vimeo.com/external/342571552.hd.mp4?s=6aa6f164de3812abadff3dde86d19f7a074a8a66&profile_id=175&oauth2_token_id=57447761",
21+
"fps": 30
2122
},
2223
{
2324
"id": 125005,

0 commit comments

Comments
 (0)