From 01c113b61fcc8ca91a53b0839f678fa2fa16cd4b Mon Sep 17 00:00:00 2001 From: Samuel Cupp Date: Thu, 9 Mar 2023 13:22:52 -0800 Subject: [PATCH 1/5] Added local action for OS/python environment setup --- .github/actions/OS_setup/action.yml | 56 +++++++++++++++++++ .github/workflows/github-actions-MacOS12.yml | 12 ++-- .github/workflows/github-actions-ubuntu20.yml | 44 +++------------ .github/workflows/github-actions-ubuntu22.yml | 22 ++------ .../workflows/github-actions-windows2022.yml | 11 ++-- 5 files changed, 76 insertions(+), 69 deletions(-) create mode 100644 .github/actions/OS_setup/action.yml diff --git a/.github/actions/OS_setup/action.yml b/.github/actions/OS_setup/action.yml new file mode 100644 index 00000000..bffe5567 --- /dev/null +++ b/.github/actions/OS_setup/action.yml @@ -0,0 +1,56 @@ +name: OS-setup +description: 'Setup requested OS and python environment' +inputs: + OS: + description: OS for test + required: true + default: 'Ubuntu' + python-version: + description: python version for test + required: true + default: '3.8' + sympy-version: + description: sympy version for test + required: true + default: 'sympy' + + +runs: + using: "composite" + steps: + - uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + - if: inputs.OS == 'ubuntu' + run: | + # use apt-spy2 to select closest apt mirror, + # which helps avoid connectivity issues in Azure; + # see https://github.com/actions/virtual-environments/issues/675 + sudo gem install apt-spy2 + sudo apt-spy2 fix --commit --launchpad --country=US + # after selecting a specific mirror, we need to run 'apt-get update' + sudo apt-get update + sudo apt-get install -y texlive-latex-base colordiff pandoc ffmpeg + - run: | + python -m pip install --upgrade pip setuptools + python -m pip install --upgrade nbconvert + python -m pip install testfixtures ${{ inputs.sympy-version }} mpmath jupyter matplotlib scipy nrpylatex + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + +# +#ubuntu 22 +# JupdevSymPy: +# python -m pip install --upgrade git+https://github.com/sympy/sympy/ +# python -m pip install testfixtures mpmath jupyter matplotlib scipy nrpylatex +# +# UnitTestdevSymPy: +# sudo apt-get install -y texlive-latex-base colordiff pandoc +# python -m pip install --upgrade git+https://github.com/sympy/sympy/ +# python -m pip install testfixtures mpmath jupyter matplotlib scipy nrpylatex +# +#ubuntu 20 +# coreJupdevSymPy: +# - name: Install dependencies +# run: | +# python -m pip install --upgrade git+https://github.com/sympy/sympy/ +# python -m pip install testfixtures mpmath jupyter matplotlib scipy nrpylatex diff --git a/.github/workflows/github-actions-MacOS12.yml b/.github/workflows/github-actions-MacOS12.yml index 5939256f..c385a782 100644 --- a/.github/workflows/github-actions-MacOS12.yml +++ b/.github/workflows/github-actions-MacOS12.yml @@ -17,16 +17,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - name: Setup OS and python environment + uses: ./.github/actions/OS_setup with: + OS: 'ubuntu' python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install --upgrade nbconvert - python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + sympy-version: 'sympy' - name: UnitTests run: | ./UnitTesting/run_NRPy_UnitTests.sh python3 diff --git a/.github/workflows/github-actions-ubuntu20.yml b/.github/workflows/github-actions-ubuntu20.yml index 2db0bd34..47bce760 100644 --- a/.github/workflows/github-actions-ubuntu20.yml +++ b/.github/workflows/github-actions-ubuntu20.yml @@ -18,26 +18,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - name: Setup OS and python environment + uses: ./.github/actions/OS_setup with: + OS: 'ubuntu' python-version: ${{ matrix.python-version }} - - name: Install needed ubuntu packages - run: | - # use apt-spy2 to select closest apt mirror, - # which helps avoid connectivity issues in Azure; - # see https://github.com/actions/virtual-environments/issues/675 - sudo gem install apt-spy2 - sudo apt-spy2 fix --commit --launchpad --country=US - # after selecting a specific mirror, we need to run 'apt-get update' - sudo apt-get update - sudo apt-get install -y texlive-latex-base colordiff pandoc ffmpeg - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install --upgrade nbconvert - python -m pip install testfixtures ${{ matrix.sympy-version }} mpmath jupyter matplotlib scipy nrpylatex - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + sympy-version: ${{ matrix.sympy-version }} - name: Core Jupyter notebook testsuite run: | ./UnitTesting/core_Jupyter_notebook_testsuite.sh @@ -89,26 +75,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - name: Setup OS and python environment + uses: ./.github/actions/OS_setup with: + OS: 'ubuntu' python-version: ${{ matrix.python-version }} - - name: Install needed ubuntu packages - run: | - # use apt-spy2 to select closest apt mirror, - # which helps avoid connectivity issues in Azure; - # see https://github.com/actions/virtual-environments/issues/675 - sudo gem install apt-spy2 - sudo apt-spy2 fix --commit --launchpad --country=US - # after selecting a specific mirror, we need to run 'apt-get update' - sudo apt-get update - sudo apt-get install -y texlive-latex-base colordiff pandoc ffmpeg - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install --upgrade nbconvert - python -m pip install testfixtures ${{ matrix.sympy-version }} mpmath jupyter matplotlib scipy nrpylatex - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + sympy-version: ${{ matrix.sympy-version }} - name: UnitTests run: | ./UnitTesting/run_NRPy_UnitTests.sh python diff --git a/.github/workflows/github-actions-ubuntu22.yml b/.github/workflows/github-actions-ubuntu22.yml index d4368250..552119a4 100644 --- a/.github/workflows/github-actions-ubuntu22.yml +++ b/.github/workflows/github-actions-ubuntu22.yml @@ -53,26 +53,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - name: Setup OS and python environment + uses: ./.github/actions/OS_setup with: + OS: 'ubuntu' python-version: ${{ matrix.python-version }} - - name: Install needed ubuntu packages - run: | - # use apt-spy2 to select closest apt mirror, - # which helps avoid connectivity issues in Azure; - # see https://github.com/actions/virtual-environments/issues/675 - sudo gem install apt-spy2 - sudo apt-spy2 fix --commit --launchpad --country=US - # after selecting a specific mirror, we need to run 'apt-get update' - sudo apt-get update - sudo apt-get install -y texlive-latex-base colordiff pandoc ffmpeg - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install --upgrade nbconvert - python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + sympy-version: 'sympy' - name: Core Jupyter notebook testsuite run: | ./UnitTesting/core_Jupyter_notebook_testsuite.sh diff --git a/.github/workflows/github-actions-windows2022.yml b/.github/workflows/github-actions-windows2022.yml index f75506a2..118500db 100644 --- a/.github/workflows/github-actions-windows2022.yml +++ b/.github/workflows/github-actions-windows2022.yml @@ -17,19 +17,16 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - name: Setup OS and python environment + uses: ./.github/actions/OS_setup with: + OS: 'ubuntu' python-version: ${{ matrix.python-version }} + sympy-version: 'sympy' # - name: Brew install needed TeX packages (for pdflatex) # run: | # choco install texlive # choco install ffmpeg pandoc - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install --upgrade nbconvert - python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex - name: Core Jupyter notebook testsuite run: | bash ./UnitTesting/run_NRPy_UnitTests.sh python3 From 3e982004a5822639dc984fa1767b9c2fb0e79d1a Mon Sep 17 00:00:00 2001 From: Samuel Cupp Date: Thu, 9 Mar 2023 13:27:12 -0800 Subject: [PATCH 2/5] forgot shell command for action --- .github/actions/OS_setup/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/OS_setup/action.yml b/.github/actions/OS_setup/action.yml index bffe5567..1ad04aa4 100644 --- a/.github/actions/OS_setup/action.yml +++ b/.github/actions/OS_setup/action.yml @@ -31,11 +31,13 @@ runs: # after selecting a specific mirror, we need to run 'apt-get update' sudo apt-get update sudo apt-get install -y texlive-latex-base colordiff pandoc ffmpeg + shell: bash - run: | python -m pip install --upgrade pip setuptools python -m pip install --upgrade nbconvert python -m pip install testfixtures ${{ inputs.sympy-version }} mpmath jupyter matplotlib scipy nrpylatex if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + shell: bash # #ubuntu 22 From 703e6af59f08facdb7ad94645b925ba42feedd6c Mon Sep 17 00:00:00 2001 From: Samuel Cupp Date: Thu, 9 Mar 2023 13:33:05 -0800 Subject: [PATCH 3/5] fixed OS flag for windows CI --- .github/workflows/github-actions-windows2022.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-windows2022.yml b/.github/workflows/github-actions-windows2022.yml index 118500db..258c1beb 100644 --- a/.github/workflows/github-actions-windows2022.yml +++ b/.github/workflows/github-actions-windows2022.yml @@ -20,7 +20,7 @@ jobs: - name: Setup OS and python environment uses: ./.github/actions/OS_setup with: - OS: 'ubuntu' + OS: 'Windows' python-version: ${{ matrix.python-version }} sympy-version: 'sympy' # - name: Brew install needed TeX packages (for pdflatex) From 2a93c31fbd1cc1fc96eb662976ad7d64113f1a15 Mon Sep 17 00:00:00 2001 From: Samuel Cupp Date: Thu, 9 Mar 2023 13:43:19 -0800 Subject: [PATCH 4/5] fixed OS flag for new local action in Mac workflow --- .github/workflows/github-actions-MacOS12.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-MacOS12.yml b/.github/workflows/github-actions-MacOS12.yml index c385a782..420643d9 100644 --- a/.github/workflows/github-actions-MacOS12.yml +++ b/.github/workflows/github-actions-MacOS12.yml @@ -20,7 +20,7 @@ jobs: - name: Setup OS and python environment uses: ./.github/actions/OS_setup with: - OS: 'ubuntu' + OS: 'Mac' python-version: ${{ matrix.python-version }} sympy-version: 'sympy' - name: UnitTests From 30422d666e39147009ef21689239fab609e1cbe6 Mon Sep 17 00:00:00 2001 From: Samuel Cupp Date: Thu, 9 Mar 2023 14:11:37 -0800 Subject: [PATCH 5/5] revert to python@v3 --- .github/actions/OS_setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/OS_setup/action.yml b/.github/actions/OS_setup/action.yml index 1ad04aa4..c1cc9470 100644 --- a/.github/actions/OS_setup/action.yml +++ b/.github/actions/OS_setup/action.yml @@ -18,7 +18,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v3 with: python-version: ${{ inputs.python-version }} - if: inputs.OS == 'ubuntu'