Skip to content

Commit

Permalink
Merge pull request #53 from getkirby/develop
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
bastianallgeier authored Dec 21, 2023
2 parents 0e8074b + 2332060 commit 1d6d72f
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 108 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ jobs:
timeout-minutes: 5
strategy:
matrix:
php: ["8.0", "8.1", "8.2"]
php: ["8.1", "8.2", "8.3"]
env:
extensions: mbstring, pcov
ini: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""

steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3

- name: Setup PHP cache environment
id: ext-cache
uses: shivammathur/cache-extensions@fc01a9cdc93341e96c2078d848f2e96240d83c17 # pin@v1
uses: shivammathur/cache-extensions@d622719c5f9eb1f119bee963028d0c0b984525c5 # pin@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
key: php-v1

- name: Cache PHP extensions
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # pin@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin@v3
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # pin@v2
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # pin@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
Expand All @@ -52,7 +52,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # pin@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin@v3
with:
path: ${{ steps.composerCache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -63,15 +63,14 @@ jobs:

- name: Cache analysis data
id: finishPrepare
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # pin@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin@v3
with:
path: ~/.cache/psalm
key: backend-analysis-${{ matrix.php }}-v2

- name: Run tests
if: always() && steps.finishPrepare.outcome == 'success'
run: phpunit --coverage-clover ${{ github.workspace }}/clover.xml

# - name: Statically analyze using Psalm
# if: always() && steps.finishPrepare.outcome == 'success'
# run: psalm --output-format=github --php-version=${{ matrix.php }}
Expand All @@ -91,31 +90,31 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
php: "8.0"
php: "8.1"
extensions: mbstring

steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3

- name: Setup PHP cache environment
id: ext-cache
uses: shivammathur/cache-extensions@fc01a9cdc93341e96c2078d848f2e96240d83c17 # pin@v1
uses: shivammathur/cache-extensions@d622719c5f9eb1f119bee963028d0c0b984525c5 # pin@v1
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
key: php-v1

- name: Cache PHP extensions
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # pin@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin@v3
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
id: finishPrepare
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # pin@v2
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # pin@v2
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
Expand All @@ -140,7 +139,7 @@ jobs:
- name: Cache dependencies
id: composerCache2
if: always() && steps.composerCache1.outcome == 'success'
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # pin@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin@v3
with:
path: ${{ steps.composerCache1.outputs.dir }}
key: ${{ runner.os }}-composer-locked-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -171,17 +170,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3

- name: Setup PHP environment
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # pin@v2
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # pin@v2
with:
coverage: none
tools: php-cs-fixer:3.8.0

- name: Cache analysis data
id: finishPrepare
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # pin@v3
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin@v3
with:
path: ~/.php-cs-fixer
key: coding-style
Expand All @@ -192,14 +191,12 @@ jobs:
PHP_CS_FIXER_IGNORE_ENV: 1
# Use the --dry-run flag in push builds to get a failed CI status
run: >
php-cs-fixer fix --diff
${{ github.event_name != 'pull_request' && '--dry-run' || '' }}
php-cs-fixer fix --diff ${{ github.event_name != 'pull_request' && '--dry-run' || '' }}
- name: Create code suggestions from the coding style changes (on PR only)
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@ab82daa6ea9b84fe43db7747bb10fa087f34e1ab # pin@v1
always() && steps.finishPrepare.outcome == 'success' && github.event_name == 'pull_request'
uses: reviewdog/action-suggester@94877e550e6b522dc1d21231974b645ff2f084ce # pin@v1
with:
tool_name: PHP-CS-Fixer
fail_on_error: "true"
9 changes: 9 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ function index(): string|null
];

foreach ($locations as $location) {
// try to find the index.php in current working directory
$index = realpath(getcwd() . '/' . $location . '/index.php');

if ($index !== false) {
return $index;
}

// try to find the index.php from the (possible) root of the project
// in the __ROOT__ <- /vendor/getkirby/cli directory
$index = realpath(dirname(__DIR__, 3) . '/' . $location . '/index.php');

if ($index !== false) {
return $index;
}
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion commands/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
try {
if ($total > 0 && $downloaded > 0) {
$progress->total($total);
$progress->current($downloaded);
$progress->current($downloaded, '');
}
} catch (Throwable $e) {
$cli->out($e->getMessage());
Expand Down
4 changes: 2 additions & 2 deletions commands/install/repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
$zip = $cli->dir() . '/' . $folder . '-' . time() . '.zip';
$dir = $cli->dir() . '/' . $folder;

$cli->confirmToDelete($zip, 'The zip file existst. Do you want to delete it?');
$cli->confirmToDelete($dir, 'The directory existst. Do you want to delete it?');
$cli->confirmToDelete($zip, 'The zip file exists. Do you want to delete it?');
$cli->confirmToDelete($dir, 'The directory exists. Do you want to delete it?');

// download the zip file
$cli->run('download', $url, $zip);
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "getkirby/cli",
"description": "Kirby command line interface",
"license": "MIT",
"version": "1.1.1",
"version": "1.2.0",
"keywords": [
"kirby",
"cms",
Expand All @@ -24,11 +24,11 @@
"source": "https://github.com/getkirby/cli"
},
"require": {
"php": ">=8.0.0 <8.3.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-zip": "*",
"composer-runtime-api": "^2.2",
"guzzlehttp/guzzle": "^7.5",
"league/climate": "^3.8"
"guzzlehttp/guzzle": "^7.8",
"league/climate": "^3.8.2"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 1d6d72f

Please sign in to comment.