Use public release of kjblocks #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP tests | |
on: [push, pull_request] | |
jobs: | |
php-lint: | |
name: PHP Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Run PHP 7.1 | |
uses: prestashop/github-action-php-lint/7.1@master | |
- name: Run PHP 7.2 | |
uses: prestashop/github-action-php-lint/7.2@master | |
- name: Run PHP 7.3 | |
uses: prestashop/github-action-php-lint/7.3@master | |
- name: Run PHP 7.4 | |
uses: prestashop/github-action-php-lint/7.4@master | |
php-cs-fixer: | |
name: PHP-CS-Fixer | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup composer | |
uses: ./.github/actions/setup-composer | |
- name: Run PHP-CS-Fixer | |
run: | | |
cd ${{ github.workspace }} | |
./vendor/bin/php-cs-fixer --version | |
./vendor/bin/php-cs-fixer fix --dry-run --diff --config="tests/php/.php-cs-fixer.dist.php" | |
phpstan: | |
name: PHPStan | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
presta-versions: ["1.7.8.0", "latest"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup composer | |
uses: ./.github/actions/setup-composer | |
- name: Cache PrestaShop source code | |
id: cache_prestashop_source | |
uses: actions/cache@v3 | |
with: | |
path: ${{ runner.temp }}/prestashop/ | |
key: ${{ runner.os }}-${{ matrix.presta-versions }} | |
- name: Get latest PrestaShop version | |
run: | | |
echo "LATEST_VERSION=$(curl -sL https://api.github.com/repos/PrestaShop/PrestaShop/releases/latest | jq -r ".tag_name")" >> $GITHUB_ENV | |
- name: Set PrestaShop version | |
run: | | |
echo "VERSION=$( \ | |
[[ ${{ matrix.presta-versions }} == "latest" ]] \ | |
&& echo "${{ env.LATEST_VERSION }}" \ | |
|| echo "${{ matrix.presta-versions }}" \ | |
)" >> $GITHUB_ENV | |
- name: Extract PrestaShop | |
if: steps.cache_prestashop_source.outputs.cache-hit != 'true' | |
run: | | |
echo "no cache for Prestashop ${{ env.VERSION }} source. Fectching and extracting source code..." | |
wget https://github.com/PrestaShop/PrestaShop/releases/download/${{ env.VERSION }}/prestashop_${{ env.VERSION }}.zip \ | |
--quiet --output-document ${{ runner.temp }}/prestashop.zip | |
unzip -q ${{ runner.temp }}/prestashop.zip -d ${{ runner.temp }}/prestashop_zip | |
unzip -q ${{ runner.temp }}/prestashop_zip/prestashop.zip -d ${{ runner.temp }}/prestashop | |
- name: Extract kjblocks | |
if: steps.cache_prestashop_source.outputs.cache-hit != 'true' | |
run: | | |
echo "no cache for kjblocks source. Fetching and extracting source code..." | |
wget https://github.com/Kaudaj/kjblocks/releases/download/v1.0.0/kjblocks.zip \ | |
--quiet --output-document ${{ runner.temp }}/kjblocks.zip | |
unzip -q ${{ runner.temp }}/kjblocks.zip -d ${{ runner.temp }}/kjblocks_zip | |
mv ${{ runner.temp }}/kjblocks_zip/kjblocks ${{ runner.temp }}/prestashop/modules | |
- name: Move repository to PrestaShop environment | |
run: | | |
rm -rf ${{ runner.temp }}/prestashop/modules/${{ github.event.repository.name }} | |
cd .. | |
mv ${{ github.event.repository.name }} ${{ runner.temp }}/prestashop/modules/${{ github.event.repository.name }} | |
ln -s ${{ runner.temp }}/prestashop/modules/${{ github.event.repository.name }} | |
cd ${{ github.event.repository.name }} | |
- name: Run PHPStan | |
run: _PS_ROOT_DIR_=${{ runner.temp }}/prestashop/ php ./vendor/bin/phpstan analyse --configuration=tests/php/phpstan.dist.neon |