diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b97c47f..4499063 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -5,6 +5,8 @@ on: - 'latest-release' pull_request: merge_group: + repository_dispatch: + types: [backend-test] workflow_dispatch: inputs: release: @@ -14,12 +16,17 @@ on: ENVIRONMENT: required: true type: environment + backend_version: + description: 'Backend version/tag to test against (overrides vars.CHIPFLOW_BACKEND_VERSION)' + required: false + type: string env: lock_pdm: ${{ ! (github.ref_name == 'refs/heads/latest-release' || inputs.release) }} + BACKEND_VERSION: ${{ inputs.backend_version || github.event.client_payload.backend_version || vars.CHIPFLOW_BACKEND_VERSION }} name: CI -run-name: ${{ inputs.release && 'Release' || 'CI'}} +run-name: ${{ github.event_name == 'repository_dispatch' && format('Backend Test - {0}', github.event.client_payload.backend_version) || (inputs.backend_version && format('CI - Backend {0}', inputs.backend_version) || (inputs.release && 'Release' || 'CI')) }} jobs: submit: @@ -31,7 +38,7 @@ jobs: - name: Check out source code uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 - name: Set up PDM uses: pdm-project/setup-pdm@v4 @@ -43,6 +50,15 @@ jobs: - name: Install dependencies with multirepo uses: chipflow/pdm-multirepo@v1 + - name: Cache ~/.cache directory + uses: actions/cache@v4 + with: + path: ~/.cache + key: cache-${{ runner.os }}-${{ matrix.design }}-${{ hashFiles('**/pyproject.toml', '**/pdm.lock') }} + restore-keys: | + cache-${{ runner.os }}-${{ matrix.design }}- + cache-${{ runner.os }}- + - name: Lock pins working-directory: ./${{ matrix.design }} run: pdm run chipflow pin lock @@ -53,7 +69,7 @@ jobs: env: CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}} CHIPFLOW_API_ORIGIN: ${{ vars.CHIPFLOW_API_ORIGIN }} - CHIPFLOW_BACKEND_VERSION: ${{ vars.CHIPFLOW_BACKEND_VERSION }} + CHIPFLOW_BACKEND_VERSION: ${{ env.BACKEND_VERSION }} test: runs-on: ubuntu-latest @@ -74,13 +90,14 @@ jobs: - name: Install dependencies with multirepo uses: chipflow/pdm-multirepo@v1 - - name: Cache YoWASP build products + - name: Cache ~/.cache directory uses: actions/cache@v4 with: - path: ~/.cache/YoWASP - key: YoWASP-${{ runner.os }}-${{ hashFiles('./.venv/**/*.wasm') }} + path: ~/.cache + key: cache-${{ runner.os }}-${{ matrix.design }}-${{ hashFiles('**/pyproject.toml', '**/pdm.lock') }} restore-keys: | - YoWASP-${{ runner.os }}- + cache-${{ runner.os }}-${{ matrix.design }}- + cache-${{ runner.os }}- - name: Lock pins working-directory: ./${{ matrix.design }}