From 4de2d24fa007546bf711014102886c5ca09daf7d Mon Sep 17 00:00:00 2001 From: Nikita Tikhonov Date: Mon, 15 Jan 2024 21:59:46 +0300 Subject: [PATCH] Update workflows. --- .github/FUNDING.yml | 3 +-- .github/workflows/check.yml | 25 +++++++++++++++---------- .github/workflows/docs.yml | 10 +++------- .github/workflows/release.yml | 22 ++++++---------------- .github/workflows/test.yml | 13 ++++++------- gd/api/color_channels.py | 16 ---------------- pyproject.toml | 2 +- 7 files changed, 32 insertions(+), 59 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index aa7f4783..5851e0f9 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ -patreon: nekitdev -github: [nekitdev] \ No newline at end of file +github: [nekitdev] diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7bba96a8..878d368c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -12,31 +12,36 @@ on: jobs: check: name: Check - runs-on: ubuntu-latest + + strategy: + matrix: + os: [ubuntu, windows, macos] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + runs-on: ${{ matrix.os }}-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Install Poetry - run: pipx install poetry - - - name: Setup Python 3.12 + - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: "3.12" - cache: poetry + python-version: ${{ matrix.python-version }} - name: Update submodules run: git submodule update --init --remote - - name: Update PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Install Poetry + run: pipx install poetry - name: Configure Poetry run: poetry config virtualenvs.in-project true + - name: Specify the version + run: poetry env use python + - name: Install dependencies - run: poetry install --with check --with test --all-extras + run: poetry install --all-extras - name: Run type checks run: poetry run mypy . diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1a4dec01..7e909ae4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,24 +13,20 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Poetry - run: pipx install poetry - - name: Setup Python 3.12 uses: actions/setup-python@v5 with: python-version: "3.12" - cache: poetry - name: Update submodules run: git submodule update --init --remote - - name: Update PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - name: Configure Poetry run: poetry config virtualenvs.in-project true + - name: Specify the version + run: poetry env use python + - name: Install dependencies run: poetry install --with docs --all-extras diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05a226d3..fec5e77c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,41 +14,31 @@ jobs: os: [ubuntu, macos, windows] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - defaults: - run: - shell: bash - runs-on: ${{ matrix.os }}-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Install Poetry - run: pipx install poetry - - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: poetry - name: Update submodules run: git submodule update --init --remote - - name: Update PATH - if: ${{ matrix.os != 'windows' }} - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Update PATH for Windows - if: ${{ matrix.os == 'windows' }} - run: echo "$APPDATA/Python/Scripts" >> $GITHUB_PATH + - name: Install Poetry + run: pipx install poetry - name: Configure Poetry run: poetry config virtualenvs.in-project true + - name: Specify the version + run: poetry env use python + - name: Install dependencies - run: poetry install --with build + run: poetry install - name: Build run: poetry build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8c99436..aa960f1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,26 +23,25 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Poetry - run: pipx install poetry - - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: poetry - name: Update submodules run: git submodule update --init --remote - - name: Update PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Install Poetry + run: pipx install poetry - name: Configure Poetry run: poetry config virtualenvs.in-project true + - name: Specify the version + run: poetry env use python + - name: Install dependencies - run: poetry install --with test --all-extras + run: poetry install --all-extras - name: Run tests run: poetry run pytest --cov-report xml diff --git a/gd/api/color_channels.py b/gd/api/color_channels.py index f507a637..3b861d4d 100644 --- a/gd/api/color_channels.py +++ b/gd/api/color_channels.py @@ -1,6 +1,5 @@ from __future__ import annotations -from enum import Enum from typing import TYPE_CHECKING, Dict, Iterable, Optional, Union from attrs import define, field @@ -93,21 +92,6 @@ COLOR_4_CHANNEL_ID = 4 -class ColorChannelType(Enum): - PLAYER = 0 - NORMAL = 1 - COPIED = 2 - - def is_player(self) -> bool: - return self is type(self).PLAYER - - def is_normal(self) -> bool: - return self is type(self).NORMAL - - def is_copied(self) -> bool: - return self is type(self).COPIED - - COLOR_CHANNEL_ID_NOT_PRESENT = "color channel ID is not present" diff --git a/pyproject.toml b/pyproject.toml index 23675d17..5d42dea4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ speed = ["lxml"] console = ["ipython"] [tool.poetry.group.format.dependencies] -ruff = "0.1.11" +ruff = "0.1.13" [tool.poetry.group.check.dependencies] mypy = "1.8.0"