From 0763e7c054bab170688f5d904738b1660a26a911 Mon Sep 17 00:00:00 2001 From: Nicola Demo Date: Wed, 19 Mar 2025 16:11:42 +0100 Subject: [PATCH] update github actions --- .github/workflows/black-formatter-test.yml | 19 ----- .github/workflows/ci.yml | 35 --------- .github/workflows/create-release.yml | 18 ----- .github/workflows/deployer.yml | 58 +++++++++++++++ .github/workflows/draft-pdf.yml | 23 ------ ...black-formatter.yml => master_cleaner.yml} | 7 +- .../{monthly-tag.yml => monthly-tagger.yml} | 4 +- .github/workflows/pypi-publish.yml | 31 -------- .github/workflows/sphinx-build.yml | 26 ------- .github/workflows/tester.yml | 73 +++++++++++++++++++ .github/workflows/testing_doc.yml | 23 ------ .github/workflows/testing_pr.yml | 34 --------- ...rt_tutorials.yml => tutorial_exporter.yml} | 6 +- pyproject.toml | 4 - 14 files changed, 141 insertions(+), 220 deletions(-) delete mode 100644 .github/workflows/black-formatter-test.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/deployer.yml delete mode 100644 .github/workflows/draft-pdf.yml rename .github/workflows/{black-formatter.yml => master_cleaner.yml} (89%) rename .github/workflows/{monthly-tag.yml => monthly-tagger.yml} (95%) delete mode 100644 .github/workflows/pypi-publish.yml delete mode 100644 .github/workflows/sphinx-build.yml create mode 100644 .github/workflows/tester.yml delete mode 100644 .github/workflows/testing_doc.yml delete mode 100644 .github/workflows/testing_pr.yml rename .github/workflows/{export_tutorials.yml => tutorial_exporter.yml} (98%) diff --git a/.github/workflows/black-formatter-test.yml b/.github/workflows/black-formatter-test.yml deleted file mode 100644 index 51bdd05..0000000 --- a/.github/workflows/black-formatter-test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Black Formatter (PR Check) - -on: - pull_request: - branches: - - "**" # Run on pull requests for all branches - -jobs: - linter: - name: runner / black - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Run Black formatter (check mode) - uses: psf/black@stable - with: - options: "--check -l 80" - src: "./pina" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f0b91d8..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: "Coverage Deploy to Codacy" - -on: - push: - branches: - - master - -jobs: - test_deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install Python dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install .[test] - - - name: Test with pytest - env: - CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }} - shell: bash - run: | - python3 -m pytest --cov-report term --cov-report xml:cobertura.xml --cov=pina - curl -s https://coverage.codacy.com/get.sh -o CodacyCoverageReporter.sh - chmod +x CodacyCoverageReporter.sh - ./CodacyCoverageReporter.sh report -r cobertura.xml -t $CODACY_API_TOKEN - diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index 946ce9d..0000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Releases - -on: - push: - tags: - - '*' - -jobs: - - build: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v2 - - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deployer.yml b/.github/workflows/deployer.yml new file mode 100644 index 0000000..a72bc67 --- /dev/null +++ b/.github/workflows/deployer.yml @@ -0,0 +1,58 @@ +name: "Deployer" + +on: + push: + tags: + - "*" + +jobs: + + docs: ####################################################################### + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Python dependencies + run: python3 -m pip install .[doc] + + - name: Build Documentation + run: | + make html + working-directory: docs/ + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + #deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} + publish_dir: ./docs/build/html + allow_empty_commit: true + + release_github: ############################################################# + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + pypi: ####################################################################### + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install build + run: >- + python -m pip install build --user + + - name: Build a binary wheel and a source tarball + run: >- + python -m build --sdist --wheel --outdir dist/ . + + - name: Publish distribution to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml deleted file mode 100644 index ab920ec..0000000 --- a/.github/workflows/draft-pdf.yml +++ /dev/null @@ -1,23 +0,0 @@ -on: [push] - -jobs: - paper: - runs-on: ubuntu-latest - name: Paper Draft - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build draft PDF - uses: openjournals/openjournals-draft-action@master - with: - journal: joss - # This should be the path to the paper within your repo. - paper-path: joss/paper.md - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: paper - # This is the output path where Pandoc will write the compiled - # PDF. Note, this should be the same directory as the input - # paper.md - path: joss/paper.pdf diff --git a/.github/workflows/black-formatter.yml b/.github/workflows/master_cleaner.yml similarity index 89% rename from .github/workflows/black-formatter.yml rename to .github/workflows/master_cleaner.yml index 89d408f..4320854 100644 --- a/.github/workflows/black-formatter.yml +++ b/.github/workflows/master_cleaner.yml @@ -1,4 +1,4 @@ -name: Black Formatter +name: Master Cleaner on: push: @@ -6,15 +6,14 @@ on: - master jobs: - linter: + formatter: name: runner / black runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: psf/black@stable with: - options: "-l 80" src: "./pina" - name: Create Pull Request diff --git a/.github/workflows/monthly-tag.yml b/.github/workflows/monthly-tagger.yml similarity index 95% rename from .github/workflows/monthly-tag.yml rename to .github/workflows/monthly-tagger.yml index b77e422..81bf4d2 100644 --- a/.github/workflows/monthly-tag.yml +++ b/.github/workflows/monthly-tagger.yml @@ -1,4 +1,4 @@ -name: Monthly Automated Tag +name: "Monthly Tagger" on: schedule: @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest needs: test steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: token: ${{ secrets.NDEMO_PAT_TOKEN }} diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml deleted file mode 100644 index 8d2265e..0000000 --- a/.github/workflows/pypi-publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: "PYPI Publish" - -on: - push: - tags: - - "*" - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - - name: Install build - run: >- - python -m pip install build --user - - - name: Build a binary wheel and a source tarball - run: >- - python -m build --sdist --wheel --outdir dist/ . - - - name: Publish distribution to PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/sphinx-build.yml b/.github/workflows/sphinx-build.yml deleted file mode 100644 index 32e35ce..0000000 --- a/.github/workflows/sphinx-build.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "Documentation Deploy" - -on: - push: - tags: - - "*" - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Create the new documentation - uses: ammaraskar/sphinx-action@7.4.7 - with: - pre-build-command: "python3 -m pip install .[doc]" - docs-folder: "docs/" - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - #deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} - publish_dir: ./docs/build/html - allow_empty_commit: true diff --git a/.github/workflows/tester.yml b/.github/workflows/tester.yml new file mode 100644 index 0000000..87a759b --- /dev/null +++ b/.github/workflows/tester.yml @@ -0,0 +1,73 @@ +name: "Testing Pull Request" + +on: + pull_request: + branches: + - "master" + - "dev" + +jobs: + unittests: ################################################################# + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + python-version: [3.8, 3.9, '3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + - 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 + + linter: #################################################################### + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run Black formatter (check mode) + uses: psf/black@stable + with: + src: "./pina" + + testdocs: ################################################################## + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Python dependencies + run: python3 -m pip install .[doc] + + - name: Build Documentation + run: | + make html SPHINXOPTS+='-W' + working-directory: docs/ + + coverage: ################################################################## + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Generate coverage report + run: | + python3 -m pytest --cov-report term --cov-report xml:cobertura.xml --cov=pina + + - name: Produce the coverage report + uses: insightsengineering/coverage-action@v2 + with: + path: ./cobertura.xml + threshold: 80.123 + fail: true + publish: true + coverage-summary-title: "Code Coverage Summary" \ No newline at end of file diff --git a/.github/workflows/testing_doc.yml b/.github/workflows/testing_doc.yml deleted file mode 100644 index 04be96f..0000000 --- a/.github/workflows/testing_doc.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Test Sphinx Documentation Build - -on: - pull_request: - branches: - - "master" - - "0.2" - paths: - - 'docs/**' - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Python dependencies - run: python3 -m pip install .[doc] - - - name: Build Documentation - run: | - make html SPHINXOPTS+='-W' - working-directory: docs/ \ 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 9ba8840..0000000 --- a/.github/workflows/testing_pr.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "Testing Pull Request" - -on: - pull_request: - branches: - - "master" - - "0.2" - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest, macos-latest, ubuntu-latest] - python-version: [3.8, 3.9, '3.10', '3.11', '3.12'] - - steps: - - uses: actions/checkout@v2 - - - - name: Set up Python - uses: actions/setup-python@v2 - 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 diff --git a/.github/workflows/export_tutorials.yml b/.github/workflows/tutorial_exporter.yml similarity index 98% rename from .github/workflows/export_tutorials.yml rename to .github/workflows/tutorial_exporter.yml index 4b009a1..30de93d 100644 --- a/.github/workflows/export_tutorials.yml +++ b/.github/workflows/tutorial_exporter.yml @@ -3,9 +3,11 @@ name: "Export Tutorials" on: push: branches: - - "**" # Run on push on all branches + - "dev" + - "master" paths: - 'tutorials/**/*.ipynb' + jobs: export_tutorials: permissions: write-all @@ -37,6 +39,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email 41898282+github-actions[bot]@users.noreply.github.com + - name: Export tutorials to .py and .html run: | set -x @@ -61,6 +64,7 @@ jobs: - 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: diff --git a/pyproject.toml b/pyproject.toml index c093d51..6dc215c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,10 +54,6 @@ Repository = "https://github.com/mathLab/PINA" requires = [ "setuptools>=41", "wheel", "setuptools-git-versioning>=2.0,<3", ] build-backend = "setuptools.build_meta" -[tool.setuptools-git-versioning] -enabled = true -template = "{tag}" - [tool.setuptools.packages.find] include = ["pina*"]