Skip to content

Added local action for OS/python environment setup #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/actions/OS_setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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@v3
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
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
# 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
12 changes: 4 additions & 8 deletions .github/workflows/github-actions-MacOS12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'Mac'
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
Expand Down
44 changes: 8 additions & 36 deletions .github/workflows/github-actions-ubuntu20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
22 changes: 4 additions & 18 deletions .github/workflows/github-actions-ubuntu22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/github-actions-windows2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'Windows'
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