Collect Info #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Collect Info | |
| # This workflow do the following: | |
| # 1. Checkout the repository | |
| # 2. Checkout the optiprofiler repository | |
| # 3. Copy files in .github/actions/collect_info to the root directory | |
| # 4. Set up python and install dependencies | |
| # 5. Run in python 's_get_para.py' to get parametric problems for python | |
| # 6. Run in python 's_getInfo.py' to get problem information for python | |
| # 7. Upload 'probinfo_python.csv', 'feasibility_python.txt', 'timeout_problems_python.txt', and 'log_python.txt' as artifacts | |
| on: | |
| # Run after the sync workflow completes to ensure we have the latest problems | |
| workflow_run: | |
| workflows: ["Sync S2MPJ Python Subset"] | |
| types: | |
| - completed | |
| # Allow manual triggering from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 | |
| # runs-on: self-hosted | |
| # timeout-minutes: 1440 | |
| strategy: | |
| matrix: | |
| language: [python] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Checkout OptiProfiler | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: optiprofiler/optiprofiler | |
| path: optiprofiler | |
| submodules: recursive | |
| ref: reorganize | |
| - name: Copy collect_info files to root directory | |
| run: | | |
| cp -r .github/actions/collect_info/* . | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Get parametric problems in Python | |
| if: matrix.language == 'python' | |
| run: | | |
| python3 -m s_get_para 'python' | |
| - name: Get parametric problems in MATLAB | |
| if: matrix.language == 'matlab' | |
| run: | | |
| python3 -m s_get_para 'matlab' | |
| - name: Set up MATLAB | |
| if: matrix.language == 'matlab' | |
| uses: matlab-actions/setup-matlab@v2.1.1 | |
| with: | |
| release: R2024a | |
| products: Optimization_Toolbox Parallel_Computing_Toolbox | |
| - name: Run setup and run script in MATLAB | |
| if: matrix.language == 'matlab' | |
| uses: matlab-actions/run-command@v2.1.1 | |
| with: | |
| command: | | |
| cd optiprofiler | |
| options = struct('install_matcutest', false) | |
| setup(options) | |
| cd .. | |
| s_getInfo | |
| - name: Install OptiProfiler (python) with develop mode | |
| if: matrix.language == 'python' | |
| run: | | |
| cd optiprofiler | |
| pip install -e . | |
| cd .. | |
| - name: Run Python script | |
| if: matrix.language == 'python' | |
| run: | | |
| MAX_RETRIES=50 | |
| COUNT=0 | |
| while [ $COUNT -lt $MAX_RETRIES ]; do | |
| python3 s_getInfo.py | |
| EXIT_CODE=$? | |
| if [ $EXIT_CODE -eq 0 ]; then | |
| echo "Script completed successfully." | |
| break | |
| fi | |
| echo "Script crashed with exit code $EXIT_CODE. Restarting ($((COUNT+1))/$MAX_RETRIES)..." | |
| COUNT=$((COUNT+1)) | |
| # Small sleep to avoid rapid fire restarts | |
| sleep 2 | |
| done | |
| if [ $COUNT -eq $MAX_RETRIES ]; then | |
| echo "Reached maximum retry limit." | |
| exit 1 | |
| fi | |
| - name: Upload Python artifacts | |
| if: always() && matrix.language == 'python' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: probinfo-files-python | |
| if-no-files-found: ignore | |
| path: | | |
| probinfo_python.csv | |
| probinfo_python_temp.csv | |
| feasibility_python.txt | |
| feasibility_python_temp.txt | |
| timeout_problems_python.txt | |
| timeout_problems_python_temp.txt | |
| log_python.txt | |
| log_python_temp.txt | |
| exclude_python.txt | |
| current_problem.txt | |
| - name: Upload MATLAB artifacts | |
| if: matrix.language == 'matlab' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: probinfo-files-matlab | |
| path: | | |
| probinfo_matlab.csv | |
| probinfo_matlab.mat | |
| probinfo_matlab.txt | |
| feasibility_matlab.txt | |
| timeout_problems_matlab.txt | |
| log_matlab.txt |