|
| 1 | +name: Package Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + package-name: |
| 7 | + description: "Name of the package to test" |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + package-path: |
| 11 | + description: "Path to the package directory" |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + debug-enabled: |
| 15 | + description: "Run with tmate.io debugging enabled" |
| 16 | + required: false |
| 17 | + type: boolean |
| 18 | + default: false |
| 19 | + nix-installer: |
| 20 | + description: "Nix installer strategy (quick or full)" |
| 21 | + required: false |
| 22 | + type: string |
| 23 | + default: "quick" |
| 24 | + |
| 25 | + workflow_call: |
| 26 | + inputs: |
| 27 | + package-name: |
| 28 | + description: "Name of the package to test" |
| 29 | + required: true |
| 30 | + type: string |
| 31 | + package-path: |
| 32 | + description: "Path to the package directory" |
| 33 | + required: true |
| 34 | + type: string |
| 35 | + debug-enabled: |
| 36 | + description: "Run with tmate.io debugging enabled" |
| 37 | + required: false |
| 38 | + type: string |
| 39 | + default: "false" |
| 40 | + nix-installer: |
| 41 | + description: "Nix installer strategy (quick or full)" |
| 42 | + required: false |
| 43 | + type: string |
| 44 | + default: "quick" |
| 45 | + secrets: |
| 46 | + SOPS_AGE_KEY: |
| 47 | + required: true |
| 48 | + |
| 49 | +defaults: |
| 50 | + run: |
| 51 | + shell: bash |
| 52 | + |
| 53 | +jobs: |
| 54 | + test: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Setup Nix |
| 60 | + uses: ./.github/actions/setup-nix |
| 61 | + env: |
| 62 | + SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} |
| 63 | + with: |
| 64 | + installer: ${{ inputs.nix-installer }} |
| 65 | + system: x86_64-linux |
| 66 | + setup-cachix: true |
| 67 | + |
| 68 | + - name: Setup tmate debug session |
| 69 | + uses: mxschmitt/action-tmate@e5c7151931ca95bad1c6f4190c730ecf8c7dde48 # ratchet:mxschmitt/action-tmate@v3 |
| 70 | + if: ${{ inputs.debug-enabled == 'true' }} |
| 71 | + |
| 72 | + - name: Install dependencies |
| 73 | + run: nix develop -c just install |
| 74 | + |
| 75 | + - name: Run unit tests with coverage |
| 76 | + run: nix develop -c just test-coverage |
| 77 | + |
| 78 | + - name: Build for E2E tests |
| 79 | + run: nix develop -c just build |
| 80 | + |
| 81 | + - name: Run E2E tests |
| 82 | + run: nix develop -c just test-e2e |
| 83 | + |
| 84 | + - name: Upload build artifacts |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: dist-${{ inputs.package-name }} |
| 88 | + path: ${{ inputs.package-path }}/dist/ |
| 89 | + retention-days: 7 |
| 90 | + include-hidden-files: true |
| 91 | + |
| 92 | + - name: Upload test results |
| 93 | + if: always() |
| 94 | + uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: playwright-report-${{ inputs.package-name }} |
| 97 | + path: ${{ inputs.package-path }}/playwright-report/ |
| 98 | + retention-days: 7 |
| 99 | + |
| 100 | + - name: Upload coverage |
| 101 | + if: always() |
| 102 | + uses: actions/upload-artifact@v4 |
| 103 | + with: |
| 104 | + name: coverage-${{ inputs.package-name }} |
| 105 | + path: ${{ inputs.package-path }}/coverage/ |
| 106 | + retention-days: 7 |
0 commit comments