diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/build-paper.yml similarity index 78% rename from .github/workflows/draft-pdf.yml rename to .github/workflows/build-paper.yml index 00cab48..46b6191 100644 --- a/.github/workflows/draft-pdf.yml +++ b/.github/workflows/build-paper.yml @@ -1,6 +1,9 @@ -name: Paper Build - -on: [push, pull_request] +name: Build Paper +on: + workflow_dispatch: + pull_request: + branches: + - master jobs: paper: @@ -8,15 +11,17 @@ jobs: name: Paper Draft steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 + - 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: paper/paper.md + - name: Upload - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v6 with: name: paper # This is the output path where Pandoc will write the compiled diff --git a/.github/workflows/pypackage.yml b/.github/workflows/build.yml similarity index 52% rename from .github/workflows/pypackage.yml rename to .github/workflows/build.yml index 8adb959..47977ee 100644 --- a/.github/workflows/pypackage.yml +++ b/.github/workflows/build.yml @@ -1,22 +1,32 @@ -name: Build Wheel -on: [workflow_call] - +name: Build +on: + workflow_dispatch: + workflow_call: + pull_request: + branches: + - master + jobs: - build-wheel: - name: Build Wheel for Testing + build: + name: Build UncertainSCI wheel and tarball runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v6 + - name: Setup Python 3.9 - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: 3.9 + cache: 'pip' # optional, adds caching for faster builds + - name: Install pypa/build run: >- python -m pip install build --user + - name: Build a binary wheel and a source tarball run: >- python -m @@ -24,16 +34,20 @@ jobs: --sdist --wheel --outdir dist/ - - name: install check-wheel-contents + + - name: Install check-wheel-contents run: >- python3 -m pip install check-wheel-contents - - name: check wheel + + - name: Check wheel run: >- check-wheel-contents dist/*.whl - - uses: actions/upload-artifact@v3 + + - name: Upload Artifact + uses: actions/upload-artifact@v6 with: - path: ./dist/* - + name: uncertainsci-packages + path: dist diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..e6eb990 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint +on: + workflow_dispatch: + workflow_call: + pull_request: + branches: + - master + +jobs: + lint: + name: Lint UncertainSCI + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup Python 3.9 + uses: actions/setup-python@v6 + with: + python-version: 3.9 + cache: 'pip' # optional, adds caching for faster builds + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + pip install -r requirements.txt + + - name: Lint with flake8 + run: | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --max-complexity=10 --max-line-length=127 --statistics diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml new file mode 100644 index 0000000..dc2d8cb --- /dev/null +++ b/.github/workflows/publish-test.yml @@ -0,0 +1,39 @@ +name: Publish Package (TestPyPI/dry run) +on: + workflow_dispatch: + workflow_call: + push: + tags: + - 'v[0-9]+*test*' + - '*test*-v[0-9]+' + +jobs: + lint: + uses: ./.github/workflows/lint.yml + + build: + uses: ./.github/workflows/build.yml + + test: + uses: ./.github/workflows/test.yml + + upload_testpypi: + name: Publish build to TestPyPI + needs: [lint, build, test] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://test.pypi.org/p/UncertainSCI + permissions: + id-token: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v7 + with: + name: uncertainsci-packages + path: dist + + - name: Upload to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..447aeac --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: Publish Package +on: + workflow_dispatch: + workflow_call: + push: + tags: + - 'v[0-9]+' + +jobs: + lint: + uses: ./.github/workflows/lint.yml + + build: + uses: ./.github/workflows/build.yml + + test: + uses: ./.github/workflows/test.yml + + publish-test: + uses: ./.github/workflows/publish-test.yml + + upload_pypi: + name: Publish build to PyPI + needs: [lint, build, test, publish-test] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/UncertainSCI + permissions: + id-token: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v7 + with: + name: uncertainsci-packages + path: dist + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist diff --git a/.github/workflows/pypublish.yml b/.github/workflows/pypublish.yml deleted file mode 100644 index cb74ad2..0000000 --- a/.github/workflows/pypublish.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Publish Python distribution to PyPI and TestPyPI -on: - push: - tags: - - '*' - -jobs: - build-wheel: - uses: ./.github/workflows/pypackage.yml - upload_testpypi: - name: Publish build to TestPyPI - needs: [build-wheel] - runs-on: ubuntu-latest - environment: - name: pypi - url: https://test.pypi.org/p/UncertainSCI - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - name: Upload to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist - upload_pypi: - name: Publish build to PyPI - needs: [build-wheel, upload_testpypi] - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/UncertainSCI - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - name: Upload to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/test.yml similarity index 59% rename from .github/workflows/pythonapp.yml rename to .github/workflows/test.yml index bde1cc6..84ab488 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,13 @@ -name: Build - -on: [push, pull_request] +name: Test +on: + workflow_dispatch: + workflow_call: + pull_request: + branches: + - master jobs: - build: - + test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -12,36 +15,34 @@ jobs: python-version: ["3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} + cache: 'pip' # optional, adds caching for faster builds + - name: Display Python version run: python -c "import sys; print(sys.version)" + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest pytest-cov + pip install pytest pytest-cov pip install -r requirements.txt - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test build + + - name: Install UncertainSCI run: | pip install --editable ./ - - name: Run tests with pytest - continue-on-error: true - run: | - pytest - - name: Test coverage with pytest - continue-on-error: true + + - name: Run tests and compute coverage run: | pytest --cov=UncertainSCI - - name: Upload coverage data to coveralls.io + + - name: Upload coverage to coveralls.io + continue-on-error: true run: | pip install coveralls coveralls --service=github @@ -49,21 +50,19 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_FLAG_NAME: ${{ matrix.os }} COVERALLS_PARALLEL: true - + coveralls: - name: confirm coveralls upload - needs: build + name: Confirm coveralls.io reporting + needs: test runs-on: ubuntu-latest container: python:3-slim steps: - - name: Finished + - name: Finish coveralls.io reporting + continue-on-error: true run: | pip3 install --upgrade pip pip3 install --upgrade coveralls coveralls --service=github --finish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - diff --git a/.github/workflows/testpackage.yml b/.github/workflows/testpackage.yml deleted file mode 100644 index 4441fcd..0000000 --- a/.github/workflows/testpackage.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: Build and Test Package -on: [push, pull_request] - -jobs: - buildwheel: - uses: ./.github/workflows/pypackage.yml