-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from goshippo/github-actions-setup
[DVRL-8] GitHub actions setup
- Loading branch information
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: PHP SDK Test | ||
|
||
on: | ||
# Run the tests on every push to the master branch | ||
push: | ||
branches: [ "master" ] | ||
|
||
# Run the tests for the default branch [master] every Monday 3:00 pm UTC time (8:00 am PST) | ||
schedule: | ||
- cron: "0 15 * * 1" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: ['7.4', '8.0'] | ||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
- name: Check PHP Version | ||
run: php -v | ||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress | ||
- id: tests | ||
name: Run the tests | ||
run: ./vendor/bin/phpunit | ||
- name: Send a Slack notification saying if tests are passing/failing for a given PHP version | ||
shell: bash | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
run: | | ||
conclusion=${{ steps.tests.conclusion }} | ||
if [[ "$conclusion" == "success" ]]; then | ||
message="✅ PHP SDK Test succeeded for PHP ${{ matrix.php-versions }}" | ||
else | ||
message="❌ PHP SDK Test failed for PHP ${{ matrix.php-versions }}" | ||
fi | ||
curl -X POST --data-urlencode "payload={\"text\": \"$message\", \"link_names\": 1}" $SLACK_WEBHOOK_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor | ||
*.cache | ||
*.cache | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters