|
| 1 | +name: Test Package |
| 2 | + |
| 3 | +on: [ push ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build_1: |
| 7 | + |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + os: [ubuntu-latest, windows-2019] |
| 12 | + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] |
| 13 | + |
| 14 | + env: |
| 15 | + SAMNTDIR: ${{ github.workspace }}/../SAM |
| 16 | + NREL_API_KEY: ${{ secrets.NREL_API_KEY }} |
| 17 | + NREL_API_EMAIL: ${{ secrets.NREL_API_EMAIL }} |
| 18 | + |
| 19 | + name: ${{ matrix.os }} ${{ matrix.python-version }} |
| 20 | + steps: |
| 21 | + - name: Checkout Repo |
| 22 | + uses: actions/checkout@v3 |
| 23 | + |
| 24 | + - name: Get PySAM Version Unix |
| 25 | + if: ${{ matrix.os != 'windows-2019' }} |
| 26 | + run: | |
| 27 | + VER=$(python -c "from files.version import __version__; print(__version__)") |
| 28 | + echo "VERSION=$VER" >> $GITHUB_ENV |
| 29 | +
|
| 30 | + - name: Get PySAM Version Windows |
| 31 | + if: ${{ matrix.os == 'windows-2019'}} |
| 32 | + run: | |
| 33 | + $VER=$(python -c "from files.version import __version__; print(__version__)") |
| 34 | + echo "VERSION=$VER" >> $env:GITHUB_ENV |
| 35 | +
|
| 36 | + - name: Install NREL-PySAM |
| 37 | + run: | |
| 38 | + pip install -r requirements.txt |
| 39 | + pip install -r tests/requirements.txt |
| 40 | + pip install nrel-pysam==${{ env.VERSION }} |
| 41 | +
|
| 42 | + - uses: actions/checkout@v3 |
| 43 | + - name: Checkout SAM |
| 44 | + run: | |
| 45 | + cd .. |
| 46 | + git config --global url.https://github.com/.insteadOf git://github.com/ |
| 47 | + git clone https://github.com/NREL/SAM.git |
| 48 | +
|
| 49 | + - name: Unit tests |
| 50 | + run: | |
| 51 | + pytest tests/test_pysam_all.py |
| 52 | + |
| 53 | + build_2: |
| 54 | + runs-on: ${{ matrix.os }} |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + os: [macos-14] |
| 58 | + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] |
| 59 | + |
| 60 | + env: |
| 61 | + SAMNTDIR: ${{ github.workspace }}/../SAM |
| 62 | + NREL_API_KEY: ${{ secrets.NREL_API_KEY }} |
| 63 | + NREL_API_EMAIL: ${{ secrets.NREL_API_EMAIL }} |
| 64 | + |
| 65 | + name: ${{ matrix.os }} ${{ matrix.python-version }} |
| 66 | + steps: |
| 67 | + - name: Install conda Mac arm64 |
| 68 | + run: | |
| 69 | + mkdir -p ~/miniconda3 |
| 70 | + curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh |
| 71 | + bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 |
| 72 | + rm -rf ~/miniconda3/miniconda.sh |
| 73 | + ~/miniconda3/bin/conda init bash |
| 74 | + source /Users/runner/.bash_profile |
| 75 | + conda --version |
| 76 | + yes | conda create --name pysam_env python=${{ matrix.python-version }} |
| 77 | + conda activate pysam_env |
| 78 | + which python |
| 79 | +
|
| 80 | + - name: Checkout Repo |
| 81 | + uses: actions/checkout@v3 |
| 82 | + |
| 83 | + - name: Install NREL-PySAM |
| 84 | + run: | |
| 85 | + source /Users/runner/.bash_profile |
| 86 | + conda activate pysam_env |
| 87 | + VER=$(python -c "from files.version import __version__; print(__version__)") |
| 88 | + echo $VER |
| 89 | + pip install -r requirements.txt |
| 90 | + pip install -r tests/requirements.txt |
| 91 | + pip install nrel-pysam==$VER |
| 92 | + |
| 93 | + - uses: actions/checkout@v3 |
| 94 | + - name: Checkout SAM |
| 95 | + run: | |
| 96 | + cd .. |
| 97 | + git config --global url.https://github.com/.insteadOf git://github.com/ |
| 98 | + git clone https://github.com/NREL/SAM.git |
| 99 | +
|
| 100 | + - name: Unit tests |
| 101 | + run: | |
| 102 | + source /Users/runner/.bash_profile |
| 103 | + conda activate pysam_env |
| 104 | + pytest tests |
| 105 | +
|
| 106 | + build_3: |
| 107 | + runs-on: ${{ matrix.os }} |
| 108 | + strategy: |
| 109 | + matrix: |
| 110 | + os: [macos-14-large] |
| 111 | + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] |
| 112 | + |
| 113 | + env: |
| 114 | + SAMNTDIR: ${{ github.workspace }}/../SAM |
| 115 | + NREL_API_KEY: ${{ secrets.NREL_API_KEY }} |
| 116 | + NREL_API_EMAIL: ${{ secrets.NREL_API_EMAIL }} |
| 117 | + |
| 118 | + name: ${{ matrix.os }} ${{ matrix.python-version }} |
| 119 | + steps: |
| 120 | + - name: Install conda Mac Intel |
| 121 | + run: | |
| 122 | + mkdir -p ~/miniconda3 |
| 123 | + curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3/miniconda.sh |
| 124 | + bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 |
| 125 | + rm -rf ~/miniconda3/miniconda.sh |
| 126 | + ~/miniconda3/bin/conda init bash |
| 127 | + source /Users/runner/.bash_profile |
| 128 | + conda --version |
| 129 | + yes | conda create --name pysam_env python=${{ matrix.python-version }} |
| 130 | + conda activate pysam_env |
| 131 | + which python |
| 132 | +
|
| 133 | + - name: Checkout Repo |
| 134 | + uses: actions/checkout@v3 |
| 135 | + |
| 136 | + - name: Install NREL-PySAM |
| 137 | + run: | |
| 138 | + source /Users/runner/.bash_profile |
| 139 | + conda activate pysam_env |
| 140 | + VER=$(python -c "from files.version import __version__; print(__version__)") |
| 141 | + echo $VER |
| 142 | + pip install -r requirements.txt |
| 143 | + pip install -r tests/requirements.txt |
| 144 | + pip install nrel-pysam==$VER |
| 145 | + |
| 146 | + - uses: actions/checkout@v3 |
| 147 | + - name: Checkout SAM |
| 148 | + run: | |
| 149 | + cd .. |
| 150 | + git config --global url.https://github.com/.insteadOf git://github.com/ |
| 151 | + git clone https://github.com/NREL/SAM.git |
| 152 | +
|
| 153 | + - name: Unit tests |
| 154 | + run: | |
| 155 | + source /Users/runner/.bash_profile |
| 156 | + conda activate pysam_env |
| 157 | + pytest tests |
0 commit comments