diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16722a2..92c3a73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,32 +54,18 @@ jobs: - name: Check PHP syntax run: find . -name '*.php' -not -path './.git/*' -print0 | xargs -0 -n1 php -l - integration: - name: Joomla ${{ matrix.joomla }}, ${{ matrix.db }}, PHP ${{ matrix.php }} + # The Joomla!/PHP/database combinations are those of the plugin repository + # (tests/ci/matrix.json there), so that both repositories test the same + # combinations and the matrix is raised in one place only. The plugin branch + # is chosen here, once, so that the matrix and the code tested come from the + # same checkout. + matrix: + name: Test matrix runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - { joomla: 5.4.8, php: '8.2', db: 'mysql:8.0' } - - { joomla: 5.4.8, php: '8.2', db: 'postgres:12' } - - { joomla: 6.1.3, php: '8.4', db: 'mariadb:11.4' } - - { joomla: 6.1.3, php: '8.4', db: 'postgres:17' } - env: - JOOMLA_VERSION: ${{ matrix.joomla }} - DB_HOST: 127.0.0.1 - DB_NAME: joomla - DB_PASS: bfstop-test + outputs: + matrix: ${{ steps.read.outputs.matrix }} + plugin-ref: ${{ steps.plugin.outputs.ref }} steps: - - name: Set paths - run: | - { - echo "JOOMLA_ROOT=$RUNNER_TEMP/joomla" - echo "COM_BFSTOP_ROOT=$GITHUB_WORKSPACE" - echo "PLUGIN_ROOT=$RUNNER_TEMP/bfstop" - } >> "$GITHUB_ENV" - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - # use the plugin's branch of the same name if there is one and it # has commits main hasn't (for changes spanning both), else main: a # branch which was merged and not deleted is a stale copy of an old main @@ -104,6 +90,36 @@ jobs: with: repository: codeling/bfstop ref: ${{ steps.plugin.outputs.ref }} + sparse-checkout: tests/ci + - id: read + run: | + echo "matrix=$(jq -c '{include: .include}' tests/ci/matrix.json)" >> "$GITHUB_OUTPUT" + + integration: + name: Joomla ${{ matrix.joomla }}, ${{ matrix.db }}, PHP ${{ matrix.php }} + needs: matrix + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} + env: + JOOMLA_VERSION: ${{ matrix.joomla }} + DB_HOST: 127.0.0.1 + DB_NAME: joomla + DB_PASS: bfstop-test + steps: + - name: Set paths + run: | + { + echo "JOOMLA_ROOT=$RUNNER_TEMP/joomla" + echo "COM_BFSTOP_ROOT=$GITHUB_WORKSPACE" + echo "PLUGIN_ROOT=$RUNNER_TEMP/bfstop" + } >> "$GITHUB_ENV" + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: codeling/bfstop + ref: ${{ needs.matrix.outputs.plugin-ref }} path: bfstop - name: Move bfstop checkout out of the component's run: mv bfstop "$PLUGIN_ROOT"