diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index c4eb761..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Lint - -on: - pull_request: - branches: [ "master" ] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: psf/black@stable diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..a7909a3 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,129 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + pull_request: + branches: [ "main" ] + schedule: + - cron: '0 2 * * 3' + +permissions: + contents: read + + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable + lint: + name: Lint with ruff + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install ruff + run: | + pip install ruff + - name: Lint with ruff + run: | + # stop the build if there are Python syntax errors or undefined names + ruff check . + test: + name: Test + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' # caching pip dependencies + cache-dependency-path: '**/pyproject.toml' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install -e . + - name: Run tests + run: python -m pytest tests + + build_source_dist: + name: Build source distribution + if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install build + run: python -m pip install build + + - name: Run build + run: python -m build --sdist + + - uses: actions/upload-artifact@v4 + with: + path: ./dist/*.tar.gz + # Needed in case of building packages with external binaries (e.g. Cython, RUst-extensions, etc.) + # build_wheels: + # name: Build wheels on ${{ matrix.os }} + # if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags') + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # os: [ubuntu-20.04, windows-2019, macOS-10.15] + + # steps: + # - uses: actions/checkout@v4 + + # - uses: actions/setup-python@v5 + # with: + # python-version: "3.10" + + # - name: Install cibuildwheel + # run: python -m pip install cibuildwheel==2.3.1 + + # - name: Build wheels + # run: python -m cibuildwheel --output-dir wheels + + # - uses: actions/upload-artifact@v4 + # with: + # path: ./wheels/*.whl + + publish: + name: Publish package + if: startsWith(github.ref, 'refs/tags') + needs: + - format + - lint + - test + - build_source_dist + # - build_wheels + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v4 + with: + name: artifact + path: ./dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + # remove repository key to set the default to pypi (not test.pypi.org) + repository-url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml deleted file mode 100644 index c7da299..0000000 --- a/.github/workflows/unittest.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: Python application - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - # Include all supported version of Python here. - python-version: ["3.11"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' # caching pip dependencies - cache-dependency-path: '**/pyproject.toml' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ruff pytest - pip install -e . - - name: Lint with ruff - run: | - # stop the build if there are Python syntax errors or undefined names - ruff check . - - name: Run tests - run: python -m pytest tests diff --git a/src/mockup/__init__.py b/src/mockup/__init__.py index d517e4a..1324328 100644 --- a/src/mockup/__init__.py +++ b/src/mockup/__init__.py @@ -3,6 +3,7 @@ from importlib import metadata + __version__ = metadata.version("rasmussenlab-mockup") from .mockup import add_one, Circle