diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..7d8c059 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,57 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + run-tests: + name: Run tests to avoid a broken release + uses: BIMAU/jadapy/.github/workflows/ci.yml@master + + build: + name: Build packages + runs-on: ubuntu-latest + needs: + - run-tests + + steps: + - name: Set up Python 3.x + uses: actions/setup-python@v4 + with: + python-version: '>=3.8,<4' + + - name: Check out the source code + uses: actions/checkout@v3 + + - name: Build a source package and a wheel + run: python -m build . + + - name: Upload packages as artifact + uses: actions/upload-artifact@v4 + with: + name: packages-for-pypi + path: dist/ + + publish: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: + - build + + environment: + name: pypi + url: https://pypi.org/p/jadapy + + permissions: + id-token: write + + steps: + - name: Download artifact with packages + uses: actions/download-artifact@v4 + with: + name: packages-for-pypi + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cd8592..6d1abbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,48 +1,35 @@ -name: Python application +name: Run tests on: push: branches: [ master ] pull_request: branches: [ master ] + workflow_call: jobs: build: strategy: matrix: - include: - - os: 'ubuntu-latest' - dependencies: '' - - os: 'macos-latest' - dependencies: '' -# - os: 'macos-latest' -# dependencies: 'nlesc/nlesc/trilinos' + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.8, 3.x] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install python dependencies run: | python -m pip install --upgrade pip pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - - name: Install Linux dependencies - run: | - sudo apt-get install ${{ matrix.dependencies }} - if: ${{ matrix.os != 'macos-latest' && matrix.dependencies != '' }} - - - name: Install macOS dependencies - run: | - brew tap nlesc/nlesc - brew install ${{ matrix.dependencies }} - if: ${{ matrix.os == 'macos-latest' && matrix.dependencies != '' }} + pip install -r requirements.txt - name: Lint with flake8 run: | @@ -50,4 +37,4 @@ jobs: - name: Test with pytest run: | - pytest tests + pytest -v -o console_output_style=classic tests diff --git a/setup.cfg b/setup.cfg index 19c8b64..a6ab8f2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = jadapy -version = 0.0.0 +version = 1.0.0 url = https://github.com/BIMAU/jadapy license = Apache License 2.0 author = Sven Baars @@ -9,7 +9,7 @@ description = Implementations of JDQR and JDQZ with optional integration with Tr long_description = file: README.md long_description_content_type = text/markdown classifiers = - Development Status :: 3 - Alpha + Development Status :: 5 - Production/Stable Environment :: Console Intended Audience :: Developers Intended Audience :: Science/Research @@ -40,4 +40,4 @@ norecursedirs = lib ignore = E226,E261,E302,E731,C901,W503 max-line-length = 127 max-complexity = 10 -exclude = lib \ No newline at end of file +exclude = lib