diff --git a/.gitattributes b/.gitattributes index b72a9ee9..9682727d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,7 @@ .gitattributes export-ignore +.github/ export-ignore .gitignore export-ignore .scrutinizer.yml export-ignore -.travis.yml export-ignore composer.json export-ignore docs export-ignore phpmd.xml export-ignore diff --git a/.github/workflows/ci_failure_email.md.tmpl b/.github/workflows/ci_failure_email.md.tmpl new file mode 100644 index 00000000..322186bb --- /dev/null +++ b/.github/workflows/ci_failure_email.md.tmpl @@ -0,0 +1,3 @@ +CI workflow ${WORKFLOW} failed! + +The failed job can be found in [here](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID}). diff --git a/.github/workflows/lint-and-test.yaml b/.github/workflows/lint-and-test.yaml new file mode 100644 index 00000000..99cb4bdc --- /dev/null +++ b/.github/workflows/lint-and-test.yaml @@ -0,0 +1,51 @@ + +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: wikidata-ci-status@wikimedia.de + 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 diff --git a/.github/workflows/scrutinize.yaml b/.github/workflows/scrutinize.yaml new file mode 100644 index 00000000..d0bbb7f4 --- /dev/null +++ b/.github/workflows/scrutinize.yaml @@ -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/WikibaseDataModel --format=php-clover ./coverage.clover" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a1c2cea8..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: php - -dist: xenial - -matrix: - fast_finish: true - include: - - php: 7.4 - - php: 8.0 - -sudo: false - -install: travis_retry composer install - -script: composer ci - -notifications: - irc: - channels: - - "irc.libera.chat#wikidata-feed" - on_success: change - on_failure: always - template: - - "%{repository}/%{branch}/%{commit} : %{author} %{message} %{build_url}" - -cache: - directories: - - $HOME/.composer/cache diff --git a/README.md b/README.md index d098c4ed..a8071dd2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Wikibase DataModel -[![Build Status](https://secure.travis-ci.org/wmde/WikibaseDataModel.png?branch=master)](http://travis-ci.org/wmde/WikibaseDataModel) +[![Build Status](https://github.com/wmde/WikibaseDataModel/actions/workflows/lint-and-test.yaml/badge.svg?branch=master)](https://github.com/wmde/WikibaseDataModel/actions/workflows/lint-and-test.yaml) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wmde/WikibaseDataModel/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/wmde/WikibaseDataModel/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/wmde/WikibaseDataModel/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/wmde/WikibaseDataModel/?branch=master) [![Download count](https://poser.pugx.org/wikibase/data-model/d/total.png)](https://packagist.org/packages/wikibase/data-model) @@ -83,7 +83,7 @@ Daniel Kinzler and Jeroen De Dauw. * [Wikibase DataModel on TravisCI](https://travis-ci.org/wmde/WikibaseDataModel) * [Wikibase DataModel on ScrutinizerCI](https://scrutinizer-ci.com/g/wmde/WikibaseDataModel) * [Wikibase DataModel on Wikimedia's Phabricator](https://phabricator.wikimedia.org/project/view/920/) - + ## See also * [Blog posts on Wikibase DataModel](http://www.bn2vs.com/blog/tag/wikibase-datamodel/)