From e88d5f09f9faee690cb0bd834bb9182087df722d Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 24 Apr 2024 17:15:03 +0200 Subject: [PATCH] Run tests one by one @ GHA This workflow just finds all the individual tests available in core (all the test_ methods in _test.php file) and runs them one by one, with a total isolation, because each one is executed by a different PHPUnit run. Any test ending with error, will be reported as part of the output. Note that we are not using PHPUnit's own isolation here, just running them one by one. --- .github/workflows/onebyone.yml | 7 ++ .github/workflows/push.yml | 124 --------------------------------- 2 files changed, 7 insertions(+), 124 deletions(-) delete mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/onebyone.yml b/.github/workflows/onebyone.yml index 801caefbe76f5..6b2b36590c30d 100644 --- a/.github/workflows/onebyone.yml +++ b/.github/workflows/onebyone.yml @@ -19,6 +19,13 @@ name: One by One Testing # own isolation or any other option. on: + push: + branches-ignore: + - main + - master + - MOODLE_[0-9]+_STABLE + tags-ignore: + - v[0-9]+.[0-9]+.[0-9]+* workflow_dispatch: inputs: phpunit_extra_options: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 2a98c698124b5..0000000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: Core - -on: - push: - branches-ignore: - - master - - MOODLE_[0-9]+_STABLE - tags-ignore: - - v[0-9]+.[0-9]+.[0-9]+* - workflow_dispatch: - inputs: - phpunit_extra_options: - description: Additional options to apply to PHPUnit - required: false - default: '' - -env: - php: 8.2 - -jobs: - Grunt: - runs-on: ubuntu-22.04 - - steps: - - name: Checking out code - uses: actions/checkout@v4 - - - name: Configuring node & npm - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - - name: Installing node stuff - run: npm install - - - name: Running grunt - run: npx grunt - - - name: Looking for uncommitted changes - # Add all files to the git index and then run diff --cached to see all changes. - # This ensures that we get the status of all files, including new files. - # We ignore npm-shrinkwrap.json to make the tasks immune to npm changes. - run: | - git add . - git reset -- npm-shrinkwrap.json - git diff --cached --exit-code - - PHPUnit: - runs-on: ${{ matrix.os }} - services: - exttests: - image: moodlehq/moodle-exttests - ports: - - 8080:80 - redis: - image: redis - ports: - - 6379:6379 - strategy: - fail-fast: false - matrix: - include: - # MySQL builds always run with the lowest PHP supported version. - - os: ubuntu-22.04 - php: 8.0 - extensions: - db: mysqli - # PostgreSQL builds always run with the highest PHP supported version. - - os: ubuntu-22.04 - php: 8.2 - db: pgsql - - steps: - - name: Setting up DB mysql - if: ${{ matrix.db == 'mysqli' }} - uses: moodlehq/mysql-action@v1 - with: - collation server: utf8mb4_bin - mysql version: 8.0 - mysql database: test - mysql user: test - mysql password: test - use tmpfs: true - tmpfs size: '1024M' - extra conf: --skip-log-bin - - - name: Setting up DB pgsql - if: ${{ matrix.db == 'pgsql' }} - uses: m4nu56/postgresql-action@v1 - with: - postgresql version: 13 - postgresql db: test - postgresql user: test - postgresql password: test - - - name: Configuring git vars - uses: rlespinasse/github-slug-action@v4 - - - name: Setting up PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ matrix.extensions }} - ini-values: max_input_vars=5000 - coverage: none - - - name: Checking out code from ${{ env.GITHUB_REF_SLUG }} - uses: actions/checkout@v4 - - - name: Setting up PHPUnit - env: - dbtype: ${{ matrix.db }} - run: | - echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it. - cp .github/workflows/config-template.php config.php - mkdir ../moodledata - sudo locale-gen en_AU.UTF-8 - php admin/tool/phpunit/cli/init.php --no-composer-self-update - - - name: Running PHPUnit tests - env: - dbtype: ${{ matrix.db }} - phpunit_options: ${{ secrets.phpunit_options }} - run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}