From b0e1df0c2f622e8ea496063f7a9f14ba9c834b6d Mon Sep 17 00:00:00 2001 From: Universal Omega <54654040+Universal-Omega@users.noreply.github.com> Date: Fri, 10 Sep 2021 16:15:13 -0600 Subject: [PATCH] Combine CI files (#26) --- .../{php-tests.yml => mediawiki-tests.yml} | 58 +++++++++++++++++-- .github/workflows/notify.yml | 2 +- .github/workflows/test-lint.yml | 45 -------------- 3 files changed, 54 insertions(+), 51 deletions(-) rename .github/workflows/{php-tests.yml => mediawiki-tests.yml} (61%) delete mode 100644 .github/workflows/test-lint.yml diff --git a/.github/workflows/php-tests.yml b/.github/workflows/mediawiki-tests.yml similarity index 61% rename from .github/workflows/php-tests.yml rename to .github/workflows/mediawiki-tests.yml index 50acf4fe..b65131be 100644 --- a/.github/workflows/php-tests.yml +++ b/.github/workflows/mediawiki-tests.yml @@ -1,30 +1,45 @@ -name: PHP tests +name: MediaWiki tests + on: push: - branches: [ master ] pull_request: branches: [ master ] + jobs: test: - name: "${{ matrix.mw }} | ${{ matrix.repo }} | ${{ matrix.php }}" + name: "${{ matrix.mw }} | ${{ matrix.repo }} | PHP ${{ matrix.php }}" + continue-on-error: true strategy: matrix: include: - # Miraheze version + # Miraheze version - PHP 7.3 - mw: 'REL1_36' repo: 'miraheze' php: 7.3 composer: v2 + continue-on-error: false + + # Miraheze version - PHP 7.4 + - mw: 'REL1_36' + repo: 'miraheze' + php: 7.4 + composer: v2 + continue-on-error: true + # Latest stable MediaWiki - mw: 'REL1_36' repo: 'wikimedia' php: 7.3 composer: v2 + continue-on-error: false + # Latest MediaWiki master - mw: 'master' repo: 'wikimedia' php: 7.3 composer: v2 + continue-on-error: true + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -35,6 +50,25 @@ jobs: php-version: ${{ matrix.php }} extensions: intl,ast tools: composer:${{ matrix.composer }} + + - name: Install dependencies + run: | + composer validate + composer update + npm install --save-dev + + - name: Check PHP + if: ${{ matrix.mw == 'master' }} + run: | + sh phpcbf.sh + composer fix + composer test + + - name: Check i18n + if: ${{ matrix.mw == 'master' }} + run: | + npm run lint:i18n + - name: Cache MediaWiki id: cache-mediawiki uses: actions/cache@v2 @@ -75,6 +109,20 @@ jobs: git submodule update --init extensions/SocialProfile - name: Run phan + continue-on-error: ${{ matrix.continue-on-error }} run: | - composer update composer phan + + # Only patch code when it is a push event + - name: Push the changes + if: github.event_name == 'push' && matrix.mw == 'master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global user.name "github-actions" + git config --global user.email "github-actions@users.noreply.github.com" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git add . + git commit -am "CI: lint code to MediaWiki standards" -m "Check commit and GitHub actions for more details" || echo "No changes to commit" + git pull --rebase + git push diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index a7ae44e1..74f371b2 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -1,7 +1,7 @@ name: notify on: workflow_run: - workflows: ["PHP tests", "Linting"] + workflows: ["MediaWiki tests"] types: [completed] jobs: diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml deleted file mode 100644 index 8c12cfff..00000000 --- a/.github/workflows/test-lint.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Linting - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - test: - name: Test and lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: | - composer validate - npm install --save-dev - composer install --prefer-dist --no-progress - - # Bypass the phpcbf non-standard exit code - - name: Check PHP - run: | - sh phpcbf.sh - composer fix - composer test - - - name: Check i18n - run: | - npm run lint:i18n - - # Only patch code when it is a push event - - name: Push the changes - if: github.event_name == 'push' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config --global user.name "github-actions" - git config --global user.email "github-actions@users.noreply.github.com" - git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" - git add . - git commit -am "CI: lint code to MediaWiki standards" -m "Check commit and GitHub actions for more details" || echo "No changes to commit" - git pull --rebase - git push