# ---
env:
    BUILD_DEPENDENCIES: git composer phpunit unzip php-date php-pdo-sqlite
# ---
on: [push]
jobs:
    tests:
        runs-on: docker
        container:
            image: debian:latest
        steps:
            - name: Install OS Dependencies
              run: |
                apt-get update && apt-get install --yes $BUILD_DEPENDENCIES
            - name: Add CI User
              run: |
                useradd -m ci-user
            - name: Clone Repository
              run: |
                mkdir app
                chown ci-user:ci-user app
                su -c "git clone -b ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} app" ci-user
            - name: Install Dependencies
              run: |
                cd app
                su -c "composer update" ci-user
            - name: Run Unit Tests
              run: |
                cd app
                su -c "unshare -c -n phpunit" ci-user
