diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index be1cfbb2..3d4649b1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,7 +14,6 @@ on: # Build any PRs and main branch changes - '.github/workflows/coverage-upload.yml' - '.github/workflows/reusable-CI-workflow.yml' - '.github/workflows/reusable-coverage-upload-workflow.yml' - - '.github/workflows/reusable-nightly-tests-workflow.yml' - '.github/workflows/auto-merge-dependabot.yml' push: branches: [ master ] diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml deleted file mode 100644 index 3018c9ee..00000000 --- a/.github/workflows/nightly-tests.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'Nightly' -on: - workflow_run: - workflows: ["CI"] - types: [completed] - -permissions: - contents: read - checks: write # For the check run creation ! - -jobs: - tests: - name: Tests - permissions: - contents: read - checks: write # For the check run creation ! - uses: ./.github/workflows/reusable-nightly-tests-workflow.yml diff --git a/.github/workflows/pre-check-CI-updates.yml b/.github/workflows/pre-check-CI-updates.yml index d4b2dc57..63b9f898 100644 --- a/.github/workflows/pre-check-CI-updates.yml +++ b/.github/workflows/pre-check-CI-updates.yml @@ -16,7 +16,6 @@ on: - '.github/workflows/coverage-upload.yml' - '.github/workflows/reusable-CI-workflow.yml' - '.github/workflows/reusable-coverage-upload-workflow.yml' - - '.github/workflows/reusable-nightly-tests-workflow.yml' - '.github/workflows/auto-merge-dependabot.yml' permissions: @@ -34,14 +33,6 @@ jobs: contents: read uses: ./.github/workflows/reusable-CI-workflow.yml - nightly: - name: Nightly - needs: [tests] - permissions: - contents: read - checks: write # For the check run creation ! - uses: ./.github/workflows/reusable-nightly-tests-workflow.yml - upload: name: Coverage needs: [tests] diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 92a6ad31..ec0814d2 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -3,13 +3,13 @@ name: 'CI reusable workflow' on: workflow_call: +permissions: + contents: read + env: COMPOSER_PREFER_STABLE: '1' TEST_OUTPUT_STYLE: pretty -permissions: - contents: read - jobs: fetch-supported-versions: name: Fetch supported versions @@ -162,3 +162,47 @@ jobs: - name: Dependencies check if: ${{ github.event_name == 'pull_request' }} uses: actions/dependency-review-action@v4 + + nightly-tests: + name: Nightly + needs: [ fetch-supported-versions, tests ] + if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }} + runs-on: ubuntu-latest + permissions: + contents: read + continue-on-error: true + env: + PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next }} + COMPOSER_IGNORE_PLATFORM_REQ: 'php+' + steps: + - name: Check out code + uses: actions/checkout@v5 + + - name: Setup PHP ${{ env.PHP_VERSION }} + id: setup-php + uses: shivammathur/setup-php@v2 + env: + update: true # whether to use latest available patch for the version or not + fail-fast: true # step will fail if an extension or tool fails to set up + with: + php-version: ${{ env.PHP_VERSION }} + tools: composer + coverage: none + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} + uses: actions/cache@v4 + with: + path: | + ${{ steps.composer-cache.outputs.dir }} + # Clear the cache if composer.json (as composer.lock is not available) has been updated + key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }} + + - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} + run: make build + + - name: Test + run: make test-unit && make test-functional diff --git a/.github/workflows/reusable-nightly-tests-workflow.yml b/.github/workflows/reusable-nightly-tests-workflow.yml deleted file mode 100644 index 2917c192..00000000 --- a/.github/workflows/reusable-nightly-tests-workflow.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: 'Nightly reusable workflow' - -on: - workflow_call: - inputs: - ref: - description: Reference in order to fetch code - type: string - required: false - default: "${{ github.event.workflow_run && github.event.workflow_run.referenced_workflows[0] && github.event.workflow_run.referenced_workflows[0].ref || github.ref }}" - -env: - COMPOSER_PREFER_STABLE: '1' - TEST_OUTPUT_STYLE: pretty - -permissions: - contents: read - checks: write # For the check run creation ! - -jobs: - tests: - name: PHP - permissions: - contents: read - checks: write # For the check run creation ! - runs-on: ubuntu-latest - continue-on-error: true - env: - COMPOSER_IGNORE_PLATFORM_REQ: 'php+' - steps: - - name: 'Check run ○' - uses: yoanm/temp-reports-group-workspace/utils/attach-check-run-to-triggering-workflow@v0 - with: - name: 'Nightly / PHP' - fails-on-triggering-workflow-failure: true - - - name: Fetch PHP supported versions - id: fetch-php-versions - uses: yoanm/gha-supported-versions-parser@feature/init - with: - dependency: php - path: .github/workflows/supported-versions.json - ref: "${{ inputs.ref }}" - - - name: Check out code - uses: actions/checkout@v5 - with: - ref: "${{ inputs.ref }}" - - - name: Setup PHP ${{ steps.fetch-php-versions.outputs.next }} - id: setup-php - uses: shivammathur/setup-php@v2 - env: - update: true # whether to use latest available patch for the version or not - fail-fast: true # step will fail if an extension or tool fails to set up - with: - php-version: ${{ steps.fetch-php-versions.outputs.next }} - tools: composer - coverage: none - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} - uses: actions/cache@v4 - with: - path: | - ${{ steps.composer-cache.outputs.dir }} - # Clear the cache if composer.json (as composer.lock is not available) has been updated - key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }} - - - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} - run: make build - - - name: Test - run: make test-unit && make test-functional