diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index e024e6f..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,2 +0,0 @@ -coverage_clover: coverage/clover.xml -json_path: coverage/coveralls-upload.json diff --git a/.github/card-labeler.yml b/.github/card-labeler.yml new file mode 100644 index 0000000..2d816b9 --- /dev/null +++ b/.github/card-labeler.yml @@ -0,0 +1,3 @@ +Backlog: + 'In progress': + - 'Status: In Progress' diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..d38f492 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,19 @@ +javascript: + - '**/*.js' +typescript: + - '**/*.ts' +php: + - '**/*.php' + +'Type: Testing': + - '**/tests/*' + - '**/test/*' + - '**/__tests__/*' + +'Type: Documentation': + - '**/*.md' + +'Type: CI/CD': + - '.github/workflows/*.yml' + - '.circleci/*' + - '.travis.yml' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1cd2289 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,108 @@ +on: + pull_request: + push: + branches: + - master + tags: + - "!*" + +name: Build + +jobs: + phpcs: + name: PHP Code Sniffer + runs-on: ubuntu-latest + env: + CI: 1 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_BUILD_STAGE_NAME: Test + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 3 + - name: Prepare + run: bash bin/prepare.sh + - name: Check code style + run: bash bin/check/phpcs.sh + - uses: 8398a7/action-slack@v1 + with: + type: failure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + phpmd: + name: PHPMD + runs-on: ubuntu-latest + env: + CI: 1 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_BUILD_STAGE_NAME: Test + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 3 + - name: Prepare + run: bash bin/prepare.sh + - name: Check code style + run: bash bin/check/phpmd.sh + - uses: 8398a7/action-slack@v1 + with: + type: failure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + + phpunit: + name: PHPUnit + needs: [phpcs, phpmd] + runs-on: ubuntu-latest + env: + CI: 1 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_BUILD_STAGE_NAME: Test + services: + mysql: + image: mysql + ports: + - 3306 + strategy: + matrix: + php: ['7.2', '7.3'] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 3 + - name: Switch PHP version + env: + PHP_VERSION: ${{ matrix.php }} + run: sudo ln -sf "/usr/bin/php$PHP_VERSION" /etc/alternatives/php + - name: Prepare + run: bash bin/prepare.sh + - name: Run tests + run: bash bin/test/phpunit.sh + - name: Codecov + run: curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN -f $COVERAGE_FILE + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + COVERAGE_FILE: ./coverage/clover.xml + - uses: 8398a7/action-slack@v1 + with: + type: failure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + + slack: + name: Slack + needs: [phpunit] + runs-on: ubuntu-latest + steps: + - uses: 8398a7/action-slack@v1 + with: + type: success + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/gh_releases.yml b/.github/workflows/gh_releases.yml new file mode 100644 index 0000000..8c8fe7e --- /dev/null +++ b/.github/workflows/gh_releases.yml @@ -0,0 +1,14 @@ +on: + push: + branches: + - master +name: GitHub Releases +jobs: + draftRelease: + name: Draft Release + runs-on: ubuntu-latest + steps: + - name: Draft Release + uses: toolmantim/release-drafter@v5.2.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue_opened.yml b/.github/workflows/issue_opened.yml new file mode 100644 index 0000000..9393d79 --- /dev/null +++ b/.github/workflows/issue_opened.yml @@ -0,0 +1,24 @@ +on: + issues: + types: [opened] +name: Issue opened +jobs: + assign: + name: Assign issues to project + runs-on: ubuntu-latest + steps: + - name: Assign issues to project + uses: alex-page/github-project-automation-plus@v0.0.3 + with: + project: Backlog + column: To do + repo-token: ${{ secrets.GITHUB_TOKEN }} + + assignAuthor: + name: Assign author to issue + runs-on: ubuntu-latest + steps: + - name: Assign author to issue + uses: technote-space/assign-author@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr_opened.yml b/.github/workflows/pr_opened.yml new file mode 100644 index 0000000..29826d9 --- /dev/null +++ b/.github/workflows/pr_opened.yml @@ -0,0 +1,33 @@ +on: + pull_request: + types: [opened] +name: Pull Request opened +jobs: + assignToProject: + name: Assign PullRequest to Project + runs-on: ubuntu-latest + steps: + - name: Assign PullRequest to Project + uses: alex-page/github-project-automation-plus@v0.0.3 + with: + project: Backlog + column: To do + repo-token: ${{ secrets.GITHUB_TOKEN }} + + assignAuthor: + name: Assign author to PR + runs-on: ubuntu-latest + steps: + - name: Assign Author to PR + uses: technote-space/assign-author@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + addLabelsByBranch: + name: PR Labeler + runs-on: ubuntu-latest + steps: + - name: PR Labeler + uses: technote-fork/pr-labeler-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr_updated.yml b/.github/workflows/pr_updated.yml new file mode 100644 index 0000000..14c5743 --- /dev/null +++ b/.github/workflows/pr_updated.yml @@ -0,0 +1,11 @@ +on: pull_request +name: Pull Request updated +jobs: + triage: + name: Pull Request Labeler + runs-on: ubuntu-latest + steps: + - name: Pull Request Labeler + uses: actions/labeler@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/project_card_moved.yml b/.github/workflows/project_card_moved.yml new file mode 100644 index 0000000..fa64e8f --- /dev/null +++ b/.github/workflows/project_card_moved.yml @@ -0,0 +1,13 @@ +on: + project_card: + types: [moved] +name: Project Card Event +jobs: + triage: + name: Auto card labeler + runs-on: ubuntu-latest + steps: + - name: Auto card labeler + uses: technote-space/auto-card-labeler@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..adab623 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +on: + push: + tags: + - 'v*' + +name: Release + +jobs: + test: + name: Test + runs-on: ubuntu-latest + env: + CI: 1 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + steps: + - name: Checkout + uses: actions/checkout@master + with: + fetch-depth: 3 + - name: Run tests + run: bash bin/test/phpunit.sh + - uses: 8398a7/action-slack@v1 + with: + type: failure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + + releases: + name: Upload build files + needs: test + runs-on: ubuntu-latest + env: + CI: 1 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_BUILD_STAGE_NAME: Deploy + steps: + - name: Checkout + uses: actions/checkout@master + with: + fetch-depth: 3 + - name: Prepare + run: bash bin/prepare.sh + - name: Build + run: source bin/deploy/env.sh && bash bin/deploy/gh-releases.sh + - name: Upload + uses: technote-fork/action-gh-release@v1 + with: + files: release.zip + draft: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: 8398a7/action-slack@v1 + with: + type: failure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + + slack: + name: Slack + needs: [releases] + runs-on: ubuntu-latest + steps: + - uses: 8398a7/action-slack@v1 + with: + type: success + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/toc.yml b/.github/workflows/toc.yml new file mode 100644 index 0000000..ca1161f --- /dev/null +++ b/.github/workflows/toc.yml @@ -0,0 +1,11 @@ +on: push +name: TOC Generator +jobs: + toc: + name: TOC Generator + runs-on: ubuntu-latest + steps: + - name: TOC Generator + uses: technote-space/toc-generator@v1 + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/.travis.yml b/.travis.yml index 4335109..e90aac2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,18 +23,13 @@ branches: - master - "/^v[0-9\\.]+/" -cache: - directories: - - "${HOME}/.composer/cache" - - "${TRAVIS_BUILD_DIR}/.work/cache" +cache: yarn stages: - name: check if: branch = master and tag IS blank and type IN (pull_request, api) - name: test if: branch = master and tag IS blank and type IN (pull_request, api) - - name: deploy - if: tag IS present before_script: - bash bin/prepare.sh @@ -59,23 +54,3 @@ jobs: language: php php: '7.3' script: bash bin/test/phpunit.sh - - - stage: deploy - language: php - php: '7.2' - script: skip - before_deploy: - - source bin/deploy/env.sh - - bash bin/deploy/gh-releases.sh - deploy: - provider: releases - skip_cleanup: true - name: ${RELEASE_TITLE} - tag_name: ${RELEASE_TAG} - file: ${RELEASE_FILE} - body: ${RELEASE_BODY} - api_key: - secure: PbQVI55zK/y8nYM+p3TpCfpFuiKhWw/rAsI4chWI+YfW3eU8U9WeVnNR9qT8obQPHQQz11yidxeo2UdwEDKYfqQO49NTej5bsrRVL044pMwDW2tjQSMQ4gO6//6KRmuEU++n3gotwENpnsBx8fYyebb6MMo4mgMQgoz5Fl1KAq7b41o6f1Xlsq6ENcW5x5oyhcUoJ6C8lUIVuNn3FJJHdM551V7PJ9tQm1BiHZ/0EoCIIpgY8ko+tIppMQU6vJkk6lHwGu1S6bCjx0EdmVxIUDwuNekfsTTHbLtiJqvESDIYi7kzsxYeeY5irNYgyjHkS6Uf2pe6csLMm5LmkINbKKbnUPD2vyzrO5fy3dc7ixpUtJEylR7gQloJ81+w1hz8ONk+aQRcjCgVN3hdgmouBROTstaTzXoJXsfSGg/4dyiSWHI808pS10NqDTh9Zb7xSwBKHHcZusPSdOMT6HlMUAoUag5AZr2i4psfoTDLyq0C98QOueaEiHMOy0McgGH1DeR9V8b3qFMwkmqbaLEaWfzr0jX1RQNVShHAuylKzB5AtKDRDJMluYSkkSHP/BidcdCBuFBhUTwYEA4QETs/qdSox9F1vSssrr6JxCgEEjAFUVGIHSgQxFaNGz6LDNjnIQN7HpPui5sOsr69GAmIqNkD139EWdUVg1el154y7SE= - overwrite: true - on: - tags: true diff --git a/README.md b/README.md index 2b64e31..00932bd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Laravel CRUD Helper +[![Build Status](https://github.com/technote-space/laravel-crud-helper/workflows/Build/badge.svg)](https://github.com/technote-space/laravel-crud-helper/actions) [![Build Status](https://travis-ci.com/technote-space/laravel-crud-helper.svg?branch=master)](https://travis-ci.com/technote-space/laravel-crud-helper) -[![Coverage Status](https://coveralls.io/repos/github/technote-space/laravel-crud-helper/badge.svg?branch=master)](https://coveralls.io/github/technote-space/laravel-crud-helper?branch=master) +[![codecov](https://codecov.io/gh/technote-space/laravel-crud-helper/branch/master/graph/badge.svg)](https://codecov.io/gh/technote-space/laravel-crud-helper) [![CodeFactor](https://www.codefactor.io/repository/github/technote-space/laravel-crud-helper/badge)](https://www.codefactor.io/repository/github/technote-space/laravel-crud-helper) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/laravel-crud-helper/blob/master/LICENSE) [![PHP: >=7.1.3](https://img.shields.io/badge/PHP-%3E%3D7.1.3-orange.svg)](http://php.net/) @@ -10,8 +11,29 @@ CRUD helper for Laravel. [Packagist](https://packagist.org/packages/technote/laravel-crud-helper) -## Install + + +**Table of Contents** + +- [Install](#install) +- [Usage](#usage) +- [Routes](#routes) +- [Details](#details) + - [Validation](#validation) + - [Model name](#model-name) + - [ex. test_items](#ex-test_items) + - [Config](#config) + - [Namespace](#namespace) + - [Prefix](#prefix) + - [Middleware](#middleware) + - [To Change](#to-change) +- [Search feature](#search-feature) + - [Laravel Search Helper](#laravel-search-helper) +- [Author](#author) + + +## Install ``` composer require technote/laravel-crud-helper ``` diff --git a/bin/test/phpunit.sh b/bin/test/phpunit.sh index a3ca5c1..0ca85f9 100644 --- a/bin/test/phpunit.sh +++ b/bin/test/phpunit.sh @@ -13,10 +13,3 @@ source "${current}"/../variables.sh echo "" echo ">> Run composer phpunit" composer phpunit - -if [[ -n "${CI}" ]]; then - ls -la "${TRAVIS_BUILD_DIR}"/coverage/clover.xml - echo "" - echo ">> Run composer coveralls" - composer coveralls -fi diff --git a/composer.json b/composer.json index c1417c0..1a58c17 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,6 @@ "fzaninotto/faker": "^1.8", "nunomaduro/collision": "^3.0", "orchestra/testbench": "^3.8", - "php-coveralls/php-coveralls": "^2.1", "phpmd/phpmd": "^2.6", "phpunit/phpunit": "^8.0", "squizlabs/php_codesniffer": "^3.4", @@ -85,9 +84,6 @@ "bin:phpunit": [ "TRAVIS_BUILD_DIR=$(cd $(dirname $0); pwd) bash bin/test/phpunit.sh" ], - "coveralls": [ - "php-coveralls -v" - ], "gh-prepare": [ "TRAVIS_BUILD_DIR=$(cd $(dirname $0); pwd) TRAVIS_BUILD_STAGE_NAME=Deploy bash bin/prepare.sh" ],