-
Notifications
You must be signed in to change notification settings - Fork 5
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 #169 from wmde/github-actions-ci
Replace travis CI builds with github actions
- Loading branch information
Showing
6 changed files
with
86 additions
and
35 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
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,3 @@ | ||
CI workflow ${WORKFLOW} failed! | ||
|
||
The failed job can be found in [here](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID}). |
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,50 @@ | ||
name: Lint and Test | ||
on: push | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php_version: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php_version }} | ||
- uses: nowactions/envsubst@v1 | ||
with: | ||
input: ${{ github.workspace }}/.github/workflows/ci_failure_email.md.tmpl | ||
output: ${{ github.workspace }}/.github/workflows/ci_failure_email.md | ||
env: | ||
WORKFLOW: ${{ github.workflow }} | ||
SERVER_URL: ${{ github.server_url }} | ||
REPOSITORY: ${{ github.repository }} | ||
RUN_ID: ${{ github.run_id }} | ||
- 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-${{ matrix.php_version}}-${{ hashFiles('**/composer.lock') }} | ||
- name: Install dependencies | ||
run: composer install --prefer-source --no-progress | ||
- name: Run test suite | ||
run: composer test | ||
- name: Send mail on failure | ||
if: ${{ failure() }} | ||
uses: dawidd6/action-send-mail@v3 | ||
with: | ||
server_address: smtp.gmail.com | ||
server_port: 465 | ||
username: ${{secrets.CI_MAIL_USERNAME}} | ||
password: ${{secrets.CI_MAIL_PASSWORD}} | ||
to: [email protected] | ||
from: ${{ github.repository }} CI | ||
subject: CI job failed for ${{ github.repository }} | ||
convert_markdown: true | ||
html_body: file://${{ github.workspace }}/.github/workflows/ci_failure_email.md |
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,31 @@ | ||
name: Generate and upload test coverage | ||
on: | ||
workflow_run: | ||
workflows: ['Lint and Test'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
scrutinize: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
coverage: xdebug | ||
- name: Cache Composer packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | ||
- name: Generate PHP tests coverage | ||
run: vendor/bin/phpunit --coverage-clover coverage.clover | ||
- name: Upload Scrutinizer coverage | ||
uses: sudo-bot/action-scrutinizer@latest | ||
with: | ||
cli-args: "--repository g/wmde/Time --format=php-clover ./coverage.clover" |
This file was deleted.
Oops, something went wrong.
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