|
| 1 | +name: UI |
| 2 | +permissions: |
| 3 | + contents: read |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [ master ] |
| 8 | + paths: ['ui/**'] |
| 9 | + pull_request: |
| 10 | + paths: ['ui/**'] |
| 11 | + |
| 12 | +jobs: |
| 13 | + changes: |
| 14 | + name: Detect Changes |
| 15 | + runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + projects: ${{ steps.filter.outputs.projects }} |
| 18 | + steps: |
| 19 | + - name: Harden the runner (Audit all outbound calls) |
| 20 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 21 | + with: |
| 22 | + egress-policy: audit |
| 23 | + |
| 24 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
| 25 | + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 26 | + id: paths |
| 27 | + with: |
| 28 | + filters: | |
| 29 | + tips: |
| 30 | + - 'ui/tips/**' |
| 31 | + - id: filter |
| 32 | + run: | |
| 33 | + projects='[]' |
| 34 | + if [ "${{ steps.paths.outputs.tips }}" == "true" ]; then |
| 35 | + projects=$(echo "$projects" | jq -c '. + ["tips"]') |
| 36 | + fi |
| 37 | + echo "projects=$projects" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + lint: |
| 40 | + name: Lint (${{ matrix.project }}) |
| 41 | + needs: changes |
| 42 | + if: ${{ needs.changes.outputs.projects != '[]' }} |
| 43 | + runs-on: ubuntu-latest |
| 44 | + strategy: |
| 45 | + matrix: |
| 46 | + project: ${{ fromJson(needs.changes.outputs.projects) }} |
| 47 | + steps: |
| 48 | + - name: Harden the runner (Audit all outbound calls) |
| 49 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 50 | + with: |
| 51 | + egress-policy: audit |
| 52 | + |
| 53 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
| 54 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 55 | + with: |
| 56 | + node-version: '20' |
| 57 | + cache: 'yarn' |
| 58 | + cache-dependency-path: ui/${{ matrix.project }}/yarn.lock |
| 59 | + - run: cp .env.example ui/${{ matrix.project }}/.env |
| 60 | + - run: cd ui/${{ matrix.project }} && yarn install |
| 61 | + - run: cd ui/${{ matrix.project }} && yarn lint |
| 62 | + |
| 63 | + type-check: |
| 64 | + name: Type Check (${{ matrix.project }}) |
| 65 | + needs: changes |
| 66 | + if: ${{ needs.changes.outputs.projects != '[]' }} |
| 67 | + runs-on: ubuntu-latest |
| 68 | + strategy: |
| 69 | + matrix: |
| 70 | + project: ${{ fromJson(needs.changes.outputs.projects) }} |
| 71 | + steps: |
| 72 | + - name: Harden the runner (Audit all outbound calls) |
| 73 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 74 | + with: |
| 75 | + egress-policy: audit |
| 76 | + |
| 77 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
| 78 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 79 | + with: |
| 80 | + node-version: '20' |
| 81 | + cache: 'yarn' |
| 82 | + cache-dependency-path: ui/${{ matrix.project }}/yarn.lock |
| 83 | + - run: cp .env.example ui/${{ matrix.project }}/.env |
| 84 | + - run: cd ui/${{ matrix.project }} && yarn install |
| 85 | + - run: cd ui/${{ matrix.project }} && npx tsc --noEmit |
| 86 | + |
| 87 | + build: |
| 88 | + name: Build (${{ matrix.project }}) |
| 89 | + needs: changes |
| 90 | + if: ${{ needs.changes.outputs.projects != '[]' }} |
| 91 | + runs-on: ubuntu-latest |
| 92 | + strategy: |
| 93 | + matrix: |
| 94 | + project: ${{ fromJson(needs.changes.outputs.projects) }} |
| 95 | + steps: |
| 96 | + - name: Harden the runner (Audit all outbound calls) |
| 97 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 98 | + with: |
| 99 | + egress-policy: audit |
| 100 | + |
| 101 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
| 102 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 103 | + with: |
| 104 | + node-version: '20' |
| 105 | + cache: 'yarn' |
| 106 | + cache-dependency-path: ui/${{ matrix.project }}/yarn.lock |
| 107 | + - run: cp .env.example ui/${{ matrix.project }}/.env |
| 108 | + - run: cd ui/${{ matrix.project }} && yarn install |
| 109 | + - run: cd ui/${{ matrix.project }} && yarn build |
0 commit comments