From 4f64bd44c40813c98b389120e1ad9cd2060042d8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:57:29 +0530 Subject: [PATCH] #123 run script, pass generated matrix to next job --- .github/workflows/scheduled_tests.yaml | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 83a0d986b..b7aae94ee 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -11,20 +11,36 @@ on: - cron: '0 9 * * *' jobs: + # Dynamically create a matrix of OS, Python, and PyBaMM versions + create_pybamm_matrix: + runs-on: ubuntu-latest + outputs: + pybop_matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Check out PyBOP repository + uses: actions/checkout@v4 + with: + path: .github/workflows/build_matrix.sh + + - name: Dynamically create GitHub Actions matrix + id: set-matrix + run: | + bash .github/workflows/build_matrix.sh >> matrix_json + echo "matrix=$(cat matrix_json)" >> "$GITHUB_OUTPUT" + build: + needs: [create_pybamm_matrix] runs-on: ${{ matrix.os }} strategy: fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + matrix: ${{fromJson(needs.create_pybamm_matrix.outputs.pybop_matrix)}} steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python_version }} - name: Install dependencies run: | python -m pip install --upgrade pip nox @@ -33,7 +49,7 @@ jobs: python -m nox -s unit python -m nox -s notebooks - #M-series Mac Mini + # M-series Mac Mini build-apple-mseries: runs-on: [self-hosted, macOS, ARM64] env: @@ -41,7 +57,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python_version: ["3.10"] steps: - uses: actions/checkout@v4 @@ -49,14 +65,14 @@ jobs: shell: bash run: | eval "$(pyenv init -)" - pyenv install ${{ matrix.python-version }} -s - pyenv virtualenv ${{ matrix.python-version }} pybop-${{ matrix.python-version }} + pyenv install ${{ matrix.python_version }} -s + pyenv virtualenv ${{ matrix.python_version }} pybop-${{ matrix.python_version }} - name: Install dependencies & run unit tests shell: bash run: | eval "$(pyenv init -)" - pyenv activate pybop-${{ matrix.python-version }} + pyenv activate pybop-${{ matrix.python_version }} python -m pip install --upgrade pip wheel setuptools nox python -m nox -s unit python -m nox -s notebooks @@ -66,5 +82,5 @@ jobs: shell: bash run: | eval "$(pyenv init -)" - pyenv activate pybop-${{ matrix.python-version }} + pyenv activate pybop-${{ matrix.python_version }} pyenv uninstall -f $( python --version )