repos / starfx

supercharged async flow control library.
git clone https://github.com/neurosnap/starfx.git

starfx / .github / workflows
Eric Bower · 06 Feb 24

test-ecosystem.yml

 1name: test-ecosystem
 2
 3on:
 4  push:
 5    branches: main
 6  pull_request:
 7    branches: main
 8
 9permissions:
10  contents: read
11
12jobs:
13  test-ecosystem:
14    name: ${{ matrix.example.repo }}/${{ matrix.example.folder }}
15    runs-on: ubuntu-latest
16    strategy:
17      fail-fast: false
18      matrix:
19        example:
20          - owner: neurosnap
21            repo: starfx-examples
22            folder: vite-react
23          - owner: neurosnap
24            repo: starfx-examples
25            folder: parcel-react
26          - owner: neurosnap
27            repo: starfx-examples
28            folder: tests-rtl
29    steps:
30      - name: checkout main repo
31        uses: actions/checkout@v4
32        with:
33          repository: "neurosnap/starfx"
34          path: "starfx"
35
36      - name: setup deno
37        uses: denoland/setup-deno@v1
38        with:
39          deno-version: v1.x
40
41      # determines branch and sets it as output available through the `id`
42      - name: dynamically determine ${{ matrix.example.owner }}/${{ matrix.example.repo }} branch
43        id: conditionalBranch
44        shell: bash
45        run: deno run -A ./starfx/scripts/branch-exists.ts "$GITHUB_HEAD_REF" neurosnap/starfx-examples
46
47      - name: checkout ${{ matrix.example.owner }}/${{ matrix.example.repo }} on ${{ steps.conditionalBranch.outputs.branch }}
48        uses: actions/checkout@v4
49        with:
50          repository: ${{ matrix.example.owner }}/${{ matrix.example.repo }}
51          path: ${{ matrix.example.repo }}
52          ref: ${{ steps.conditionalBranch.outputs.branch }}
53
54      - name: bundle for npm
55        shell: bash
56        run: deno task npm 0.0.0
57        working-directory: starfx
58
59      # install in example repos
60      - name: install ${{ matrix.example.owner }}/${{ matrix.example.repo }}
61        shell: bash
62        working-directory: ${{ matrix.example.repo }}/${{ matrix.example.folder }}
63        run: npm install
64
65      # symlink example repos
66      - name: symlink built assets
67        shell: bash
68        run: deno task sync-build-to install ${{ matrix.example.repo }}/${{ matrix.example.folder }}
69        working-directory: starfx
70
71      # run build and test in example repos
72      - name: build ${{ matrix.example.owner }}/${{ matrix.example.repo }}
73        working-directory: ${{ matrix.example.repo }}/${{ matrix.example.folder }}
74        run: npm run build --if-present
75      - name: test ${{ matrix.example.owner }}/${{ matrix.example.repo }}
76        working-directory: ${{ matrix.example.repo }}/${{ matrix.example.folder }}
77        run: npm run test --if-present