From 27364a75c707c69ba55773f2081c594ca54122c8 Mon Sep 17 00:00:00 2001 From: vsyrgkanis Date: Fri, 28 Jun 2024 07:45:37 -0700 Subject: [PATCH 1/6] Update python-package-conda.yml --- .github/workflows/python-package-conda.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index a9d3ec90..90d9dff2 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -19,23 +19,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Set up Git + uses: actions/setup-git@v1 + - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.10' # Use Python 3.10 - - name: Install git - run: | - if [[ "$RUNNER_OS" == "Linux" ]]; then - sudo apt-get update - sudo apt-get install -y git - elif [[ "$RUNNER_OS" == "macOS" ]]; then - brew install git - elif [[ "$RUNNER_OS" == "Windows" ]]; then - choco install git - fi - shell: bash - - name: Install dependencies run: | python -m pip install --upgrade pip From 72edebd014a118cd2d5ccf15960ab1e522af316b Mon Sep 17 00:00:00 2001 From: vsyrgkanis Date: Fri, 28 Jun 2024 07:46:55 -0700 Subject: [PATCH 2/6] Update python-package-conda.yml --- .github/workflows/python-package-conda.yml | 81 ---------------------- 1 file changed, 81 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 90d9dff2..7d704dea 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -17,84 +17,3 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Git - uses: actions/setup-git@v1 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.10' # Use Python 3.10 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install jupyter nbconvert flake8 flake8-nb - shell: bash - - - name: Create Flake8 configuration file - run: | - echo "[flake8]" > .flake8 - echo "max-line-length = 99" >> .flake8 - shell: bash - - - name: Run Flake8 linting on notebooks - id: lint - run: | - mkdir -p linting_logs - flake8_errors=0 - for notebook in PM1/*.ipynb; do - [ -e "$notebook" ] || continue - flake8-nb --config=.flake8 "$notebook" > "linting_logs/$(basename "$notebook" .ipynb)_linting.txt" 2>&1 || flake8_errors=$((flake8_errors+1)) - done - echo "flake8_errors=$flake8_errors" >> $GITHUB_ENV - shell: bash - - - name: Convert Jupyter notebooks to Python scripts - id: convert - run: | - mkdir -p converted_scripts - for notebook in PM1/*.ipynb; do - [ -e "$notebook" ] || continue - jupyter nbconvert --to script "$notebook" --output-dir converted_scripts - done - shell: bash - - - name: Run converted Python scripts - id: execute - run: | - mkdir -p logs - script_errors=0 - for script in converted_scripts/*.py; do - [ -e "$script" ] || continue - echo "Running $script" - python "$script" > "logs/$(basename "$script" .py).txt" 2>&1 || script_errors=$((script_errors+1)) - done - echo "script_errors=$script_errors" >> $GITHUB_ENV - shell: bash - - - name: Aggregate and report errors and warnings - run: | - echo "Aggregating errors and warnings..." - grep -E "Error|Warning" logs/*.txt linting_logs/*.txt > logs/errors_and_warnings.txt || true - echo "Errors and Warnings:" - cat logs/errors_and_warnings.txt - shell: bash - - - name: Upload linting logs - uses: actions/upload-artifact@v2 - with: - name: linting-logs - path: linting_logs - - - name: Upload execution logs - uses: actions/upload-artifact@v2 - with: - name: execution-logs - path: logs - - - name: Check for errors - if: ${{ env.flake8_errors != '0' || env.script_errors != '0' }} - run: exit 1 From fc736efbdf6587aa8340680787c9c41fdce5b5b3 Mon Sep 17 00:00:00 2001 From: vsyrgkanis Date: Fri, 28 Jun 2024 07:47:58 -0700 Subject: [PATCH 3/6] Update python-package-conda.yml --- .github/workflows/python-package-conda.yml | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 7d704dea..0d908abc 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -17,3 +17,93 @@ jobs: steps: - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install git + run: | + if [[ "$RUNNER_OS" == "Linux" ]]; then + sudo apt-get update + sudo apt-get install -y git + elif [[ "$RUNNER_OS" == "macOS" ]]; then + brew install git + elif [[ "$RUNNER_OS" == "Windows" ]]; then + choco install git -y --no-progress || (Start-Sleep -Seconds 30; choco install git -y --no-progress) + fi + shell: bash + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' # Use Python 3.10 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install jupyter nbconvert flake8 flake8-nb + shell: bash + + - name: Create Flake8 configuration file + run: | + echo "[flake8]" > .flake8 + echo "max-line-length = 99" >> .flake8 + shell: bash + + - name: Run Flake8 linting on notebooks + id: lint + run: | + mkdir -p linting_logs + flake8_errors=0 + for notebook in PM1/*.ipynb; do + [ -e "$notebook" ] || continue + flake8-nb --config=.flake8 "$notebook" > "linting_logs/$(basename "$notebook" .ipynb)_linting.txt" 2>&1 || flake8_errors=$((flake8_errors+1)) + done + echo "flake8_errors=$flake8_errors" >> $GITHUB_ENV + shell: bash + + - name: Convert Jupyter notebooks to Python scripts + id: convert + run: | + mkdir -p converted_scripts + for notebook in PM1/*.ipynb; do + [ -e "$notebook" ] || continue + jupyter nbconvert --to script "$notebook" --output-dir converted_scripts + done + shell: bash + + - name: Run converted Python scripts + id: execute + run: | + mkdir -p logs + script_errors=0 + for script in converted_scripts/*.py; do + [ -e "$script" ] || continue + echo "Running $script" + python "$script" > "logs/$(basename "$script" .py).txt" 2>&1 || script_errors=$((script_errors+1)) + done + echo "script_errors=$script_errors" >> $GITHUB_ENV + shell: bash + + - name: Aggregate and report errors and warnings + run: | + echo "Aggregating errors and warnings..." + grep -E "Error|Warning" logs/*.txt linting_logs/*.txt > logs/errors_and_warnings.txt || true + echo "Errors and Warnings:" + cat logs/errors_and_warnings.txt + shell: bash + + - name: Upload linting logs + uses: actions/upload-artifact@v2 + with: + name: linting-logs + path: linting_logs + + - name: Upload execution logs + uses: actions/upload-artifact@v2 + with: + name: execution-logs + path: logs + + - name: Check for errors + if: ${{ env.flake8_errors != '0' || env.script_errors != '0' }} + run: exit 1 From ef47706c31bd7102c9b9b804e845abd96b11d67e Mon Sep 17 00:00:00 2001 From: vsyrgkanis Date: Fri, 28 Jun 2024 07:52:27 -0700 Subject: [PATCH 4/6] Update python-package-conda.yml --- .github/workflows/python-package-conda.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 0d908abc..15393cda 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -21,13 +21,13 @@ jobs: - name: Install git run: | - if [[ "$RUNNER_OS" == "Linux" ]]; then + if [ "$RUNNER_OS" == "Linux" ]; then sudo apt-get update sudo apt-get install -y git - elif [[ "$RUNNER_OS" == "macOS" ]]; then + elif [ "$RUNNER_OS" == "macOS" ]; then brew install git - elif [[ "$RUNNER_OS" == "Windows" ]]; then - choco install git -y --no-progress || (Start-Sleep -Seconds 30; choco install git -y --no-progress) + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install git -y --no-progress || powershell -Command "Start-Sleep -Seconds 30; choco install git -y --no-progress" fi shell: bash From 1d26401f27c6c852c8533c31a2faa2df31083789 Mon Sep 17 00:00:00 2001 From: vsyrgkanis Date: Fri, 28 Jun 2024 07:56:52 -0700 Subject: [PATCH 5/6] Update python-package-conda.yml --- .github/workflows/python-package-conda.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 15393cda..16336d73 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -40,7 +40,7 @@ jobs: run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install jupyter nbconvert flake8 flake8-nb + pip install jupyter nbconvert flake8 flake8-nb ipython shell: bash - name: Create Flake8 configuration file @@ -71,7 +71,7 @@ jobs: done shell: bash - - name: Run converted Python scripts + - name: Run converted Python scripts with IPython id: execute run: | mkdir -p logs @@ -79,7 +79,7 @@ jobs: for script in converted_scripts/*.py; do [ -e "$script" ] || continue echo "Running $script" - python "$script" > "logs/$(basename "$script" .py).txt" 2>&1 || script_errors=$((script_errors+1)) + ipython "$script" > "logs/$(basename "$script" .py).txt" 2>&1 || script_errors=$((script_errors+1)) done echo "script_errors=$script_errors" >> $GITHUB_ENV shell: bash From c311161c3f0dd3c974e7f05f641a6ec248112bc3 Mon Sep 17 00:00:00 2001 From: vsyrgkanis Date: Fri, 28 Jun 2024 08:00:09 -0700 Subject: [PATCH 6/6] Update python-package-conda.yml --- .github/workflows/python-package-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 16336d73..1571f611 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -46,7 +46,7 @@ jobs: - name: Create Flake8 configuration file run: | echo "[flake8]" > .flake8 - echo "max-line-length = 99" >> .flake8 + echo "max-line-length = 119" >> .flake8 shell: bash - name: Run Flake8 linting on notebooks