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
9 changes: 9 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changesets

Use Changesets to describe user-facing changes that should be included in the next release.

Create a changeset with:

```sh
pnpm changeset
```
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"privatePackages": {
"version": true,
"tag": true
}
}
5 changes: 5 additions & 0 deletions .changeset/quiet-cycles-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"impose-cli": major
---

impose-cli support interactive and non-interactive modes for CLI mode, as well as an optional API deployment.
11 changes: 11 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use flake

export UV_PROJECT_ENVIRONMENT="$PWD/.venv"
export VIRTUAL_ENV="$PWD/.venv"

if [ ! -d "$VIRTUAL_ENV" ]; then
uv venv --python "$UV_PYTHON" "$VIRTUAL_ENV"
fi

export UV_PYTHON="$VIRTUAL_ENV/bin/python"
PATH_add "$VIRTUAL_ENV/bin"
93 changes: 93 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: ci

on:
pull_request:
types:
- opened
- synchronize
- reopened

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
quality:
name: quality
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v20

- name: Fetch main branch
run: git fetch origin main:main

- name: Check source changes
id: source-changes
uses: tj-actions/changed-files@v46
with:
files: |
.github/**
examples/**
intregation/**
src/**
unit/**
.envrc
flake.lock
flake.nix
package.json
pnpm-lock.yaml
pyproject.toml
uv.lock

- name: Check changeset changes
id: changeset-changes
uses: tj-actions/changed-files@v46
with:
files: |
.changeset/**

- name: Require changeset
if: github.event.pull_request.title != 'Version Apps'
run: |
if ${{ steps.source-changes.outputs.any_modified == 'true' && steps.changeset-changes.outputs.any_modified == 'false' }}; then
echo "Source changes require a changeset. Run 'pnpm changeset' and commit the generated .changeset file."
exit 1
fi

- name: Install PNPM dependencies
run: nix develop -c pnpm install --frozen-lockfile

- name: Check changeset status
if: github.event.pull_request.title != 'Version Apps'
run: nix develop -c pnpm changeset status --since=origin/main

- name: Check formatting
run: nix develop -c uv run ruff format --check

- name: Lint
run: nix develop -c uv run ruff check

- name: Type check
run: nix develop -c uv run pyright

tests:
name: tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v20

- name: Run unit tests
run: nix develop -c uv run pytest unit

- name: Run integration tests
run: nix develop -c uv run pytest integration
187 changes: 187 additions & 0 deletions .github/workflows/version-and-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: version and release

on:
pull_request:
types:
- closed
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
rc-package:
name: rc package
runs-on: ubuntu-latest
environment: pypi
if: >-
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.title != 'Version Apps'
)
permissions:
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v20

- name: Install PNPM dependencies
run: nix develop -c pnpm install --frozen-lockfile

- name: Update to the correct RC version
id: version
shell: bash
run: |
set -euo pipefail

nix develop -c npx changeset status --output=/tmp/release-plan.json
VERSION=$(nix develop -c jq -r '.releases[].newVersion' /tmp/release-plan.json)

PACKAGE_NAME="impose-cli"
ESCAPED_VERSION="${VERSION//./\\.}"

LAST_RC=$(
curl --fail --silent --show-error \
"https://pypi.org/pypi/${PACKAGE_NAME}/json" |
nix develop -c jq -r '.releases | keys[]' |
sed -nE "s/^${ESCAPED_VERSION}rc([0-9]+)$/\1/p" |
sort -n |
tail -n 1
)

RC_NUMBER=$((${LAST_RC:--1} + 1))
RC_VERSION="${VERSION}rc${RC_NUMBER}"

nix develop -c uv version "$RC_VERSION"

echo "version=${RC_VERSION}" >> "$GITHUB_OUTPUT"

- name: Build RC package
run: nix develop -c uv build

- name: Upload RC package artifact
uses: actions/upload-artifact@v4
with:
name: impose-cli-${{ steps.version.outputs.version }}
path: dist/*
if-no-files-found: error

- name: Publish RC package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

version-pr:
name: version apps pr
runs-on: ubuntu-latest
if: >-
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.title != 'Version Apps'
)
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v20

- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.KASSETT_PR_BOT_APP_ID }}
private-key: ${{ secrets.KASSETT_PR_BOT_PRIVATE_KEY }}

- name: Install PNPM dependencies
run: nix develop -c pnpm install --frozen-lockfile

- name: Version packages
shell: bash
run: |
set -euo pipefail

# Applies Changesets, updates changelogs, and removes consumed
# Changeset files.
nix develop -c pnpm changeset version

VERSION="$(
nix develop -c node \
-p "require('./package.json').version"
)"

# Keep the Python package version synchronized using uv rather
# than editing pyproject.toml directly.
nix develop -c uv version "$VERSION"

- name: Create or update Version Apps PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.app-token.outputs.token }}
branch: changeset-release-main
sign-commits: true
commit-message: Version apps
title: Version Apps
body: Automated PR to version apps from Changesets.

release:
name: release
runs-on: ubuntu-latest
environment: pypi
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.title == 'Version Apps'
permissions:
contents: write
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v20

- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.KASSETT_PR_BOT_APP_ID }}
private-key: ${{ secrets.KASSETT_PR_BOT_PRIVATE_KEY }}

- name: Read version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

- name: Create release
uses: softprops/action-gh-release@v2
with:
token: ${{ steps.app-token.outputs.token }}
tag_name: ${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
generate_release_notes: true

- name: Build package
run: nix develop -c uv build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
45 changes: 0 additions & 45 deletions .github/workflows/workflow_dev.yml

This file was deleted.

Loading
Loading