on: ["push", "pull_request"]

name: Coveralls

jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - uses: actions/checkout@v2

    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: 12.x

    - name: npm install, npm test:coverage
      run: |
        npm install
        npm run test:coverage
      env:
        CI: true
        ADYEN_API_KEY: ${{ secrets.ADYEN_API_KEY }}
        ADYEN_MERCHANT: ${{ secrets.ADYEN_MERCHANT }}
        ADYEN_PASSWORD: ${{ secrets.ADYEN_PASSWORD }}
        ADYEN_REVIEWPAYOUT_APIKEY: ${{ secrets.ADYEN_REVIEWPAYOUT_APIKEY }}
        ADYEN_REVIEWPAYOUT_PASSWORD: ${{ secrets.ADYENREVIEWPAYOUT_PASSWORD }}
        ADYEN_REVIEWPAYOUT_USER: ${{ secrets.ADYENREVIEWPAYOUT_USER }}
        ADYEN_STOREPAYOUT_APIKEY: ${{ secrets.ADYEN_STOREPAYOUT_APIKEY }}
        ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
        ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
        ADYEN_USER: ${{ secrets.ADYEN_USER }}
        ADYEN_MARKETPLACE_USER: ${{ secrets.ADYEN_MARKETPLACE_USER }}
        ADYEN_MARKETPLACE_PASSWORD: ${{ secrets.ADYEN_MARKETPLACE_PASSWORD }}
        ADYEN_TERMINAL_APIKEY: ${{ secrets.ADYEN_TERMINAL_APIKEY }}
        ADYEN_TERMINAL_POIID: ${{ secrets.ADYEN_TERMINAL_POIID }}
        ADYEN_TERMINAL_MERCHANT: ${{ secrets.ADYEN_TERMINAL_MERCHANT }}

    - name: Coveralls Parallel
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        path-to-lcov: ./coverage/lcov.info # optional (default value)

    - name: Coveralls Finished
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
