Merge pull request #1 from chipfoundry/makefile_porting #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}-${{ matrix.python-version }}- | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction --no-root | |
| - name: Install project | |
| run: | | |
| poetry install --no-interaction | |
| - name: Run unit tests | |
| run: | | |
| poetry run pytest tests/ -v --cov=chipfoundry_cli --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| test-setup-command: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction | |
| - name: Test cf setup --dry-run | |
| run: | | |
| poetry run cf setup --dry-run --only-init | |
| - name: Test cf setup with skip flags | |
| run: | | |
| mkdir -p test-project | |
| cd test-project | |
| poetry run cf setup --only-init --skip-ipm | |
| - name: Verify project.json created | |
| run: | | |
| test -f test-project/.cf/project.json | |
| echo "✓ project.json created successfully" | |
| - name: Test cf setup help | |
| run: | | |
| poetry run cf setup --help | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction | |
| - name: Run ruff linter | |
| run: | | |
| poetry run ruff check chipfoundry_cli/ tests/ || true | |
| - name: Run black formatter check | |
| run: | | |
| poetry run black --check chipfoundry_cli/ tests/ || true | |
| - name: Run mypy type checker | |
| run: | | |
| poetry run mypy chipfoundry_cli/ || true | |
| test-docker: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Test Docker availability for setup | |
| run: | | |
| docker --version | |
| docker info | |
| - name: Test cf setup with Docker checks (dry-run) | |
| run: | | |
| poetry run cf setup --dry-run | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-interaction | |
| - name: Run integration tests | |
| run: | | |
| # Create a test project directory | |
| mkdir -p integration-test-project | |
| cd integration-test-project | |
| # Create a dummy GDS file to test detection | |
| mkdir -p gds | |
| echo "dummy gds" > gds/user_project_wrapper.gds | |
| # Run cf init | |
| cd .. | |
| poetry run cf init --project-root integration-test-project <<EOF | |
| test-project | |
| digital | |
| EOF || true | |
| # Run cf setup with only-init | |
| poetry run cf setup --project-root integration-test-project --only-init | |
| # Verify files were created | |
| test -f integration-test-project/.cf/project.json | |
| echo "✓ Integration test passed" | |
| - name: Display project.json | |
| run: | | |
| cat integration-test-project/.cf/project.json | |
| echo "✓ Project configuration looks good" | |