| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- name: Tests
- on:
- push:
- workflow_dispatch:
- jobs:
- Composer:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Validate composer.json and composer.lock
- run: composer validate
- - name: Install dependencies
- run: composer install --prefer-dist --no-dev
- PHPunit:
- runs-on: ubuntu-latest
- strategy:
- matrix:
- php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
- name: PHP ${{ matrix.php-versions }} unit tests on ${{ matrix.operating-system }}
- env:
- extensions: gd, sqlite3
- extensions-cache-key-name: phpextensions
- steps:
- # let's get started!
- - name: Checkout
- uses: actions/checkout@v4
- # cache PHP extensions
- - name: Setup cache environment
- id: extcache
- uses: shivammathur/cache-extensions@v1
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: ${{ env.extensions }}
- key: ${{ runner.os }}-${{ env.extensions-cache-key }}
- - name: Cache extensions
- uses: actions/cache@v3
- with:
- path: ${{ steps.extcache.outputs.dir }}
- key: ${{ steps.extcache.outputs.key }}
- restore-keys: ${{ runner.os }}-${{ env.extensions-cache-key }}
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: ${{ env.extensions }}
- # Setup GitHub CI PHP problem matchers
- # https://github.com/shivammathur/setup-php#problem-matchers
- - name: Setup problem matchers for PHP
- run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- - name: Setup problem matchers for PHPUnit
- run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- # composer cache
- - name: Remove composer lock
- run: rm composer.lock
- - name: Get composer cache directory
- id: composer-cache
- run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- # http://man7.org/linux/man-pages/man1/date.1.html
- # https://github.com/actions/cache#creating-a-cache-key
- - name: Get Date
- id: get-date
- run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
- shell: bash
- - name: Cache dependencies
- uses: actions/cache@v3
- with:
- path: ${{ steps.composer-cache.outputs.dir }}
- key: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/composer.json') }}
- restore-keys: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-
- # composer installation
- - name: Setup PHPunit
- run: composer install -n
- - name: Install Google Cloud Storage
- run: composer require google/cloud-storage
- # testing
- - name: Run unit tests
- run: ../vendor/bin/phpunit --no-coverage
- working-directory: tst
- Mocha:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Setup Node
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
- cache-dependency-path: 'js/package-lock.json'
- - name: Setup Mocha
- run: npm install -g mocha
- - name: Setup Node modules
- run: npm ci
- working-directory: js
- - name: Run unit tests
- run: npm test
- working-directory: js
|