diff --git a/.github/workflows/tests-mpi.yml b/.github/workflows/tests-mpi.yml index 3ea1f1f46f..fd6050bbc7 100644 --- a/.github/workflows/tests-mpi.yml +++ b/.github/workflows/tests-mpi.yml @@ -1,6 +1,7 @@ name: Tests (MPI) on: + workflow_dispatch: push: branches: - master @@ -13,13 +14,29 @@ concurrency: cancel-in-progress: true jobs: + define-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Define workflow matrix + id: set-matrix + run: | + if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ] ; then + echo "Schedule tests (run all the versions)" + echo "matrix={\"python-version\":[\"3.8\", \"3.9\", \"3.10\", \"3.11\"]}" >> $GITHUB_OUTPUT + else + echo "PR push tests (run only the oldest and the latest versions)" + echo "matrix={\"python-version\":[\"3.8\", \"3.11\"]}" >> $GITHUB_OUTPUT + fi + tests-mpi: if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') + needs: define-matrix runs-on: ubuntu-latest strategy: - matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + matrix: ${{fromJson(needs.define-matrix.outputs.matrix)}} steps: - name: Checkout