diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..edbe004 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,40 @@ +name: Continuous Integration +on: + push: { } + pull_request: { } + workflow_dispatch: { } +jobs: + test: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ ubuntu-latest ] + php-versions: + - 7.4 + - 7.3 + - 7.2 + - 7.1 + phpunit-versions: [ latest ] + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: xdebug + + - uses: actions/checkout@v2 + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - run: composer install --prefer-dist + - run: composer run cs-check + - run: composer run coverage + + - uses: codecov/codecov-action@v2 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 761ee04..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: linux -language: php - -php: -- 5.6 -- 7.0 -- 7.1 -- 7.2 -- 7.3 -- 7.4 -- nightly - -jobs: - allow_failures: - - php: nightly - -cache: - directories: - - $HOME/.composer/cache/files - - vendor - -install: -- composer install --prefer-dist - -script: -- composer run cs-check -- composer run coverage - -after_success: -- bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index c3149b4..cfe06a7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # mitake-php -[![Build Status](https://travis-ci.org/minchao/mitake-php.svg?branch=master)](https://travis-ci.org/minchao/mitake-php) +[![Continuous Integration](https://github.com/minchao/mitake-php/actions/workflows/continuous-integration.yml/badge.svg?branch=master)](https://github.com/minchao/mitake-php/actions/workflows/continuous-integration.yml) [![Build status](https://ci.appveyor.com/api/projects/status/sg0uce4i30p5dxf2/branch/master?svg=true&passingText=Windows%20-%20OK)](https://ci.appveyor.com/project/minchao/mitake-php/branch/master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1b7b6ee48e884e6aa48d76605871ba83)](https://www.codacy.com/app/minchao/mitake-php?utm_source=github.com&utm_medium=referral&utm_content=minchao/mitake-php&utm_campaign=Badge_Grade) [![codecov](https://codecov.io/gh/minchao/mitake-php/branch/master/graph/badge.svg)](https://codecov.io/gh/minchao/mitake-php) @@ -82,7 +82,7 @@ $resp = $client->sendLongMessage($message); ### 發送多筆長簡訊 -若要一次發送多筆長簡訊,請先建立欲發送的 **LongMessage objects** 陣列,再呼叫 API 的 sendLongMessageBatch() 方法發送 +若要一次發送多筆長簡訊,請先建立欲發送的 **LongMessage objects** 陣列,再呼叫 API 的 sendLongMessageBatch() 方法發送 ```php $resp = $client->sendLongMessageBatch([$message1, $message2]); @@ -113,7 +113,7 @@ $resp = $client->cancelMessageStatus(['MESSAGE_ID1', 'MESSAGE_ID2]); ```php $message->setResponse('https://your.domain.name/callback'); -``` +``` 建立 webhook: @@ -214,7 +214,7 @@ Q:遇到 `PHP Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cUR A:這是因為 OpenSSL 已不支援 TLS 1.1 以下版本,建議使用[長簡訊方法](https://github.com/minchao/mitake-php#%E7%99%BC%E9%80%81%E5%96%AE%E7%AD%86%E9%95%B7%E7%B0%A1%E8%A8%8A)來傳送簡訊,請參考 Issue [#4](https://github.com/minchao/mitake-php/issues/4) 的說明。 -**注意:使用 HTTP 或已棄用的 TLS 協議來傳送簡訊,會將傳輸資料暴露外洩的風險之中。** +**注意:使用 HTTP 或已棄用的 TLS 協議來傳送簡訊,會將傳輸資料暴露外洩的風險之中。** ## License diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c7d5991..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,66 +0,0 @@ -build: false -platform: - - x64 -clone_folder: c:\projects\mitake-php - -## Build matrix -environment: - matrix: - - dependencies: highest - php_version: 7.0 - - dependencies: highest - php_version: 7.1 - - dependencies: highest - php_version: 7.2 - - project_directory: c:\projects\mitake-php - php_root_directory: c:\tools\php - composer_directory: c:\tools\composer - composer_executable: c:\tools\composer\composer.phar - -cache: - - c:\ProgramData\chocolatey\bin -> appveyor.yml - - c:\ProgramData\chocolatey\lib -> appveyor.yml - - c:\tools\php -> appveyor.yml - - c:\tools\composer -> appveyor.yml - - '%LOCALAPPDATA%\Composer -> appveyor.yml' - -init: - - ps: $Env:php_directory = $Env:php_root_directory + '\' + $Env:php_version - - ps: $Env:exact_php_version = (((choco search php --exact --all-versions --limit-output | Select-String -pattern $Env:php_version) -replace '[php|]', '') | %{ New-Object System.Version $_ } | Sort-Object | Select-Object -Last 1).ToString() - - ps: $Env:PATH = $Env:php_directory + ';' + $Env:composer_directory + ';' + $Env:PATH - - ps: $Env:ANSICON = '121x90 (121x90)' - -install: - # Install requested PHP version - - ps: If ((Test-Path $Env:php_directory) -eq $False) { New-Item -Path $Env:php_directory -ItemType 'directory' } - - ps: $php_install_parameters = '"/DontAddToPath /InstallDir:' + $Env:php_directory + '"' - - ps: appveyor-retry choco upgrade php --yes --version=$Env:exact_php_version --params=$php_install_parameters - - # Prepare PHP - - ps: cd $Env:php_directory - - ps: Copy-Item php.ini-production -Destination php.ini - - ps: Add-Content -Path php.ini -Value 'memory_limit=1G' - - ps: Add-Content -Path php.ini -Value 'date.timezone="UTC"' - - ps: Add-Content -Path php.ini -Value 'extension_dir=ext' - - ps: Add-Content -Path php.ini -Value 'extension=php_curl.dll' - - ps: Add-Content -Path php.ini -Value 'extension=php_intl.dll' - - ps: Add-Content -Path php.ini -Value 'extension=php_mbstring.dll' - - ps: Add-Content -Path php.ini -Value 'extension=php_openssl.dll' - - ps: php --version - - # Prepare composer - - ps: If ((Test-Path $Env:composer_directory) -eq $False) { New-Item -Path $Env:composer_directory -ItemType 'directory' } - - ps: If ((Test-Path $Env:composer_executable) -eq $False) { appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar -FileName $Env:composer_executable } - - ps: Set-Content -Path ($Env:composer_directory + '\composer.bat') -Value ('@php ' + $Env:composer_executable + ' %*') - - composer self-update - - # Install dependencies - - ps: cd $Env:project_directory - - IF %dependencies%==highest composer update --no-interaction --no-progress - -test_script: - - ps: cd $Env:project_directory - - composer run cs-check - - composer run coverage -