diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cba025e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +defaults: + run: + shell: bash + +jobs: + tests: + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.10", "3.11", "3.12"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Set up virtualenv + run: | + poetry config virtualenvs.in-project true + - uses: actions/cache@v3 + name: Cache + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install the project dependencies + run: poetry install --with dev + - name: Run tests + run: | + make tests diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml deleted file mode 100644 index 15e2403..0000000 --- a/.github/workflows/github-actions.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: ci - -on: - push: - tags: - - '*' - -defaults: - run: - shell: bash - -jobs: - tests: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.10", "3.11", "3.12"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install poetry - uses: abatilo/actions-poetry@v2 - - uses: actions/cache@v3 - name: Cache - with: - path: ./.venv - key: venv-${{ hashFiles('poetry.lock') }} - - name: Install the project dependencies - run: poetry install - - name: Run the automated tests - run: poetry run pytest -v - - build: - needs: tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - name: Install poetry - uses: abatilo/actions-poetry@v2 - - uses: actions/cache@v3 - name: Cache - with: - path: ./.venv - key: venv-${{ hashFiles('poetry.lock') }} - - name: Install the project dependencies - run: poetry install - - name: Build - run: poetry build - - name: Publish - run: | - poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} - poetry publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c6dd47d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + release: + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Set up virtualenv + run: | + poetry config virtualenvs.in-project true + - uses: actions/cache@v3 + name: Cache + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install the project dependencies + run: poetry install + - name: Build + run: poetry build + - name: Publish + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish diff --git a/Makefile b/Makefile index 3115eaa..d3e4018 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ install: .PHONY: tests tests: @echo "--- 🧪 Running tests ---" - pytest tests/ + poetry run pytest .PHONY: lint lint: