name: Tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  tests:
    name: Test code
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go:
          - ^1.13
          - ^1.14
          - ^1.15
          - ^1
    steps:

    - name: Set up Go
      uses: actions/setup-go@v2
      with:
        go-version: ${{ matrix.go }}

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2

    - name: Test
      run: |
        make
        make test

    - name: Install packaging dependencies
      run: |
        sudo apt-get install rpm ruby-dev
        sudo gem install fpm

    - name: Check packaging
      run: |
        GO111MODULE=off go get github.com/mitchellh/gox
        make gox-build
        make DEVEL=1 fpm-deb
        make DEVEL=1 fpm-rpm
        make sum-files

    - name: Artifact
      id: artifact
      uses: actions/upload-artifact@v2
      with:
        name: packages-${{ matrix.go }}
        retention-days: 1
        path: |
          *.deb
          *.rpm
          sha256sum
          md5sum

name: Tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  tests:
    name: Test code
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go:
          - ^1.13
          - ^1.14
          - ^1.15
          - ^1
    steps:

    - name: Set up Go
      uses: actions/setup-go@v2
      with:
        go-version: ${{ matrix.go }}

    - name: Check out code
      uses: actions/checkout@v2

    - name: Checkout to the latest code
      run: |
        # Fetch all tags
        git fetch --depth=1 --tags
        # Get the latest tag
        VERS=$(git tag -l | sort -Vr | head -n1)
        # Fetch everything to the latest tag
        git fetch --shallow-since=$(git log $VERS -1 --format=%at)
      if: ${{ github.event_name == 'push' }}

    - name: Test
      run: |
        make
        make test

    - name: Install packaging dependencies
      run: |
        sudo apt-get install rpm ruby-dev
        sudo gem install fpm

    - name: Check packaging
      run: |
        GO111MODULE=off go get github.com/mitchellh/gox
        make gox-build
        make DEVEL=1 fpm-deb
        make DEVEL=1 fpm-rpm
        make sum-files

    - name: Artifact
      id: artifact
      uses: actions/upload-artifact@v2
      with:
        name: packages-${{ matrix.go }}
        retention-days: 1
        path: |
          *.deb
          *.rpm
          sha256sum
          md5sum

Add proper versioning for nightly builds
Add proper versioning for nightly builds
