Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 37 additions & 25 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,51 @@ jobs:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest

env:
UV_CACHE_DIR: /tmp/.uv-cache

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Restore uv cache
uses: actions/cache@v5
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}-py-${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --frozen

- name: Install Poetry
run: pipx install poetry
- name: Check code formatting
run: uv run ruff format --check .

- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction
- name: Run lint
run: uv run ruff check .

- name: Check code formatting
run: |
poetry run black --check .
poetry run ruff check .
- name: Run static type checks
run: uv run mypy .

- name: Static type checks with mypy
run: poetry run mypy .
- name: Run tests
run: uv run pytest

- name: Test with pytest
run: poetry run pytest
- name: Minimize uv cache
run: uv cache prune --ci
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,17 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.2.0
rev: v4.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/psf/black
rev: 25.9.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.2
rev: v0.15.0
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
rev: v1.19.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
UNRELEASED
Version 0.63.0
-------------

This is a development release that contains changes from [PR #486](https://github.com/codemagic-ci-cd/cli-tools/pull/486) and [PR #487](https://github.com/codemagic-ci-cd/cli-tools/pull/487).
There are no functional changes for the package end-users.

**Development**
- Replace [Poetry](https://python-poetry.org/) package management system with [uv](https://docs.astral.sh/uv/).
- Update CI scripts to use `uv` instead of `poetry`.
- Replace [Black](https://black.readthedocs.io/en/stable/) code formatter with the [Ruff Formatter](https://docs.astral.sh/ruff/formatter/).

**Dependencies**
- Update `cryptography` version.
- Update Python dependencies in lockfile.
- Remove `black` from dev dependencies.

Version 0.62.1
-------------
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,36 +100,36 @@ Out[7]: PosixPath('/private/tmp/new.keychain')

# Development

This project uses [Poetry](https://python-poetry.org/) to manage dependencies. Before starting development, please ensure that your
machine has Poetry available. Installation instructions can be found from their
[docs](https://python-poetry.org/docs/#installation).
This project uses [uv](https://docs.astral.sh/uv/) to manage dependencies. Before starting development, please ensure that your
machine has `uv` available. Installation instructions can be found from their
[docs](https://docs.astral.sh/uv/getting-started/installation/).

Assuming you've already cloned the [repository](https://github.com/codemagic-ci-cd/cli-tools/)
itself, or a fork of it, you can get started by running

```shell
poetry install
uv sync
```

This will install all required dependencies specified in the `poetry.lock` file.
This will install all required dependencies specified in the `uv.lock` file.

The source code of the project lives inside the `src` directory and tests are
implemented in the `tests` directory.

### Code formatting and linting rules

Automatic code formatting is done with [Black](https://github.com/psf/black).
Invoke Black checks from repository root directory with
Automatic code formatting is done with the [Ruff Formatter](https://docs.astral.sh/ruff/formatter/).
Invoke formatting checks from repository root directory with

```shell
poetry run black --check .
uv run ruff format --check .
```

Linting rules are enforced using [Ruff](https://beta.ruff.rs).
Linting rules are enforced using the [Ruff Linter](https://docs.astral.sh/ruff/linter/).
Checks can be started from repository root with

```shell
poetry run ruff check .
uv run ruff check .
```

### Static type checks
Expand All @@ -139,7 +139,7 @@ are expected to have type hints. Static type checks of the source code are perfo
[Mypy](http://mypy-lang.org/) from the repository root by running

```shell
poetry run mypy .
uv run mypy .
```

### Running tests
Expand All @@ -151,7 +151,7 @@ mirrors the structure of the `codemagic` package in the source directory.
Tests can be started by running the following command from the repository root:

```shell
poetry run pytest
uv run pytest
```

Note that tests that target [App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi) or
Expand Down
53 changes: 19 additions & 34 deletions codemagic.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
definitions:
cache: &cache
cache_paths:
- $CM_BUILD_DIR/.venv
artifacts: &artifacts
- dist/codemagic*.whl
- dist/codemagic*.tar.gz
scripts:
- &install_dependencies
name: Install dependencies
script: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.in-project true
poetry install --no-interaction
script: uv sync --frozen
- &check_code_formatting
name: Check code formatting
script: |
set -e
poetry run black --check .
poetry run ruff check .
uv run ruff format --check .
uv run ruff check .
- &static_type_checks
name: Static type checks with mypy
script: poetry run mypy .
script: uv run mypy .
- &run_tests
name: Run tests
script: poetry run pytest --junitxml="test-report.xml"
script: uv run pytest --junitxml="test-report.xml"
test_report: test-report.xml
- &update_version_in_source
name: Update version number in source code
script: |
set -e
VERSION=$(poetry version --short)
VERSION=$(uv version --short)
echo "Using version $VERSION"
sed -i -e \
"s/__version__ = .*/__version__ = '${VERSION}'/g" \
src/codemagic/__version__.py
- &build_wheels
name: Build wheels
script: poetry build
script: uv build
- &publish_to_pypi
name: Publish release to PyPI
script: |
rm dist/codemagic_cli_tools-*.tar.gz
uv publish --token "${PYPI_TOKEN:?}"

workflows:
tests:
instance_type: mac_mini_m1
triggering:
events:
- push
cancel_previous_builds: true
cache: *cache
scripts:
- *install_dependencies
- *check_code_formatting
Expand All @@ -54,25 +51,25 @@ workflows:

release-test:
name: Release [Test]
instance_type: mac_mini_m1
cache: *cache
environment:
groups:
- github
- pypi-test
vars:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
scripts:
- *install_dependencies
- *check_code_formatting
- *static_type_checks
- *run_tests
- name: Bump version number for development build
script: poetry version "$(poetry version --short).${BUILD_NUMBER:?}"
script: uv version "$(uv version --short).${BUILD_NUMBER:?}"
- *update_version_in_source
- *build_wheels
- name: Make GitHub prerelease
script: |
set -e
TAG_NAME=v$(poetry version --short)
TAG_NAME=v$(uv version --short)
cp dist/codemagic_cli_tools-*-py3-none-any.whl dist/codemagic_cli_tools-latest-py3-none-any.whl
gh release create "${TAG_NAME}" \
--title "${TAG_NAME}" \
Expand All @@ -82,20 +79,11 @@ workflows:
dist/codemagic*.whl \
dist/codemagic*.tar.gz
rm dist/codemagic_cli_tools-latest-py3-none-any.whl
- name: Publish release to PyPI Test environment
script: |
rm dist/codemagic_cli_tools-*.tar.gz
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry publish \
--repository test-pypi \
--username "__token__" \
--password "${PYPI_TOKEN:?}"
- *publish_to_pypi
artifacts: *artifacts

release:
name: Release
instance_type: mac_mini_m1
cache: *cache
environment:
groups:
- github
Expand All @@ -117,7 +105,7 @@ workflows:
- name: Make GitHub release
script: |
set -e
TAG_NAME=v$(poetry version --short)
TAG_NAME=v$(uv version --short)
previous_version_line=$(grep -n "^Version " CHANGELOG.md | head -2 | tail -1 | cut -f1 -d:)
head -n "$(($previous_version_line - 1))" CHANGELOG.md | tail +3 > release_notes.md
cp dist/codemagic_cli_tools-*-py3-none-any.whl dist/codemagic_cli_tools-latest-py3-none-any.whl
Expand All @@ -127,8 +115,5 @@ workflows:
dist/codemagic*.whl \
dist/codemagic*.tar.gz
rm dist/codemagic_cli_tools-latest-py3-none-any.whl
- name: Publish release to PyPI
script: |
rm dist/codemagic_cli_tools-*.tar.gz
poetry publish --username "__token__" --password "${PYPI_TOKEN:?}"
- *publish_to_pypi
artifacts: *artifacts
Loading