Skip to content

Commit 728dec6

Browse files
authored
Merge pull request #7 from eclipxe13/version-4.0.1
Uso de PHP 8.4, Docker Hub y mantenimiento (versión 4.0.1)
2 parents 9ef4596 + 0096c41 commit 728dec6

File tree

18 files changed

+207
-166
lines changed

18 files changed

+207
-166
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,33 @@ on:
1313

1414
jobs:
1515

16+
composer-normalize:
17+
name: Composer normalization
18+
runs-on: "ubuntu-latest"
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: '8.4'
26+
coverage: none
27+
tools: composer-normalize
28+
env:
29+
fail-fast: true
30+
- name: Composer normalize
31+
run: composer-normalize --dry-run
32+
1633
phpcs:
17-
name: Code Style (phpcs)
34+
name: Coding standards (phpcs)
1835
runs-on: "ubuntu-latest"
1936
steps:
2037
- name: Checkout
2138
uses: actions/checkout@v4
2239
- name: Setup PHP
2340
uses: shivammathur/setup-php@v2
2441
with:
25-
php-version: '8.3'
42+
php-version: '8.4'
2643
coverage: none
2744
tools: cs2pr, phpcs
2845
env:
@@ -31,15 +48,15 @@ jobs:
3148
run: phpcs -q --report=checkstyle | cs2pr
3249

3350
php-cs-fixer:
34-
name: Code style (php-cs-fixer)
51+
name: Coding standards (php-cs-fixer)
3552
runs-on: "ubuntu-latest"
3653
steps:
3754
- name: Checkout
3855
uses: actions/checkout@v4
3956
- name: Setup PHP
4057
uses: shivammathur/setup-php@v2
4158
with:
42-
php-version: '8.3'
59+
php-version: '8.4'
4360
coverage: none
4461
tools: cs2pr, php-cs-fixer
4562
env:
@@ -56,7 +73,7 @@ jobs:
5673
- name: Setup PHP
5774
uses: shivammathur/setup-php@v2
5875
with:
59-
php-version: '8.3'
76+
php-version: '8.4'
6077
coverage: none
6178
tools: composer:v2, phpstan
6279
env:
@@ -80,15 +97,15 @@ jobs:
8097
runs-on: "ubuntu-latest"
8198
strategy:
8299
matrix:
83-
php-version: ['8.2', '8.3']
100+
php-version: ['8.2', '8.3', '8.4']
84101
steps:
85102
- name: Checkout
86103
uses: actions/checkout@v4
87104
- name: Setup PHP
88105
uses: shivammathur/setup-php@v2
89106
with:
90107
php-version: ${{ matrix.php-version }}
91-
coverage: xdebug
108+
coverage: none
92109
tools: composer:v2
93110
env:
94111
fail-fast: true
@@ -104,4 +121,4 @@ jobs:
104121
- name: Install project dependencies
105122
run: composer upgrade --no-interaction --no-progress --prefer-dist
106123
- name: Tests (phpunit)
107-
run: vendor/bin/phpunit --testsuite=complete --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
124+
run: vendor/bin/phpunit --testsuite=complete --testdox

.github/workflows/docker.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: docker
2+
on:
3+
release:
4+
branches: [ "main" ]
5+
types: [ "published" ]
6+
tags: [ "v*" ]
7+
8+
# Actions
9+
# docker/setup-buildx-action@v3 https://github.com/marketplace/actions/docker-setup-buildx
10+
# docker/login-action@v3 https://github.com/marketplace/actions/docker-login
11+
# docker/metadata-action@v5 https://github.com/marketplace/actions/docker-metadata-action
12+
# docker/build-push-action@v6 https://github.com/marketplace/actions/build-and-push-docker-images
13+
14+
jobs:
15+
docker:
16+
name: Docker image
17+
runs-on: "ubuntu-latest"
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Set application version
22+
run: sed -i "s#@box_git_version@#${{ github.ref_name }}#" bin/*
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: Login to Docker Hub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKERHUB_USERNAME }}
29+
password: ${{ secrets.DOCKERHUB_TOKEN }}
30+
- name: Extract metadata for Docker
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: "${{ github.repository }}"
35+
tags: "type=semver,pattern={{version}}"
36+
- name: Build and push
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/sonarcloud.yml

Lines changed: 0 additions & 109 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "SonarQube Cloud"
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ "main" ]
6+
7+
# Actions
8+
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
9+
# SonarSource/sonarqube-scan-action@v6 https://github.com/marketplace/actions/official-sonarqube-scan
10+
11+
jobs:
12+
13+
sonarqube-cloud:
14+
name: SonarCloud Scan and Report
15+
runs-on: "ubuntu-latest"
16+
steps:
17+
- name: Check SONAR_TOKEN secret
18+
run: |
19+
if [ -z "${{ secrets.SONAR_TOKEN }}" ]; then
20+
echo "::warning ::SONAR_TOKEN non set"
21+
exit 1
22+
fi
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Unshallow clone to provide blame information
26+
run: git fetch --unshallow
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.4'
31+
coverage: xdebug
32+
tools: composer:v2
33+
- name: Get composer cache directory
34+
id: composer-cache
35+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
36+
- name: Cache dependencies
37+
uses: actions/cache@v4
38+
with:
39+
path: ${{ steps.composer-cache.outputs.dir }}
40+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
41+
restore-keys: ${{ runner.os }}-composer-
42+
- name: Install project dependencies
43+
run: composer upgrade --no-interaction --no-progress --prefer-dist
44+
- name: Create code coverage
45+
run: vendor/bin/phpunit --testdox --testsuite=complete --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
46+
- name: Prepare SonarCloud Code Coverage Files
47+
run: |
48+
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
49+
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
50+
- name: SonarCloud Scan
51+
uses: SonarSource/sonarqube-scan-action@v6
52+
env:
53+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/system.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: "ubuntu-latest"
2020
strategy:
2121
matrix:
22-
php-version: ['8.2', '8.3']
22+
php-version: ['8.2', '8.3', '8.4']
2323
steps:
2424
- name: Checkout
2525
uses: actions/checkout@v4

.phive/phars.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^3.64.0" installed="3.64.0" location="./tools/php-cs-fixer" copy="false"/>
4-
<phar name="phpcs" version="^3.10.2" installed="3.10.2" location="./tools/phpcs" copy="false"/>
5-
<phar name="phpcbf" version="^3.10.2" installed="3.10.2" location="./tools/phpcbf" copy="false"/>
6-
<phar name="phpstan" version="^1.12.3" installed="1.12.3" location="./tools/phpstan" copy="false"/>
7-
<phar name="composer-normalize" version="^2.43.0" installed="2.43.0" location="./tools/composer-normalize" copy="false"/>
3+
<phar name="composer-normalize" version="^2.48.2" installed="2.48.2" location="./tools/composer-normalize" copy="false"/>
4+
<phar name="php-cs-fixer" version="^3.89.2" installed="3.89.2" location="./tools/php-cs-fixer" copy="false"/>
5+
<phar name="phpcs" version="^4.0.1" installed="4.0.1" location="./tools/phpcs" copy="false"/>
6+
<phar name="phpcbf" version="^4.0.1" installed="4.0.1" location="./tools/phpcbf" copy="false"/>
7+
<phar name="phpstan" version="^2.1.32" nstalled="2.1.32" location="./tools/phpstan" copy="false"/>
88
</phive>

.php-cs-fixer.dist.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
->setRules([
1616
'@PSR12' => true,
1717
'@PSR12:risky' => true,
18-
'@PHP82Migration' => true,
19-
'@PHP80Migration:risky' => true,
18+
'@PHP8x2Migration' => true,
19+
'@PHP8x2Migration:risky' => true,
2020
// symfony
21+
'array_indentation' => true,
2122
'class_attributes_separation' => true,
2223
'whitespace_after_comma_in_array' => true,
2324
'no_empty_statement' => true,
2425
'no_extra_blank_lines' => true,
2526
'type_declaration_spaces' => true,
26-
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']],
27+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'arguments', 'parameters']],
2728
'no_blank_lines_after_phpdoc' => true,
2829
'object_operator_without_whitespace' => true,
2930
'binary_operator_spaces' => true,
@@ -37,6 +38,7 @@
3738
'concat_space' => ['spacing' => 'one'],
3839
'linebreak_after_opening_tag' => true,
3940
'fully_qualified_strict_types' => true,
41+
'global_namespace_import' => ['import_classes' => true],
4042
// symfony:risky
4143
'no_alias_functions' => true,
4244
'self_accessor' => true,
@@ -48,6 +50,6 @@
4850
PhpCsFixer\Finder::create()
4951
->in(__DIR__)
5052
->append([__FILE__])
51-
->exclude(['tools', 'vendor', 'build'])
53+
->exclude(['tools', 'vendor', 'build']),
5254
)
5355
;

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
FROM php:8.3-cli-alpine
1+
FROM php:8.4-cli-alpine
22

33
COPY . /opt/sat-pys-scraper
44
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
55

66
# install dependencies for php modules
77
RUN set -e \
88
&& apk add git libzip-dev \
9-
&& docker-php-ext-install zip
9+
&& docker-php-ext-install zip \
10+
&& apk del libzip-dev
1011

1112
# set up php
1213
RUN set -e \

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 - 2024 PhpCfdi https://www.phpcfdi.com/
3+
Copyright (c) 2023 - 2025 PhpCfdi https://www.phpcfdi.com/
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)