[CI] requested by @DavidBruchmann on push #393
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: CI | |
| run-name: "[CI] requested by @${{ github.actor }} on ${{ github.event_name }}" | |
| #----------------------------------------------------------------------------------------------------------------------- | |
| # This workflow defines all required CI execution and test runs required | |
| # to ensure quality for this extension. This may be extended over time. | |
| # | |
| # Note that it is on purpose to not containing a `scheduled` run in here, | |
| # because this will done using `workflow_dispatch` by `scheduled-*.yml`. | |
| # It is absolute required to have for all dispatched branch execution | |
| # this ci.yaml file for the main ci checks in place. | |
| #======================================================================================================================= | |
| on: | |
| push: | |
| pull_request: | |
| types: | |
| - opened | |
| - edited | |
| - reopened | |
| - synchronize | |
| - ready_for_review | |
| workflow_dispatch: | |
| jobs: | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| # Code quality provides low-level and quick executable checks to fail early before | |
| # executing more costly tool executions like unit, functional or acceptance tests. | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| code-quality: | |
| name: "code quality insurance" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php: [ '8.2', '8.3' , '8.4' , '8.5' ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Composer install | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composer -- install | |
| - name: Lint PHP | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lintPhp | |
| - name: CGL | |
| if: ${{ matrix.php <= '8.3' }} | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s cgl -n | |
| - name: Phpstan | |
| if: ${{ matrix.php <= '8.3' }} | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s phpstan | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| # Quick tests provide immediate feedback on basic functionality | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| quick-tests: | |
| name: "Quick Tests (PHP ${{ matrix.php }})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php: [ '8.2', '8.3' ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Composer install | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composer -- install | |
| - name: Install container extension for testing | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composer -- require b13/container:^3.0 --dev --no-interaction | |
| - name: Unit tests | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s unit | |
| timeout-minutes: 5 | |
| - name: Functional tests (SQLite) | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s functional -d sqlite | |
| timeout-minutes: 10 | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| # JavaScript tests validate frontend functionality | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| javascript-tests: | |
| name: "JavaScript Tests" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install JavaScript dependencies | |
| run: npm ci | |
| - name: Run JavaScript tests | |
| run: npm test | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| # Extended tests - focus on reliability over comprehensive database testing | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| tests-extended: | |
| name: "Extended Tests (PHP ${{ matrix.php }})" | |
| runs-on: ubuntu-latest | |
| needs: [quick-tests] | |
| strategy: | |
| matrix: | |
| php: [ '8.2', '8.3' ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js for JavaScript tests | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install JavaScript dependencies | |
| run: npm ci | |
| - name: Composer install | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composer -- install | |
| - name: Install container extension for testing | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composer -- require b13/container:^3.0 --dev --no-interaction | |
| - name: Run extended functional tests with SQLite (reliable) | |
| run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s functional -d sqlite | |
| timeout-minutes: 15 | |
| - name: Run JavaScript tests | |
| run: npm test | |
| timeout-minutes: 5 | |
| documentation: | |
| name: "Extension documentation" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Render documentation | |
| run: Build/Scripts/runTests.sh -s renderDocumentation | |
| - uses: actions/upload-artifact@v4 | |
| id: artifact-upload-step | |
| with: | |
| name: rendered-documentation-folder | |
| path: Documentation-GENERATED-temp/ | |
| compression-level: 9 | |
| if-no-files-found: error | |
| retention-days: 90 | |
| overwrite: true | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| # Multi-version compatibility check ensures the extension works across supported TYPO3 versions | |
| # This job triggers the multi-version workflow and waits for its completion | |
| #--------------------------------------------------------------------------------------------------------------------- | |
| multi-version-compatibility: | |
| name: "Multi-version compatibility check" | |
| runs-on: ubuntu-latest | |
| needs: [quick-tests, javascript-tests, tests-extended] | |
| if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/v5-dev' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Trigger multi-version tests | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| // Check if multi-version workflow exists and trigger it | |
| try { | |
| const workflow = await github.rest.actions.getWorkflowByFilename({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| filename: 'typo3-multi-version-tests.yml' | |
| }); | |
| console.log('Multi-version workflow found, it will run automatically based on the same triggers'); | |
| } catch (error) { | |
| console.log('Multi-version workflow not found, skipping multi-version tests'); | |
| } | |
| - name: Wait for multi-version tests (on PR) | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const maxWaitTime = 30 * 60 * 1000; // 30 minutes | |
| const pollInterval = 30 * 1000; // 30 seconds | |
| const startTime = Date.now(); | |
| while (Date.now() - startTime < maxWaitTime) { | |
| const runs = await github.rest.actions.listWorkflowRuns({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: 'typo3-multi-version-tests.yml', | |
| head_sha: context.sha, | |
| per_page: 1 | |
| }); | |
| if (runs.data.workflow_runs.length > 0) { | |
| const run = runs.data.workflow_runs[0]; | |
| console.log(`Multi-version test status: ${run.status} (${run.conclusion})`); | |
| if (run.status === 'completed') { | |
| if (run.conclusion === 'success') { | |
| console.log('✅ Multi-version tests passed'); | |
| return; | |
| } else { | |
| throw new Error(`❌ Multi-version tests failed with conclusion: ${run.conclusion}`); | |
| } | |
| } | |
| } | |
| await new Promise(resolve => setTimeout(resolve, pollInterval)); | |
| } | |
| throw new Error('⏰ Multi-version tests did not complete within the timeout period'); | |
| # @todo Add unit test execution after use-full tests has been added | |
| # @todo Add functional test execution after use-full tests has been added | |
| # @todo Add acceptance test execution after use-full tests has been added along with infrastructure and setup |