Skip to content

Commit 2fd1cd6

Browse files
Add version management and enhance GitHub Actions workflow
- Introduced a new `versions.json` file to manage MPW tags and OpenLane versioning. - Updated the GitHub Actions workflow to streamline testing across multiple Python versions and improve dependency management. - Integrated fetching of version information from the new `versions.json` in the setup process, enhancing flexibility and maintainability. - Added comprehensive unit tests for various CLI commands to ensure proper functionality and help output.
1 parent 42aab18 commit 2fd1cd6

15 files changed

Lines changed: 851 additions & 221 deletions

.github/workflows/test.yml

Lines changed: 35 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -2,217 +2,52 @@ name: Unit Tests
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- develop
5+
branches: [ main, develop ]
86
pull_request:
9-
branches:
10-
- main
11-
- develop
12-
workflow_dispatch:
7+
branches: [ main, develop ]
138

149
jobs:
1510
test:
1611
runs-on: ${{ matrix.os }}
1712
strategy:
18-
fail-fast: false
1913
matrix:
2014
os: [ubuntu-latest, macos-latest]
21-
python-version: ['3.9', '3.10', '3.11', '3.12']
22-
23-
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v4
26-
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v5
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
32-
- name: Install Poetry
33-
uses: snok/install-poetry@v1
34-
with:
35-
version: latest
36-
virtualenvs-create: true
37-
virtualenvs-in-project: true
38-
39-
- name: Cache dependencies
40-
uses: actions/cache@v4
41-
with:
42-
path: .venv
43-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
44-
restore-keys: |
45-
venv-${{ runner.os }}-${{ matrix.python-version }}-
46-
47-
- name: Install dependencies
48-
run: |
49-
poetry install --no-interaction --no-root
50-
51-
- name: Install project
52-
run: |
53-
poetry install --no-interaction
54-
55-
- name: Run unit tests
56-
run: |
57-
poetry run pytest tests/ -v --cov=chipfoundry_cli --cov-report=xml --cov-report=term
58-
59-
- name: Upload coverage to Codecov
60-
uses: codecov/codecov-action@v4
61-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
62-
with:
63-
file: ./coverage.xml
64-
flags: unittests
65-
name: codecov-umbrella
66-
fail_ci_if_error: false
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
6716

68-
test-setup-command:
69-
runs-on: ubuntu-latest
70-
needs: test
71-
7217
steps:
73-
- name: Checkout code
74-
uses: actions/checkout@v4
75-
76-
- name: Set up Python
77-
uses: actions/setup-python@v5
78-
with:
79-
python-version: '3.11'
80-
81-
- name: Install Poetry
82-
uses: snok/install-poetry@v1
83-
84-
- name: Install dependencies
85-
run: |
86-
poetry install --no-interaction
87-
88-
- name: Test cf setup --dry-run
89-
run: |
90-
poetry run cf setup --dry-run --only-init
91-
92-
- name: Test cf setup with skip flags
93-
run: |
94-
mkdir -p test-project
95-
cd test-project
96-
poetry run cf setup --only-init --skip-ipm
97-
98-
- name: Verify project.json created
99-
run: |
100-
test -f test-project/.cf/project.json
101-
echo "✓ project.json created successfully"
102-
103-
- name: Test cf setup help
104-
run: |
105-
poetry run cf setup --help
18+
- uses: actions/checkout@v4
10619

107-
lint:
108-
runs-on: ubuntu-latest
109-
110-
steps:
111-
- name: Checkout code
112-
uses: actions/checkout@v4
113-
114-
- name: Set up Python
115-
uses: actions/setup-python@v5
116-
with:
117-
python-version: '3.11'
118-
119-
- name: Install Poetry
120-
uses: snok/install-poetry@v1
121-
122-
- name: Install dependencies
123-
run: |
124-
poetry install --no-interaction
125-
126-
- name: Run ruff linter
127-
run: |
128-
poetry run ruff check chipfoundry_cli/ tests/ || true
129-
130-
- name: Run black formatter check
131-
run: |
132-
poetry run black --check chipfoundry_cli/ tests/ || true
133-
134-
- name: Run mypy type checker
135-
run: |
136-
poetry run mypy chipfoundry_cli/ || true
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
13724

138-
test-docker:
139-
runs-on: ubuntu-latest
140-
needs: test
141-
142-
steps:
143-
- name: Checkout code
144-
uses: actions/checkout@v4
145-
146-
- name: Set up Python
147-
uses: actions/setup-python@v5
148-
with:
149-
python-version: '3.11'
150-
151-
- name: Install Poetry
152-
uses: snok/install-poetry@v1
153-
154-
- name: Install dependencies
155-
run: |
156-
poetry install --no-interaction
157-
158-
- name: Set up Docker Buildx
159-
uses: docker/setup-buildx-action@v3
160-
161-
- name: Test Docker availability for setup
162-
run: |
163-
docker --version
164-
docker info
165-
166-
- name: Test cf setup with Docker checks (dry-run)
167-
run: |
168-
poetry run cf setup --dry-run
25+
- name: Install Poetry
26+
uses: snok/install-poetry@v1
27+
with:
28+
version: latest
29+
virtualenvs-create: true
30+
virtualenvs-in-project: true
16931

170-
integration-test:
171-
runs-on: ubuntu-latest
172-
needs: test
173-
174-
steps:
175-
- name: Checkout code
176-
uses: actions/checkout@v4
177-
178-
- name: Set up Python
179-
uses: actions/setup-python@v5
180-
with:
181-
python-version: '3.11'
182-
183-
- name: Install Poetry
184-
uses: snok/install-poetry@v1
185-
186-
- name: Install dependencies
187-
run: |
188-
poetry install --no-interaction
189-
190-
- name: Run integration tests
191-
run: |
192-
# Create a test project directory
193-
mkdir -p integration-test-project
194-
cd integration-test-project
195-
196-
# Create a dummy GDS file to test detection
197-
mkdir -p gds
198-
echo "dummy gds" > gds/user_project_wrapper.gds
199-
200-
# Run cf init
201-
cd ..
202-
poetry run cf init --project-root integration-test-project <<EOF
203-
test-project
204-
digital
205-
EOF || true
206-
207-
# Run cf setup with only-init
208-
poetry run cf setup --project-root integration-test-project --only-init
209-
210-
# Verify files were created
211-
test -f integration-test-project/.cf/project.json
212-
echo "✓ Integration test passed"
213-
214-
- name: Display project.json
215-
run: |
216-
cat integration-test-project/.cf/project.json
217-
echo "✓ Project configuration looks good"
32+
- name: Load cached venv
33+
id: cached-poetry-dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: .venv
37+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
38+
39+
- name: Install dependencies
40+
run: poetry install --no-interaction --no-root
41+
42+
- name: Install project
43+
run: poetry install --no-interaction
44+
45+
- name: Run unit tests for all commands
46+
run: |
47+
poetry run pytest tests/ -v --cov=chipfoundry_cli --cov-report=term-missing --cov-report=xml
21848
49+
- name: Upload coverage to Codecov
50+
uses: codecov/codecov-action@v4
51+
with:
52+
file: ./coverage.xml
53+
fail_ci_if_error: false

0 commit comments

Comments
 (0)