diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 67a75f6..503a129 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -4,6 +4,8 @@ on: - main pull_request: merge_group: + schedule: + - cron: '0 0 * * *' # Every day at midnight UTC name: CI jobs: @@ -13,19 +15,21 @@ jobs: steps: - name: Check out source code uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Set up PDM uses: pdm-project/setup-pdm@v4 - - name: Install dependencies + + - name: Install dependencies with multirepo + uses: chipflow/pdm-multirepo@v1 + + - name: Run tests run: | - pdm install + pdm run test - name: Run lints run: | pdm run lint - - name: Run tests - run: | - pdm run test + - name: Run doc tests + run: pdm run test-docs license: runs-on: ubuntu-latest @@ -35,79 +39,51 @@ jobs: with: fetch-depth: 0 - name: Check source code licenses - run: | - docker run --platform=linux/amd64 -v ${PWD}:/src ghcr.io/google/addlicense -v -check -l BSD-2-Clause -c "ChipFlow" -s=only -ignore **/__init__.py **/*.py + run: docker run --platform=linux/amd64 -v ${{github.workspace}}:/src ghcr.io/google/addlicense -v -check -l BSD-2-Clause -c "ChipFlow" -s=only -ignore **/__init__.py **/*.py test-submit: runs-on: ubuntu-latest + strategy: + matrix: + dry: [true, false] + env: + DRY: ${{ matrix.dry && '--dry-run' || '' }} + IS_DRY: ${{ matrix.dry && '(dry run)' || '' }} + name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }} + steps: - name: Check out source code uses: actions/checkout@v4 - with: - fetch-depth: 0 - path: amaranth-orchard + - name: Check out chipflow-examples uses: actions/checkout@v4 with: repository: ChipFlow/chipflow-examples - fetch-depth: 0 path: chipflow-examples + ref: ${{ github.head_ref || 'refs/heads/main' }} - name: Set up PDM uses: pdm-project/setup-pdm@v4 with: - python-version: "3.10" + python-version: '3.10' cache: true - cache-dependency-path: "./**/pyproject.toml" - - name: Install dependencies - working-directory: ./chipflow-examples - run: | - pdm install - pdm run python -m ensurepip - pdm run python -m pip install -e ../amaranth-orchard - - name: Run tests - working-directory: ./chipflow-examples - run: | - pdm test - pdm run chipflow pin lock - pdm run chipflow silicon submit --wait - env: - CHIPFLOW_API_ORIGIN: 'https://build-staging.chipflow.org' - CHIPFLOW_API_KEY_ID: ${{ secrets.CHIPFLOW_API_KEY_ID }} - CHIPFLOW_API_KEY_SECRET: ${{ secrets.CHIPFLOW_API_KEY_SECRET }} - CHIPFLOW_BACKEND_VERSION: b7afdbf + cache-dependency-path: './**/pyproject.toml' - test-submit-dry: - runs-on: ubuntu-latest - steps: - - name: Check out source code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - path: amaranth-orchard - - name: Check out chipflow-examples - uses: actions/checkout@v4 - with: - repository: ChipFlow/chipflow-examples - fetch-depth: 0 - path: chipflow-examples - - name: Set up PDM - uses: pdm-project/setup-pdm@v4 + - name: Install dependencies with multirepo + uses: chipflow/pdm-multirepo@v1 with: - python-version: "3.10" - cache: true - cache-dependency-path: "./**/pyproject.toml" - - name: Install dependencies - working-directory: ./chipflow-examples - run: | - pdm install - pdm run python -m ensurepip - pdm run python -m pip install -e ../amaranth-orchard + working-directory: './chipflow-examples' - name: Run tests working-directory: ./chipflow-examples run: | pdm test + + - name: Submit build ${{ env.is_dry }} + working-directory: ./chipflow-examples/minimal + run: | pdm run chipflow pin lock - pdm run chipflow silicon submit --dry-run + pdm run chipflow silicon submit --wait $DRY + env: + CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}} diff --git a/pyproject.toml b/pyproject.toml index 0f8672b..449a2ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ dependencies = [ "chipflow-lib @ git+https://github.com/ChipFlow/chipflow-lib.git", "amaranth-soc @ git+https://github.com/amaranth-lang/amaranth-soc", "amaranth-stdio @ git+https://github.com/amaranth-lang/amaranth-stdio", - "pytest>=7.2.0", ] # Build system configuration @@ -45,9 +44,10 @@ test.cmd = "pytest" test-cov.cmd = "pytest --cov=amaranth-orchard cov-report=term" test-cov-html.cmd = "pytest --cov=amaranth-orchard --cov-report=html" # test-docs.cmd = "sphinx-build -b doctest docs/ docs/_build" +test-docs.cmd = "true" lint.cmd = "ruff check" -# docs.cmd = "sphinx-build docs/ docs/_build/ -W --keep-going" -test-examples.working_dir = "." +#docs.cmd = "sphinx-build docs/ docs/_build/ -W --keep-going" +doc.cmd = "true" [dependency-groups] diff --git a/tools/license_check.sh b/tools/license_check.sh new file mode 100755 index 0000000..3d05e57 --- /dev/null +++ b/tools/license_check.sh @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: BSD-2-Clause +#!/bin/bash + +