diff --git a/.github/workflows/reusable-serviceless-phpunit-test.yml b/.github/workflows/reusable-serviceless-phpunit-test.yml index c044f2178ea3..e0273eb3e71e 100644 --- a/.github/workflows/reusable-serviceless-phpunit-test.yml +++ b/.github/workflows/reusable-serviceless-phpunit-test.yml @@ -13,6 +13,10 @@ on: description: The PHP version the workflow should run type: string required: true + os: + description: The GitHub-hosted runner for the job + type: string + required: true job-id: description: Job ID to be used as part of cache key and artifact name type: string @@ -49,9 +53,15 @@ on: jobs: tests: name: ${{ inputs.job-name }} - runs-on: ubuntu-22.04 + runs-on: ${{ inputs.os }} steps: + - name: Set Git to use LF + if: ${{ contains(inputs.os, 'windows') }} + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Install latest ImageMagick if: ${{ contains(inputs.extra-extensions, 'imagick') }} run: | @@ -68,7 +78,7 @@ jobs: with: php-version: ${{ inputs.php-version }} tools: composer - extensions: gd, ${{ inputs.extra-extensions }} + extensions: intl, gd, ${{ inputs.extra-extensions }} coverage: ${{ env.COVERAGE_DRIVER }} env: COVERAGE_DRIVER: ${{ inputs.enable-coverage && 'xdebug' || 'none' }} @@ -76,14 +86,16 @@ jobs: - name: Setup global environment variables run: | echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV - echo "ARTIFACT_NAME=${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}" >> $GITHUB_ENV + echo "ARTIFACT_NAME=${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}" >> $GITHUB_ENV + shell: bash - name: Cache Composer dependencies uses: actions/cache@v3 with: path: ${{ env.COMPOSER_CACHE_FILES_DIR }} - key: ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-${{ hashFiles('**/composer.*') }} + key: ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}-${{ hashFiles('**/composer.*') }} restore-keys: | + ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}-os-${{ inputs.os }}- ${{ inputs.job-id || github.job }}-php-${{ inputs.php-version }}- ${{ inputs.job-id || github.job }}- @@ -107,10 +119,12 @@ jobs: env: COVERAGE_OPTION: ${{ inputs.enable-coverage && format('--coverage-php build/cov/coverage-{0}.cov', env.ARTIFACT_NAME) || '--no-coverage' }} GROUP_OPTION: ${{ inputs.group-name && format('--group {0}', inputs.group-name) || '' }} + shell: bash - name: Run tests - run: script -e -c "vendor/bin/phpunit --color=always ${{ env.EXTRA_PHPUNIT_OPTIONS }}" + run: vendor/bin/phpunit --color=always ${{ env.EXTRA_PHPUNIT_OPTIONS }} env: + DB: SQLite3 TACHYCARDIA_MONITOR_GA: ${{ inputs.enable-profiling && 'enabled' || '' }} TERM: xterm-256color diff --git a/.github/workflows/test-autoreview.yml b/.github/workflows/test-autoreview.yml index dfe4892bdebe..f3f0edad8af8 100644 --- a/.github/workflows/test-autoreview.yml +++ b/.github/workflows/test-autoreview.yml @@ -27,5 +27,6 @@ jobs: with: job-name: Automatic Code Review [PHP 8.1] php-version: '8.1' + os: ubuntu-22.04 job-id: auto-review-tests group-name: AutoReview diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index 7a728a965108..38174381a726 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -158,6 +158,22 @@ jobs: enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }} extra-extensions: redis, memcached + windows-tests: + needs: + - coverage-php-version + - sanity-tests + + uses: ./.github/workflows/reusable-serviceless-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo + with: + job-name: Windows Tests + php-version: '8.1' + os: windows-2022 + job-id: windows-tests + enable-artifact-upload: ${{ '8.1' == needs.coverage-php-version.outputs.version }} + enable-coverage: ${{ '8.1' == needs.coverage-php-version.outputs.version }} + enable-profiling: ${{ '8.1' == needs.coverage-php-version.outputs.version }} + extra-extensions: redis, memcached, sodium, sqlite3 + coveralls: name: Upload coverage results to Coveralls if: github.repository_owner == 'codeigniter4' @@ -167,6 +183,7 @@ jobs: - cache-live-tests - database-live-tests - separate-process-tests + - windows-tests uses: ./.github/workflows/reusable-coveralls.yml # @TODO Extract to codeigniter4/.github repo with: