diff --git a/.github/workflows/cd.yml b/.github/workflows/deployer.yml similarity index 100% rename from .github/workflows/cd.yml rename to .github/workflows/deployer.yml diff --git a/.github/workflows/master_cleaner.yml b/.github/workflows/master_cleaner.yml new file mode 100644 index 00000000..e57837d7 --- /dev/null +++ b/.github/workflows/master_cleaner.yml @@ -0,0 +1,29 @@ +name: Master Cleaner + +on: + push: + branches: + - master + +jobs: + formatter: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: psf/black@stable + with: + src: "./ezyrb" + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: "Format Python code with psf/black push" + commit-message: ":art: Format Python code with psf/black" + body: | + There appear to be some python formatting errors in ${{ github.sha }}. This pull request + uses the [psf/black](https://github.com/psf/black) formatter to fix these issues. + base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch + branch: actions/black \ No newline at end of file diff --git a/.github/workflows/monthly-tagger.yml b/.github/workflows/monthly-tagger.yml new file mode 100644 index 00000000..c41ff9b9 --- /dev/null +++ b/.github/workflows/monthly-tagger.yml @@ -0,0 +1,46 @@ +name: "Monthly Tagger" + +on: + schedule: + - cron: '20 2 1 * *' + +jobs: + + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install .[test] + - name: Test with pytest + run: | + python3 -m pytest + + monthly_tag: + runs-on: ubuntu-latest + needs: test + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT_EZYRB_PUSH }} + + - name: Create and push the tag + run: | + python utils/mathlab_versioning.py set --only-date "post$(date +%y%m)" + VERS=$(python utils/mathlab_versioning.py get) + git config --global user.name 'Monthly Tag bot' + git config --global user.email 'mtbot@noreply.github.com' + git add pyproject.toml + git commit -m "monthly version $VERS" + git tag -a "v$VERS" -m "Monthly version $VERS" + git push origin "v$VERS" diff --git a/.github/workflows/tester.yml b/.github/workflows/tester.yml new file mode 100644 index 00000000..b9a68f70 --- /dev/null +++ b/.github/workflows/tester.yml @@ -0,0 +1,113 @@ +name: "Testing Pull Request" + +on: + pull_request: + branches: + - "master" + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + env: + CFLAGS: "-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types" + CXXFLAGS: "-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types" + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install system dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libboost-serialization-dev libprotobuf-dev protobuf-compiler libopenblas-dev liblapack-dev + + - name: Set up Java for PyCOMPSs + if: runner.os == 'Linux' + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Install Python dependencies + shell: bash + run: | + python3 -m pip install --upgrade pip + python3 -m pip install setuptools wheel + if [ "$RUNNER_OS" == "Linux" ]; then + python3 -m pip install pycompss --no-build-isolation + fi + python3 -m pip install .[test] + + - name: Test with pytest + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + python3 -m pytest + else + python3 -m pytest --ignore=tests/test_parallel/ + fi + + linter: #################################################################### + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run Black formatter (check mode) + uses: psf/black@stable + with: + src: "./ezyrb" + + testdocs: ################################################################## + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Python dependencies + run: python3 -m pip install .[docs] + + - name: Build Documentation + run: | + make html SPHINXOPTS+='-W' + working-directory: docs/ + + coverage: ################################################################## + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install system dependencies (Linux) + run: | + sudo apt-get update + sudo apt-get install -y libboost-serialization-dev libprotobuf-dev protobuf-compiler libopenblas-dev liblapack-dev + + - name: Install Python dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install setuptools wheel + python3 -m pip install pycompss --no-build-isolation + python3 -m pip install .[test] + + - name: Generate coverage report + run: | + python3 -m pytest --cov-report term --cov-report xml:cobertura.xml --cov=ezyrb + + - name: Produce the coverage report + uses: insightsengineering/coverage-action@v2 + with: + path: ./cobertura.xml + threshold: 80.00 + fail: true + publish: true + coverage-summary-title: "Code Coverage Summary" \ No newline at end of file diff --git a/.github/workflows/testing_pr.yml b/.github/workflows/testing_pr.yml deleted file mode 100644 index bbdef74f..00000000 --- a/.github/workflows/testing_pr.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: "Testing Pull Request" - -on: - pull_request: - branches: - - "master" - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest, macos-latest, ubuntu-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - env: - CFLAGS: "-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types" - CXXFLAGS: "-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types" - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install system dependencies (Linux) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libboost-serialization-dev libprotobuf-dev protobuf-compiler libopenblas-dev liblapack-dev - - - name: Set up Java for PyCOMPSs - if: runner.os == 'Linux' - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '11' - - - name: Install Python dependencies - shell: bash - run: | - python3 -m pip install --upgrade pip - python3 -m pip install setuptools wheel - if [ "$RUNNER_OS" == "Linux" ]; then - python3 -m pip install pycompss --no-build-isolation - fi - python3 -m pip install .[test] - - - name: Test with pytest - shell: bash - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - python3 -m pytest - else - python3 -m pytest --ignore=tests/test_parallel/ - fi \ No newline at end of file diff --git a/.github/workflows/tutorial_exporter.yml b/.github/workflows/tutorial_exporter.yml new file mode 100644 index 00000000..7585faf7 --- /dev/null +++ b/.github/workflows/tutorial_exporter.yml @@ -0,0 +1,140 @@ +name: "Export Tutorials" + +on: + workflow_dispatch: + push: + branches: + - "dev" + - "master" + paths: + - 'tutorials/**/*.ipynb' + +jobs: + # run on push + export_tutorials_on_push: + if: ${{ github.event_name == 'push' }} + permissions: write-all + runs-on: ubuntu-latest + env: + TUTORIAL_TIMEOUT: 1200s + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + # Dependencies for tutorials + python3 -m pip install --upgrade pip .[tutorial,docs] black[jupyter] + - name: Setup FFmpeg + uses: FedericoCarboni/setup-ffmpeg@v2 + + - id: files + uses: jitterbit/get-changed-files@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + format: space-delimited + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Run formatter + run: black tutorials/ + + - name: Export tutorials to .py and .html + run: | + set -x + for file in ${{ steps.files.outputs.all }}; do + if [[ $file == *.ipynb ]]; then + filename=$(basename $file) + pyfilename=$(echo ${filename%?????})py + timeout --signal=SIGKILL $TUTORIAL_TIMEOUT python -Xfrozen_modules=off -m jupyter nbconvert $file --to python --output $pyfilename --output-dir=$(dirname $file) + htmlfilename=$(echo ${filename%?????} | sed -e 's/-//g')html + htmldir="docs/source"/$(echo ${file%??????????????} | sed -e 's/-//g') + timeout --signal=SIGKILL $TUTORIAL_TIMEOUT python -Xfrozen_modules=off -m jupyter nbconvert --execute $file --to html --output $htmlfilename --output-dir=$htmldir + fi + done + set +x + + - uses: benjlevesque/short-sha@v2.1 + id: short-sha + + - name: Remove unwanted files + run: | + rm -rf build/ tutorials/tutorial4/data/ + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5.0.2 + with: + labels: maintenance + title: Export tutorial changed in ${{ steps.short-sha.outputs.sha }} + branch: export-tutorial-${{ steps.short-sha.outputs.sha }} + base: ${{ github.head_ref }} + commit-message: export tutorials changed in ${{ steps.short-sha.outputs.sha }} + delete-branch: true + + # run on workflow_dispatch + export_tutorials_workflow_dispatch: + if: ${{ github.event_name == 'workflow_dispatch' }} + permissions: write-all + runs-on: ubuntu-latest + env: + TUTORIAL_TIMEOUT: 1200s + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip .[tutorial,docs] black[jupyter] + + - name: Setup FFmpeg + uses: FedericoCarboni/setup-ffmpeg@v2 + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Run formatter + run: black tutorials/ + + - name: Export all tutorials to .py and .html + run: | + set -x + # Find all .ipynb files in the tutorials directory + for file in $(find tutorials -type f -name "*.ipynb"); do + filename=$(basename $file) + pyfilename="${filename%.ipynb}.py" + timeout --signal=SIGKILL $TUTORIAL_TIMEOUT python -Xfrozen_modules=off -m jupyter nbconvert $file --to python --output $pyfilename --output-dir=$(dirname $file) + htmlfilename="${filename%.ipynb}.html" + htmldir="docs/source"/$(dirname $file) + timeout --signal=SIGKILL $TUTORIAL_TIMEOUT python -Xfrozen_modules=off -m jupyter nbconvert --execute $file --to html --output $htmlfilename --output-dir=$htmldir + done + set +x + + - uses: benjlevesque/short-sha@v2.1 + id: short-sha + + - name: Remove unwanted files + run: | + rm -rf build/ tutorials/tutorial4/data/ + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5.0.2 + with: + labels: maintenance + title: Export tutorial changed in ${{ steps.short-sha.outputs.sha }} + branch: export-tutorial-${{ steps.short-sha.outputs.sha }} + base: ${{ github.head_ref }} + commit-message: export tutorials changed in ${{ steps.short-sha.outputs.sha }} + delete-branch: true diff --git a/pyproject.toml b/pyproject.toml index 33e82139..ccd65d88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,10 @@ dev = [ parallel = [ "pycompss" ] +tutorial = [ + "jupyter", + "smithers" +] [project.urls] Homepage = "https://github.com/mathLab/EZyRB"