name: Build

on:
  push:
    branches:
      - master
      - development
    tags:
      - 'v*.*.*'
  pull_request:

  schedule:
    - cron: '0 5 * * *'

jobs:
  run-tests:
    strategy:
      matrix:
        include:
          - php: "7.1"
            test-name: "test-php-71"
          - php: "7.2"
            test-name: "test-php-72"
          - php: "7.3"
            test-name: "test-php-73"
          - php: "7.4"
            test-name: "test-php-74"
          - php: "8.0"
            test-name: "test-php-80"

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Log into registry
        run: echo $GH_REGISTRY_TOKEN | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
        env:
          GH_REGISTRY_TOKEN: ${{ secrets.GHCR_TOKEN }}

      - name: Pull containers
        run: docker-compose pull

      - name: Run tests
        run: make ${{ matrix.test-name }}

  release:
    runs-on: ubuntu-latest
    needs:
      - run-tests
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Extract version
        id: data
        run: |
          # Strip git ref prefix from version
          RELEASE_VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

          # Strip "v" prefix from tag name
          [[ "${{ github.ref }}" == "refs/tags/"* ]] && RELEASE_VERSION=$(echo $RELEASE_VERSION | sed -e 's/^v//')

          echo $RELEASE_VERSION
          echo "##[set-output name=version;]$RELEASE_VERSION"

      - name: Create release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          name: Version ${{ steps.data.outputs.version }}
          body_path: CHANGELOG.md
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Add github workflow to run tests
Add github workflow to run tests
