diff --git a/.github/workflows/pr.yml b/.github/workflows/dev.yml similarity index 59% rename from .github/workflows/pr.yml rename to .github/workflows/dev.yml index 53676a7..631596d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/dev.yml @@ -1,26 +1,19 @@ -name: pr +name: Dev on: + push: + branches: + - main pull_request: branches: - - "**" - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true + - main jobs: - build: - strategy: - fail-fast: false - matrix: - python-version: ["3.11", "3.12"] - os: [ubuntu-latest, macos-latest, windows-latest] + dev: + runs-on: ubuntu-latest defaults: run: shell: bash - runs-on: ${{ matrix.os }} - environment: development steps: - name: Checkout source code uses: actions/checkout@v4 @@ -28,7 +21,7 @@ jobs: id: setup-python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.12" - name: Install Poetry uses: snok/install-poetry@v1.3.4 with: @@ -41,9 +34,7 @@ jobs: key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root --with docs - - name: Install library - run: poetry install --no-interaction + run: poetry install --no-interaction --no-root --without test --with docs - name: Activate virtual environment run: source $VENV - name: Lint with Ruff @@ -54,13 +45,5 @@ jobs: run: poetry run mypy - name: Format with Ruff run: poetry run ruff format --check - - name: Test with pytest - run: poetry run pytest --cov=src --cov-report=xml - name: Build docs with Material for MkDocs run: poetry run mkdocs build - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4434d9c..63521dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,13 +7,11 @@ on: jobs: publish: - strategy: - fail-fast: false - runs-on: ubuntu-latest - environment: production permissions: - id-token: write contents: read + id-token: write + runs-on: ubuntu-latest + environment: production steps: - name: Checkout source code uses: actions/checkout@v4 @@ -35,3 +33,5 @@ jobs: run: | poetry config pypi-token.pypi $PYPI_TOKEN poetry publish --build + strategy: + fail-fast: false diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 73% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 16cbac2..c75ed00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,25 +1,24 @@ -name: ci +name: Test on: push: branches: - main + pull_request: + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: - build: - strategy: - fail-fast: false - matrix: - python-version: ["3.11", "3.12"] - os: [ubuntu-latest, macos-latest, windows-latest] + test: + if: github.event_name == 'pull_request' + runs-on: ${{ matrix.os }} defaults: run: shell: bash - runs-on: ${{ matrix.os }} steps: - name: Checkout source code uses: actions/checkout@v4 @@ -40,26 +39,23 @@ jobs: key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root --with docs - - name: Install library - run: poetry install --no-interaction + run: poetry install --no-interaction --no-root --without dev,docs - name: Activate virtual environment run: source $VENV - - name: Lint with Ruff - run: poetry run ruff check - - name: Check code security with Bandit - run: poetry run bandit -c pyproject.toml -r . - - name: Typing with mypy - run: poetry run mypy - - name: Format with Ruff - run: poetry run ruff format --check - name: Test with pytest + env: + PASTEBIN_API_DEV_KEY: ${{ secrets.PASTEBIN_API_DEV_KEY }} + PASTEBIN_USERNAME: ${{ secrets.PASTEBIN_USERNAME }} + PASTEBIN_PASSWORD: ${{ secrets.PASTEBIN_PASSWORD }} run: poetry run pytest --cov=src --cov-report=xml - - name: Build docs with Material for MkDocs - run: poetry run mkdocs build - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} verbose: true + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.12"] + os: [ubuntu-latest, macos-latest, windows-latest]