diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2fe814..969ab5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,26 +7,29 @@ on: branches: - '*' +env: + COVERAGE_PHP: '8.3' + jobs: testsuite: runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - php-version: ['8.1', '8.2'] + php-version: ['8.1', '8.2', '8.3'] db-type: [sqlite, mysql, pgsql] prefer-lowest: [''] steps: - - name: Setup MySQL latest + - name: Setup MySQL 8.0 if: matrix.db-type == 'mysql' - run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin + run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.0 --default-authentication-plugin=mysql_native_password --disable-log-bin - name: Setup PostgreSQL latest if: matrix.db-type == 'pgsql' run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -38,14 +41,14 @@ jobs: - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - name: Get date part for cache key id: key-date - run: echo "::set-output name=date::$(date +'%Y-%m')" + run: echo "date=$(date +'%Y-%m')" >> "$GITHUB_OUTPUT" - name: Cache composer dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} @@ -59,7 +62,7 @@ jobs: fi - name: Setup problem matchers for PHPUnit - if: matrix.php-version == '8.1' && matrix.db-type == 'mysql' + if: matrix.php-version == env.COVERAGE_PHP && matrix.db-type == 'mysql' run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Run PHPUnit @@ -67,22 +70,25 @@ jobs: if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?encoding=utf8'; fi if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi - if [[ ${{ matrix.php-version }} == '8.1' ]]; then + if [[ "${{ matrix.php-version }}" == "$COVERAGE_PHP" ]]; then export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=coverage.xml else vendor/bin/phpunit fi - name: Submit code coverage - if: matrix.php-version == '8.1' - uses: codecov/codecov-action@v1 + if: matrix.php-version == env.COVERAGE_PHP + uses: codecov/codecov-action@v4 + with: + files: coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} cs-stan: name: Coding Standard & Static Analysis runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -93,14 +99,14 @@ jobs: - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - name: Get date part for cache key id: key-date - run: echo "::set-output name=date::$(date +'%Y-%m')" + run: echo "date=$(date +'%Y-%m')" >> "$GITHUB_OUTPUT" - name: Cache composer dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} diff --git a/.gitignore b/.gitignore index bb48951..729dd94 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ tmp pmip webroot/coverage .php_cs.cache +.phpunit.result.cache