Build #31
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: Build | |
on: | |
schedule: | |
- cron: '0 2 * * 0' # Weekly on Sundays at 02:00 | |
jobs: | |
php_unit_test: | |
runs-on: ubuntu-latest | |
name: PHP Unit Test with PHP version ${{ matrix.php-version }} | |
strategy: | |
matrix: | |
php-version: | |
- '7.2' | |
- '7.3' | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
- '8.2' | |
steps: | |
- name: Install php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: dom, mbstring | |
coverage: xdebug | |
- name: Checkout SDK | |
uses: actions/checkout@v1 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache Composer Downloads | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install | |
- name: Update environment file | |
run: | | |
cp .env.php.example .env.php | |
sed -i "s/'API_KEY' => ''/'API_KEY' => '${{ secrets.API_KEY }}'/g" .env.php | |
- name: Run PHPUnit tests | |
run: vendor/bin/phpunit --coverage-clover=coverage.xml | |
- if: matrix.php-version == '7.4' | |
name: Send clover to codecov | |
run: test -z "${{ secrets.CODECOV_TOKEN }}" || (bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} -f "*.php" -Z -R .) |