Fix types of date handling variables #533
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "PHP checks" | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP 8.3 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mbstring, pdo, sqlite | |
| coverage: none # Use 'xdebug' or 'pcov' for code coverage | |
| tools: composer | |
| - name: validate configuration | |
| run: composer validate | |
| - name: composer install packages | |
| run: composer install | |
| - name: Lint | |
| run: make lint-php-ci | |
| - name: phpcs | |
| run: make phpcs-ci | |
| - name: audit dependencies | |
| run: composer audit | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: test_twfy | |
| options: >- | |
| --health-cmd="mysqladmin ping" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| ports: | |
| - 3306:3306 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed for SonarCloud analysis | |
| - name: Checkout phplib | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: openaustralia/phplib | |
| path: phplib-checkout | |
| ref: main | |
| - name: Switch phplib to PR branch if it exists | |
| run: git fetch origin ${{ github.head_ref || github.ref_name }} && git checkout ${{ github.head_ref || github.ref_name }} || echo "No PR branch found, using main" | |
| working-directory: phplib-checkout | |
| - name: Link phplib as sibling | |
| run: ln -s ${{ github.workspace }}/phplib-checkout ../phplib | |
| - name: Setup PHP 8.3 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mbstring, mysqli | |
| coverage: xdebug | |
| tools: composer | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Load database schema | |
| run: | | |
| mysql -h 127.0.0.1 -u root -proot test_twfy < db/schema.sql | |
| - name: Run tests with coverage | |
| run: | | |
| set -o pipefail | |
| XDEBUG_MODE=coverage ./vendor/bin/phpunit \ | |
| --coverage-text \ | |
| --coverage-clover=coverage/clover.xml \ | |
| --coverage-html=coverage/html \ | |
| --log-junit=coverage/junit.xml | tee phpunit-coverage.out | |
| env: | |
| DB_HOST: 127.0.0.1 | |
| DB_USER: root | |
| DB_PASSWORD: root | |
| DB_NAME: test_twfy | |
| - name: Build coverage summary | |
| run: | | |
| { | |
| echo "## Code Coverage" | |
| echo | |
| echo '```text' | |
| if grep -q '^Code Coverage Report:' phpunit-coverage.out; then | |
| sed -n '/^Code Coverage Report:/,$p' phpunit-coverage.out | |
| else | |
| echo "Coverage summary not found in phpunit output." | |
| fi | |
| echo '```' | |
| } > code-coverage-results.md | |
| - name: Add coverage to job summary | |
| run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Post coverage comment on PR | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| # - name: SonarCloud Scan | |
| # uses: SonarSource/sonarcloud-github-action@master | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |