Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLATFORM-9061| setup Github Actions workflows #16

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
85 changes: 85 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: PHPUnit / PHPCS / Phan
on:
pull_request:
branches: '**'

push:
branches: [ master, REL1_39 ]

jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"php_version\":\"8.0\",\"mw\":\"${{ github.event.pull_request.base.ref || 'master' }}\"}]}"

build:
needs: matrix_prep
strategy:
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}

runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
# We don't run any coverage, so we should set this parameter to none
# as this will disable xdebug which slows all processes significantly
coverage: none
extensions: ast
- uses: actions/checkout@v4

- name: Checkout Mediawiki
uses: actions/checkout@v4
with:
repository: wikimedia/mediawiki
ref: ${{ matrix.mw }}

- name: Checkout Cargo extension
uses: actions/checkout@v3
with:
path: extensions/Cargo

- name: Cache Cargo composer dependencies
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-v3-${{ hashFiles('extensions/Cargo/composer.lock') }}

- name: Install Cargo composer dependencies
working-directory: ./extensions/Cargo
run: composer install --prefer-dist --no-progress

- name: Run PHPCS and minus-x
working-directory: ./extensions/Cargo
run: composer test

- name: Start MySQL
run: sudo systemctl start mysql.service

- name: Install MediaWiki composer dependencies
run: composer update --prefer-dist --no-progress

- name: Install & configure MediaWiki
run: |
php maintenance/install.php --dbtype mysql --dbuser root --dbpass root --pass TestPassword testwiki TestAdmin

echo 'error_reporting( E_ALL | E_STRICT );' >> LocalSettings.php
echo 'ini_set( "display_errors", 1 );' >> LocalSettings.php
echo '$wgShowExceptionDetails = true;' >> LocalSettings.php
echo '$wgShowDBErrorBacktrace = true;' >> LocalSettings.php
echo '$wgDevelopmentWarnings = true;' >> LocalSettings.php

echo 'wfLoadExtension( "'Cargo'" );' >> LocalSettings.php

- name: Run schema changes
run: php maintenance/update.php --quick

- name: Run PHPUnit tests
run: php tests/phpunit/phpunit.php extensions/Cargo/tests
Loading