From b0151bcd0cb0e4fd20edd16bfe24938dc09ca87c Mon Sep 17 00:00:00 2001 From: Yuta Nagano <52748151+yutanagano@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:29:48 +0100 Subject: [PATCH] Add github workflows --- .github/workflows/publish_to_pypi.yaml | 40 ++++++++++++++++++++++++++ .github/workflows/tests.yaml | 23 +++++++++++++++ tox.ini | 24 ++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 .github/workflows/publish_to_pypi.yaml create mode 100644 .github/workflows/tests.yaml create mode 100644 tox.ini diff --git a/.github/workflows/publish_to_pypi.yaml b/.github/workflows/publish_to_pypi.yaml new file mode 100644 index 0000000..24ecd2d --- /dev/null +++ b/.github/workflows/publish_to_pypi.yaml @@ -0,0 +1,40 @@ +name: publish to PyPI +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: check out branch + uses: actions/checkout@v4 + - name: set up python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: install build + run: python3 -m pip install build --user + - name: build wheel and source tarball + run: python3 -m build + - name: store distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + publish: + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/libtcrlm + permissions: + id-token: write + steps: + - name: download dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: publish + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..5d914a2 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,23 @@ +name: tests +on: pull_request +jobs: + run_tox: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python_ver: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + + runs-on: ${{ matrix.os }} + steps: + - name: Check out branch + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_ver }} + - name: Install dependencies + run: | + pip install --upgrade pip + pip install tox tox-gh-actions + - name: Run tox + run: tox \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..f15d733 --- /dev/null +++ b/tox.ini @@ -0,0 +1,24 @@ +[tox] +env_list = + lint, py{39, 310, 311, 312} + +[gh-actions] +python = + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 + +[testenv] +description = run unit tests +deps = + pytest>=7 +commands = + pytest tests + +[testenv:lint] +description = run linters +skip_install = true +deps = + black[jupyter]>=23 +commands = black .