From 5112fec0cacf9efd067cab15fff4175c30e276db Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Wed, 7 Feb 2024 10:27:15 +0000 Subject: [PATCH] Add npx scripts and workflows for isolated testing --- .github/fixtures/npx_scripts.json | 69 +++++++++++++++++++++++++++++++ .github/workflows/isolated.yml | 29 +++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .github/fixtures/npx_scripts.json diff --git a/.github/fixtures/npx_scripts.json b/.github/fixtures/npx_scripts.json new file mode 100644 index 00000000000..0b7a40bf6e3 --- /dev/null +++ b/.github/fixtures/npx_scripts.json @@ -0,0 +1,69 @@ +{ + "commands": [ + { + "name": "npm init @google-labs/breadboard", + "script": [ + "npm init @google-labs/breadboard" + ] + }, + { + "name": "npx cli run", + "script": [ + "wget https//raw.githubusercontent.com/ExaDev-io/breadboard-samples/develop/samples/Breadboard%20Walkthrough/src/hello-world/board.json -O board.json", + "npx @google-labs/breadboard-cli run board.json" + ] + }, + { + "name": "install + npx cli run", + "script": [] + }, + { + "name": "install x2 + npx cli run", + "script": [] + }, + { + "name": "install + npx breadboard run", + "script": [] + }, + { + "name": "npx cli mermaid", + "script": [] + }, + { + "name": "install + npx cli mermaid", + "script": [] + }, + { + "name": "install x2 + npx cli mermaid", + "script": [] + }, + { + "name": "install + npx breadboard mermaid", + "script": [] + }, + { + "script": [], + "name": "npm init" + }, + { + "script": [], + "name": "npx create" + }, + { + "script": [], + "name": "install + npx create" + }, + { + "script": [], + "name": "npm init kit" + }, + { + "script": [], + "name": "npx create-kit" + }, + { + "script": [], + "name": "install + npx create-kit" + } + ] +} diff --git a/.github/workflows/isolated.yml b/.github/workflows/isolated.yml index 35871703a83..a0bd411446d 100644 --- a/.github/workflows/isolated.yml +++ b/.github/workflows/isolated.yml @@ -11,6 +11,35 @@ env: BOARD: dl_board.json jobs: + setup: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.matrix.outputs.matrix }} + steps: + - name: Checkout CI fixtures + user: actions/checkout@mail + with: + sparse-checkout: .github/fixtures + - name: Read .github/fixtures/npx_scripts.json + id: matrix + run: | + JSON_CONTENT=$(cat .github/fixtures/npx_scripts.json) + echo $JSON_CONTENT + echo "matrix=$(echo $JSON_CONTENT | jq -r '.commands[] | "name=\(.name) script=\(.script)"')" > $GITHUB_ENV + test-current-release: + needs: setup + strategy: + fail-fast: false + matrix: ${{fromJson(needs.setup.outputs.matrix)}} + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@main + with: + node-version: "21.x" + - name: ${{ matrix.name }} + run: + ${{ matrix.script }} + publish: permissions: contents: read