feat(composer): Add lint command #267
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Tests | |
on: [push,pull_request] | |
permissions: | |
contents: read | |
jobs: | |
symfony-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
typesense-version: [ 0.23.1 ] | |
steps: | |
- name: Start Typesense | |
uses: jirevwe/typesense-github-action@v1.0.1 | |
with: | |
typesense-version: ${{ matrix.typesense-version }} | |
typesense-api-key: xyz | |
- name: Curl Typesense | |
run: | | |
max_retries=10 | |
attempt=0 | |
until curl --silent --fail http://localhost:8108/health; do | |
attempt=$((attempt + 1)) | |
if [ "$attempt" -ge "$max_retries" ]; then | |
echo "Typesense service did not respond after $max_retries attempts. Exiting." | |
exit 1 | |
fi | |
sleep 1 | |
done | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- uses: actions/checkout@v3 | |
- name: Copy .env.test.local | |
run: | | |
php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');" | |
echo "KEPUBIFY_BIN=/usr/local/bin/kepubify" >> .env.test.local | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Cache kepubify | |
id: kepubify-cache-restore | |
uses: actions/cache@v3 | |
with: | |
path: /usr/local/bin/kepubify | |
key: ${{ runner.os }}-kepubify-cache | |
- name: Install kepubify | |
if: steps.kepubify-cache-restore.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p /usr/local/bin/ | |
# Install kepubify (from https://github.com/linuxserver/docker-calibre-web/blob/master/Dockerfile) | |
KEPUBIFY_RELEASE=$(curl -sX GET "https://api.github.com/repos/pgaskin/kepubify/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]'); | |
curl -o /usr/local/bin/kepubify -L https://github.com/pgaskin/kepubify/releases/download/${KEPUBIFY_RELEASE}/kepubify-linux-64bit | |
chmod +x /usr/local/bin/kepubify | |
- name: Cache kepubify | |
uses: actions/cache/save@v4 | |
if: steps.kepubify-cache-restore.outputs.cache-hit != 'true' | |
id: kepubify-cache-save | |
with: | |
path: /usr/local/bin/kepubify | |
key: ${{ runner.os }}-kepubify-cache | |
- name: Create Database | |
run: | | |
mkdir -p data | |
touch data/database.sqlite | |
- name: Execute tests | |
env: | |
DATABASE_URL: sqlite:///%kernel.project_dir%/data/database.sqlite | |
run: | | |
npm i | |
npm run build | |
composer test |