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
2 changes: 0 additions & 2 deletions .github/scripts/gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def git_command(*args):
branch = git_command("branch", "--show-current")

os.environ["REPO_URL"] = repo_url
os.environ["BRANCH_NAME"] = branch
os.environ["GITHUB_WORKSPACE"] = git_directory
os.environ["GITHUB_EVENT_NAME"] = "workspace_dispatch"
os.environ["GITHUB_RUN_ID"] = "mock_gha_run"
Expand All @@ -127,7 +126,6 @@ def export_env_alt(key, value):
**{
"run_id": os.getenv("GITHUB_RUN_ID"),
"origin": origin,
"branch": os.getenv("BRANCH_NAME"),
"root": os.getenv("GITHUB_WORKSPACE"),
"pdk": os.getenv("PDK_ROOT"),
"tool": os.getenv("TOOL"),
Expand Down
87 changes: 68 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,102 @@ on:
pull_request:

jobs:
lint_python:
lint:
name: Lint Python Code
runs-on: ubuntu-24.04
steps:
- name: Check out Git repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Install Linters
run: make venv
- name: Lint
run: make lint
push_to_pypi:
name: Build (and publish, if applicable)
build:
name: Build
runs-on: ubuntu-24.04
needs: lint_python
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
needs: lint
steps:
- name: Check Git repository
uses: actions/checkout@v6
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Build Distribution
run: |
make dist
- uses: actions/upload-artifact@v7
with:
name: wheel
path: ./dist
test:
name: Test
runs-on: ubuntu-24.04
needs: build
steps:
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: actions/download-artifact@v8
with:
name: wheel
path: ./dist
- name: Install Ciel, jq
run: |
sudo apt-get install -y jq
pip3 install ./dist/ciel-*.whl
- name: Ensure PDK downloads work
shell: bash
run: |
for pdk in $(python3 -m ciel ls-pdks | jq -r 'keys[]' | tr '\n' ' '); do
version="$(python3 -m ciel ls-remote --pdk $pdk | head -n1)"
python3 -m ciel fetch --pdk $pdk $version
python3 -m ciel prune --pdk $pdk --yes
done
check_new_version:
name: Check for new version in pyproject.toml
runs-on: ubuntu-24.04
if: github.event == 'push' && github.ref_name == 'main'
steps:
- name: Check out Git repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Export Repo URL
run: echo "REPO_URL=https://github.com/${{ github.repository }}" >> $GITHUB_ENV
- name: Export Branch Name
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Build Distribution
run: |
make dist
- name: Set default for env.NEW_TAG
run: echo "NEW_TAG=NO_NEW_TAG" >> $GITHUB_ENV
- name: Check for new version
if: ${{ env.BRANCH_NAME == 'main' }}
run: |
make venv
cd ${GITHUB_WORKSPACE}/ && ./venv/bin/python3 .github/scripts/generate_tag.py
- id: new_tag
name: Set new tag as job output
run: |
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
publish:
name: Publish
runs-on: ubuntu-24.04
needs: [lint, build, test, check_new_version]
if: needs.check_new_version.steps.new_tag.outputs.new_tag != 'NO_NEW_TAG'
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: wheel
path: ./dist
- name: Tag Commit
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: tvdias/github-tagger@v0.0.1
with:
tag: "${{ env.NEW_TAG }}"
tag: "${{ needs.check_new_version.steps.new_tag.outputs.new_tag }}"
repo-token: "${{ secrets.BOT_TOKEN }}"
- name: Publish
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: pypa/gh-action-pypi-publish@release/v1
7 changes: 5 additions & 2 deletions ciel/click_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class VersionArgument(click.Argument):
def make_metavar(self, ctx: Optional[click.Context] = None):
return "<VERSION>"
return "<VERSION (HASH)>"

def set_tool_metadata_file_path(
self,
Expand All @@ -53,7 +53,10 @@ def process_value(self, ctx, value):
del ctx.params["tool_metadata_file_path"]
resolved = resolve_version(value, tool_metadata_file_path)
except FileNotFoundError:
resolved = None
raise click.MissingParameter(
ctx=ctx,
param=self,
)
return super().process_value(ctx, resolved)


Expand Down
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ciel"
version = "2.5.0"
version = "2.5.1"
description = "An PDK builder/version manager for PDKs in the open_pdks format"
authors = ["Mohamed Gaber <me@donn.website>", "Efabless Corporation"]
readme = "Readme.md"
Expand All @@ -16,7 +16,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.8"
click = ">=8,<9"
click = ">=8,<8.5"
pyyaml = ">=5,<7"
rich = ">=12,<15"
httpx = ">=0.22.0,<0.29"
Expand Down
Loading