|
| 1 | +name: Unit Testing |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request |
| 5 | + |
| 6 | +jobs: |
| 7 | + unit-test: |
| 8 | + name: Unit Testing |
| 9 | + runs-on: ubuntu-latest |
| 10 | + container: |
| 11 | + image: atk4/image:latest # https://github.com/atk4/image |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + php: ['7.2', '7.3', 'latest'] |
| 15 | + services: |
| 16 | + mysql: |
| 17 | + image: mysql:5.7 |
| 18 | + env: |
| 19 | + MYSQL_ROOT_PASSWORD: password |
| 20 | + DB_DATABASE: db |
| 21 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v1 |
| 24 | + - name: Get Composer Cache Directory |
| 25 | + id: composer-cache |
| 26 | + run: | |
| 27 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 28 | + - uses: actions/cache@v1 |
| 29 | + with: |
| 30 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 31 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 32 | + restore-keys: | |
| 33 | + ${{ runner.os }}-composer- |
| 34 | +
|
| 35 | + - run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader |
| 36 | + |
| 37 | + - name: Install dependencies and SQL |
| 38 | + run: | |
| 39 | + mkdir -p coverage |
| 40 | + apk add npm |
| 41 | + npm install -g less clean-css uglify-js |
| 42 | + mysql -uroot -ppassword -h mysql -e 'CREATE DATABASE atk4;' |
| 43 | + mysql -uroot -ppassword -h mysql atk4 < demos/atk4.sql |
| 44 | +
|
| 45 | + mv demos/db.github.php demos/db.php |
| 46 | + (cd js; npm install; npm run build) |
| 47 | + #lessc public/agileui.less public/agileui.css --clean-css="--s1 --advanced --compatibility=ie8" --source-map |
| 48 | + #uglifyjs --compress -- public/agileui.js > public/agileui.min.js |
| 49 | +
|
| 50 | + - name: Unit Testing |
| 51 | + run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml |
| 52 | + |
| 53 | +# - name: Merge coverage logs |
| 54 | +# run: vendor/bin/phpcov merge build/logs/ --clover build/logs/cc.xml; |
| 55 | + |
| 56 | + - uses: codecov/codecov-action@v1 |
| 57 | + with: |
| 58 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 59 | + file: covearge.xml |
| 60 | + |
| 61 | + |
0 commit comments