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
33 changes: 25 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,33 @@ on:

jobs:

composer-normalize:
name: Composer normalization
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
tools: composer-normalize
env:
fail-fast: true
- name: Composer normalize
run: composer-normalize --dry-run

phpcs:
name: Code Style (phpcs)
name: Coding standards (phpcs)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
coverage: none
tools: cs2pr, phpcs
env:
Expand All @@ -31,15 +48,15 @@ jobs:
run: phpcs -q --report=checkstyle | cs2pr

php-cs-fixer:
name: Code style (php-cs-fixer)
name: Coding standards (php-cs-fixer)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
coverage: none
tools: cs2pr, php-cs-fixer
env:
Expand All @@ -56,7 +73,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
coverage: none
tools: composer:v2, phpstan
env:
Expand All @@ -80,15 +97,15 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version: ['8.2', '8.3']
php-version: ['8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
coverage: none
tools: composer:v2
env:
fail-fast: true
Expand All @@ -104,4 +121,4 @@ jobs:
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Tests (phpunit)
run: vendor/bin/phpunit --testsuite=complete --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
run: vendor/bin/phpunit --testsuite=complete --testdox
42 changes: 42 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: docker
on:
release:
branches: [ "main" ]
types: [ "published" ]
tags: [ "v*" ]

# Actions
# docker/setup-buildx-action@v3 https://github.com/marketplace/actions/docker-setup-buildx
# docker/login-action@v3 https://github.com/marketplace/actions/docker-login
# docker/metadata-action@v5 https://github.com/marketplace/actions/docker-metadata-action
# docker/build-push-action@v6 https://github.com/marketplace/actions/build-and-push-docker-images

jobs:
docker:
name: Docker image
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set application version
run: sed -i "s#@box_git_version@#${{ github.ref_name }}#" bin/*
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: "${{ github.repository }}"
tags: "type=semver,pattern={{version}}"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
109 changes: 0 additions & 109 deletions .github/workflows/sonarcloud.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/sonarqube-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "SonarQube Cloud"
on:
workflow_dispatch:
push:
branches: [ "main" ]

# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
# SonarSource/sonarqube-scan-action@v6 https://github.com/marketplace/actions/official-sonarqube-scan

jobs:

sonarqube-cloud:
name: SonarCloud Scan and Report
runs-on: "ubuntu-latest"
steps:
- name: Check SONAR_TOKEN secret
run: |
if [ -z "${{ secrets.SONAR_TOKEN }}" ]; then
echo "::warning ::SONAR_TOKEN non set"
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
- name: Unshallow clone to provide blame information
run: git fetch --unshallow
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: xdebug
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Create code coverage
run: vendor/bin/phpunit --testdox --testsuite=complete --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
- name: Prepare SonarCloud Code Coverage Files
run: |
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version: ['8.2', '8.3']
php-version: ['8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
10 changes: 5 additions & 5 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.64.0" installed="3.64.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.10.2" installed="3.10.2" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.2" installed="3.10.2" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^1.12.3" installed="1.12.3" location="./tools/phpstan" copy="false"/>
<phar name="composer-normalize" version="^2.43.0" installed="2.43.0" location="./tools/composer-normalize" copy="false"/>
<phar name="composer-normalize" version="^2.48.2" installed="2.48.2" location="./tools/composer-normalize" copy="false"/>
<phar name="php-cs-fixer" version="^3.89.2" installed="3.89.2" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^4.0.1" installed="4.0.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^4.0.1" installed="4.0.1" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^2.1.32" nstalled="2.1.32" location="./tools/phpstan" copy="false"/>
</phive>
10 changes: 6 additions & 4 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP82Migration' => true,
'@PHP80Migration:risky' => true,
'@PHP8x2Migration' => true,
'@PHP8x2Migration:risky' => true,
// symfony
'array_indentation' => true,
'class_attributes_separation' => true,
'whitespace_after_comma_in_array' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'type_declaration_spaces' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']],
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'arguments', 'parameters']],
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'binary_operator_spaces' => true,
Expand All @@ -37,6 +38,7 @@
'concat_space' => ['spacing' => 'one'],
'linebreak_after_opening_tag' => true,
'fully_qualified_strict_types' => true,
'global_namespace_import' => ['import_classes' => true],
// symfony:risky
'no_alias_functions' => true,
'self_accessor' => true,
Expand All @@ -48,6 +50,6 @@
PhpCsFixer\Finder::create()
->in(__DIR__)
->append([__FILE__])
->exclude(['tools', 'vendor', 'build'])
->exclude(['tools', 'vendor', 'build']),
)
;
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM php:8.3-cli-alpine
FROM php:8.4-cli-alpine

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

# install dependencies for php modules
RUN set -e \
&& apk add git libzip-dev \
&& docker-php-ext-install zip
&& docker-php-ext-install zip \
&& apk del libzip-dev

# set up php
RUN set -e \
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

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

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