|
| 1 | + |
| 2 | +name: Lint and Test |
| 3 | +on: push |
| 4 | +permissions: |
| 5 | + contents: read |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + php_version: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Setup PHP |
| 15 | + uses: shivammathur/setup-php@v2 |
| 16 | + with: |
| 17 | + php-version: ${{ matrix.php_version }} |
| 18 | + - uses: nowactions/envsubst@v1 |
| 19 | + with: |
| 20 | + input: ${{ github.workspace }}/.github/workflows/ci_failure_email.md.tmpl |
| 21 | + output: ${{ github.workspace }}/.github/workflows/ci_failure_email.md |
| 22 | + env: |
| 23 | + WORKFLOW: ${{ github.workflow }} |
| 24 | + SERVER_URL: ${{ github.server_url }} |
| 25 | + REPOSITORY: ${{ github.repository }} |
| 26 | + RUN_ID: ${{ github.run_id }} |
| 27 | + - name: Validate composer.json and composer.lock |
| 28 | + run: composer validate --strict |
| 29 | + - name: Cache Composer packages |
| 30 | + id: composer-cache |
| 31 | + uses: actions/cache@v3 |
| 32 | + with: |
| 33 | + path: vendor |
| 34 | + key: ${{ runner.os }}-php-${{ matrix.php_version}}-${{ hashFiles('**/composer.lock') }} |
| 35 | + - name: Install dependencies |
| 36 | + run: composer install --prefer-source --no-progress |
| 37 | + - name: Run test suite |
| 38 | + run: composer test |
| 39 | + - name: Send mail on failure |
| 40 | + if: ${{ failure() }} |
| 41 | + uses: dawidd6/action-send-mail@v3 |
| 42 | + with: |
| 43 | + server_address: smtp.gmail.com |
| 44 | + server_port: 465 |
| 45 | + username: ${{secrets.CI_MAIL_USERNAME}} |
| 46 | + password: ${{secrets.CI_MAIL_PASSWORD}} |
| 47 | + to: wikidata-ci-status@wikimedia.de |
| 48 | + from: ${{ github.repository }} CI |
| 49 | + subject: CI job failed for ${{ github.repository }} |
| 50 | + convert_markdown: true |
| 51 | + html_body: file://${{ github.workspace }}/.github/workflows/ci_failure_email.md |
0 commit comments