name: PHP Composer

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    
    - uses: shivammathur/setup-php@v2
      with:
        php-version: '7.3'
        tools: pecl
        extensions: geoip

    - name: Validate composer.json and composer.lock
      run: composer validate --strict

    - name: Cache Composer packages
      id: composer-cache
      uses: actions/cache@v2
      with:
        path: vendor
        key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
        restore-keys: |
          ${{ runner.os }}-php-

    - name: Install dependencies
      run: composer install --prefer-dist --no-progress

    - name: Run test suite
      run: export vatlayer_api_key=${{ secrets.VATLAYER_API_KEY }}; export hmrc_use_live_api=false; ./vendor/bin/phpunit tests/

name: PHP Composer

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    
    - uses: shivammathur/setup-php@v2
      with:
        php-version: '7.3'
        tools: pecl
        extensions: geoip

    - name: Validate composer.json and composer.lock
      run: composer validate --strict

    - name: Cache Composer packages
      id: composer-cache
      uses: actions/cache@v2
      with:
        path: vendor
        key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
        restore-keys: |
          ${{ runner.os }}-php-

    - name: Install dependencies
      run: composer install --prefer-dist --no-progress

    - name: Run test suite
      run: ./vendor/bin/phpunit tests/
      env:
          vatlayer_api_key: ${{ secrets.VATLAYER_API_KEY }}
          hmrc_use_live_api: false

Use Actions env var mechanism
Use Actions env var mechanism