Skip to content

Commit 87fef83

Browse files
committed
snopt
1 parent a95697b commit 87fef83

5 files changed

Lines changed: 63 additions & 24 deletions

File tree

.github/actions/install_pyoptsparse/action.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ runs:
9797
echo "-------------------------------------------------------------"
9898
echo "Getting SNOPT source"
9999
echo "-------------------------------------------------------------"
100-
scp -qr "$SNOPT_LOCATION" .
100+
.github/actions/install_pyoptsparse/download_snopt.sh
101101
elif [[ "${{ inputs.snopt_version }}" ]]; then
102102
echo "SNOPT version ${{ inputs.snopt_version }} was requested but source is not available"
103103
fi
@@ -185,16 +185,13 @@ runs:
185185
BRANCH="-b v${{ inputs.pyoptsparse_version }}"
186186
fi
187187
188-
if [[ "$SNOPT_VERSION" == "7.7" && -n "$SNOPT_LOCATION_77" ]]; then
188+
if [[ "$SNOPT_VERSION" == "7.7" ]]; then
189189
echo " > Secure copying SNOPT 7.7 over SSH"
190-
mkdir SNOPT
191-
scp -qr "$SNOPT_LOCATION_77" SNOPT
190+
.github/actions/install_pyoptsparse/download_snopt.sh
192191
SNOPT="-s SNOPT/src"
193-
elif [[ "$SNOPT_VERSION" == "7.2" && -n "$SNOPT_LOCATION_72" ]]; then
192+
elif [[ "$SNOPT_VERSION" == "7.2" ]]; then
194193
echo " > Secure copying SNOPT 7.2 over SSH"
195-
mkdir SNOPT
196-
scp -qr "$SNOPT_LOCATION_72" SNOPT
197-
ls -lR SNOPT
194+
.github/actions/install_pyoptsparse/download_snopt.sh
198195
SNOPT="-s SNOPT/source"
199196
elif [[ "$SNOPT_VERSION" ]]; then
200197
echo "SNOPT version $SNOPT_VERSION was requested but source is not available"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# this script will create a SNOPT firectory and populate it
2+
# with the specified version of the SNOPT source code
3+
# via secure copy over SSH
4+
5+
# The version of SNOPT is specified via the SNOPT_VERSION environment variable:
6+
# SNOPT_VERSION=7.7 (for SNOPT 7.7) (default)
7+
# SNOPT_VERSION=7.2 (for SNOPT 7.2)
8+
9+
# The location of the SNOPT source code must be specified via one of
10+
# the following environment variables:
11+
# SNOPT_LOCATION_72 (for SNOPT 7.2, 'source' directory only)
12+
# SNOPT_LOCATION_77 (for SNOPT 7.7, 'src' directory only)
13+
# SNOPT_LOCATION (for SNOPT 7.7, 'SNOPT' directory with build files and 'src' subdirectory)
14+
15+
if [[ -z "$SNOPT_VERSION" ]]; then
16+
echo "SNOPT version (7.2 or 7.7) has not been specified, skipping download."
17+
exit 0
18+
fi
19+
20+
if [[ "$SNOPT_VERSION" == "7.2" ]]; then
21+
if [[ -n "$SNOPT_LOCATION_72" ]]; then
22+
echo "Downloading SNOPT version $SNOPT_VERSION from SNOPT_LOCATION_72 ..."
23+
mkdir SNOPT
24+
scp -qr $SNOPT_LOCATION_72 SNOPT
25+
else
26+
echo "SNOPT location not found for SNOPT version $SNOPT_VERSION, skipping download."
27+
fi
28+
else
29+
if [[ -n "$SNOPT_LOCATION_77" ]]; then
30+
echo "Downloading SNOPT version $SNOPT_VERSION from SNOPT_LOCATION_77 ..."
31+
mkdir SNOPT
32+
scp -qr $SNOPT_LOCATION_77 SNOPT
33+
elif [[ -n "$SNOPT_LOCATION" ]]; then
34+
echo "Downloading SNOPT version $SNOPT_VERSION from SNOPT_LOCATION ..."
35+
scp -qr $SNOPT_LOCATION .
36+
else
37+
echo "SNOPT location not found for SNOPT version $SNOPT_VERSION, skipping download."
38+
fi
39+
fi

.github/workflows/openmdao_docs_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
uses: ./.github/actions/build_docs
145145
with:
146146
matrix_name: ${{ matrix.NAME }}
147-
use_snopt: ${{ format('{0}', matrix.SNOPT_LOCATION_72 != '' || matrix.SNOPT_LOCATION_77 != '') }}
147+
use_snopt: true
148148
SECRET_docs_location: ${{ secrets.DOCS_LOCATION }}
149149
SECRET_slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
150150
publish: ${{ matrix.PUBLISH }}

.github/workflows/openmdao_latest_workflow.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ jobs:
5050
OS: ubuntu-latest
5151
PY: 3
5252
NUMPY: 2
53+
SNOPT: 7.7
5354
PETSc: true
5455

5556
# test latest versions on macos
5657
- NAME: MacOS Latest
5758
OS: macos-latest
5859
PY: 3
5960
NUMPY: 2
61+
SNOPT: 7.7
6062
PETSc: true
6163

6264
runs-on: ${{ matrix.OS }}
@@ -162,6 +164,9 @@ jobs:
162164
163165
- name: Install pyOptSparse
164166
if: ${{ matrix.PYOPTSPARSE }}
167+
env:
168+
SNOPT_LOCATION: ${{ secrets.SNOPT_LOCATION }}
169+
SNOPT_VERSION: ${{ matrix.SNOPT }}
165170
run: |
166171
echo "============================================================="
167172
echo "Define useful functions"
@@ -183,10 +188,7 @@ jobs:
183188
python -m pip install git+https://github.com/OpenMDAO/build_pyoptsparse
184189
BRANCH="-b $(latest_version https://github.com/mdolab/pyoptsparse)"
185190
if [[ "${{ matrix.SNOPT }}" ]]; then
186-
if [[ "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
187-
echo " > Secure copying SNOPT 7.7 over SSH"
188-
mkdir SNOPT
189-
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT
191+
.github/actions/install_pyoptsparse/download_snopt.sh
190192
SNOPT="-s SNOPT/src"
191193
else
192194
echo "SNOPT source is not available"
@@ -269,7 +271,7 @@ jobs:
269271
export PYDEVD_DISABLE_FILE_VALIDATION=1
270272
271273
cd openmdao/docs
272-
if [[ "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
274+
if [[ "${{ matrix.SNOPT }}" ]]; then
273275
echo "============================================================="
274276
echo "Building docs with SNOPT examples."
275277
echo "============================================================="

.github/workflows/openmdao_test_workflow.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ jobs:
262262
- name: Build SNOPT
263263
if: matrix.PYOPTSPARSE_FROM != 'build_pyoptsparse' && matrix.SNOPT
264264
continue-on-error: false
265+
env:
266+
SNOPT_LOCATION: ${{ secrets.SNOPT_LOCATION }}
267+
SNOPT_VERSION: ${{ matrix.SNOPT }}
265268
run: |
266269
echo "============================================================="
267270
echo "Build SNOPT library"
@@ -270,9 +273,7 @@ jobs:
270273
echo "-------------------------------------------------------------"
271274
echo "Getting SNOPT source"
272275
echo "-------------------------------------------------------------"
273-
scp -qr ${{ secrets.SNOPT_LOCATION }} .
274-
elif [[ "${{ matrix.SNOPT }}" ]]; then
275-
echo "SNOPT version ${{ matrix.SNOPT }} was requested but source is not available"
276+
.github/actions/install_pyoptsparse/download_snopt.sh
276277
fi
277278
278279
if [ -d "SNOPT" ] ; then
@@ -332,6 +333,9 @@ jobs:
332333
- name: Install pyOptSparse using build_pyoptsparse
333334
if: matrix.PYOPTSPARSE && matrix.PYOPTSPARSE_FROM == 'build_pyoptsparse'
334335
continue-on-error: false
336+
env:
337+
SNOPT_LOCATION: ${{ secrets.SNOPT_LOCATION }}
338+
SNOPT_VERSION: ${{ matrix.SNOPT }}
335339
run: |
336340
conda install -c conda-forge swig -q -y
337341
@@ -353,16 +357,13 @@ jobs:
353357
PAROPT="-a"
354358
fi
355359
356-
if [[ "${{ matrix.SNOPT }}" == "7.7" && "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
360+
if [[ "${{ matrix.SNOPT }}" == "7.7" ]]; then
357361
echo " > Secure copying SNOPT 7.7 over SSH"
358-
mkdir SNOPT
359-
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT
362+
.github/actions/install_pyoptsparse/download_snopt.sh
360363
SNOPT="-s SNOPT/src"
361-
elif [[ "${{ matrix.SNOPT }}" == "7.2" && "${{ secrets.SNOPT_LOCATION_72 }}" ]]; then
364+
elif [[ "${{ matrix.SNOPT }}" == "7.2" ]]; then
362365
echo " > Secure copying SNOPT 7.2 over SSH"
363-
mkdir SNOPT
364-
scp -qr ${{ secrets.SNOPT_LOCATION_72 }} SNOPT
365-
ls -lR SNOPT
366+
.github/actions/install_pyoptsparse/download_snopt.sh
366367
SNOPT="-s SNOPT/source"
367368
elif [[ "${{ matrix.SNOPT }}" ]]; then
368369
echo "SNOPT version ${{ matrix.SNOPT }} was requested but source is not available"

0 commit comments

Comments
 (0)