diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 00000000..57623b3b --- /dev/null +++ b/.gitconfig @@ -0,0 +1,2 @@ +[safe] + directory = "*" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index fae48d5a..00000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,82 +0,0 @@ -name: Build - -on: - pull_request: ~ - push: ~ - -jobs: - check: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - - name: Validate composer.json - run: composer validate --strict --no-check-lock - cs-fixer: - runs-on: ubuntu-20.04 - name: PHP-CS-Fixer - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.3' - - run: composer install --prefer-dist --no-interaction --no-progress --ansi - - run: vendor/bin/php-cs-fixer fix --diff --dry-run --verbose - tests: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - include: - - description: 'Symfony 6.3 DEV' - php: '8.2' - symfony: '6.3.*@dev' - - description: 'Symfony 6.2' - php: '8.2' - symfony: '6.2.*' - - description: 'Symfony 6.0' - php: '8.1' - symfony: '6.0.*' - - description: 'Symfony 5.0' - php: '7.3' - symfony: '5.0.*' - - description: 'Symfony 4.4' - php: '7.1' - symfony: '4.3.*@dev' - - description: 'Symfony 3.4' - php: '7.3' - symfony: '3.4.*' - - description: 'Beta deps' - php: '7.2' - beta: true - name: PHP ${{ matrix.php }} tests (${{ matrix.description }}) - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Cache - uses: actions/cache@v3 - with: - path: ~/.composer/cache/files - key: composer-${{ matrix.php }}-${{ matrix.symfony }}-${{ matrix.composer_option }} - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - run: | - sed -ri 's/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony }}'"/' composer.json; - if: matrix.symfony - - run: | - composer config minimum-stability dev - composer config prefer-stable true - if: matrix.beta - - name: remove cs-fixer for Symfony 6 - if: contains(matrix.symfony, '6.3.*@dev') - run: | - composer remove --dev friendsofphp/php-cs-fixer pedrotroller/php-cs-custom-fixer --no-update - - run: composer update --prefer-dist --no-interaction --no-progress --ansi ${{ matrix.composer_option }} - - run: vendor/bin/phpunit - - run: vendor/bin/phpstan analyse --ansi --no-progress diff --git a/.github/workflows/split.yaml b/.github/workflows/split.yaml new file mode 100644 index 00000000..1bf6245d --- /dev/null +++ b/.github/workflows/split.yaml @@ -0,0 +1,75 @@ +--- +name: 'Packages Split' + +on: + push: + branches: + - v2-unstable-* + - v2-unstable # Remove before releasing v2 + - master + tags: + - '*' + +env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + +concurrency: + group: "Packages Split" + cancel-in-progress: false + +jobs: + sub_packages: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: + - path: 'src/Core' + remote: 'knplabs/snappy-core' + - path: 'src/Bundle' + remote: 'knplabs/snappy-bundle' + - path: 'src/Backend/WkHtmlToPdf' + remote: 'knplabs/snappy-wkhtmltopdf' + steps: + - run: | + git config --global user.name "knpEdgar" + git config --global user.email "hello@knplabs.com" + - uses: actions/checkout@v2 + with: + path: ./monolyth + - run: mkdir ./readonly + - run: mkdir ./build + - name: git clone + run: | + cd ./readonly + git clone -- https://${{ secrets.ACCESS_TOKEN }}@github.com/${{ matrix.package.remote }} . + git fetch + - name: cleanup + run: cp --verbose -ra ./readonly/.git ./build/.git + - run: cp --verbose -ra ./monolyth/${{ matrix.package.path }}/* ./build + - run: ls -la ./build + - name: git add . + id: git_status + run: | + cd ./build + git status --porcelain + echo "STATUS=$(git status --porcelain)" >> $GITHUB_OUTPUT + git add . --verbose + - name: git commit + if: ${{ '' != steps.git_status.outputs.STATUS }} + run: | + cd ./monolyth + COMMIT_MESSAGE=$(git show -s --format=%B ${GITHUB_SHA}) + cd ../build + git commit --message "$COMMIT_MESSAGE" + - name: git push + if: ${{ '' != steps.git_status.outputs.STATUS }} + run: | + cd ./build + git push --quiet origin main + - name: git tag + if: "startsWith(github.ref, 'refs/tags/')" + run: | + cd ./build + git tag %s -m "${GITHUB_REF#refs/tags/}" + git push --quiet origin "${GITHUB_REF#refs/tags/}" diff --git a/src/Core/FileToPdf.php b/src/Core/FileToPdf.php index 9cd2db76..1b20369d 100644 --- a/src/Core/FileToPdf.php +++ b/src/Core/FileToPdf.php @@ -6,5 +6,6 @@ interface FileToPdf { + public function generateFromFile(\SplFileInfo $file, \ArrayAccess|array $options = []): StreamInterface; }