|
| 1 | +on: |
| 2 | + pull_request: |
| 3 | + branches: [main] |
| 4 | + |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +defaults: |
| 9 | + run: |
| 10 | + working-directory: popgetter-browser/ |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Install pnpm |
| 21 | + uses: pnpm/action-setup@v4 |
| 22 | + with: |
| 23 | + version: 9 |
| 24 | + |
| 25 | + - name: Install wasm-pack |
| 26 | + uses: jetli/wasm-pack-action@v0.4.0 |
| 27 | + |
| 28 | + - name: Cache WASM build |
| 29 | + uses: actions/cache@v3 |
| 30 | + with: |
| 31 | + path: rust_backend/target |
| 32 | + key: rust_backend |
| 33 | + |
| 34 | + - name: Install dependencies for all packages |
| 35 | + run: pnpm install |
| 36 | + |
| 37 | + # NOTE: It's important to build @uatp/components _before_ uatp_template, |
| 38 | + # since the latter depends on it. |
| 39 | + - name: Test @uatp/components |
| 40 | + run: | |
| 41 | + pnpm --filter=@uatp/components build |
| 42 | + pnpm --filter=@uatp/components test |
| 43 | +
|
| 44 | + - name: Test @uatp/template |
| 45 | + run: | |
| 46 | + pnpm --filter=@uatp/template rust |
| 47 | + pnpm --filter=@uatp/template python |
| 48 | + pnpm --filter=@uatp/template build |
| 49 | + pnpm --filter=@uatp/template test |
| 50 | +
|
| 51 | + # pnpm can't do 'exec', have to use npm |
| 52 | + - name: Install npm |
| 53 | + uses: actions/setup-node@v4 |
| 54 | + |
| 55 | + - name: Test @uatp/create-web Rust |
| 56 | + run: | |
| 57 | + npm exec ./packages/create-web -- --directory /tmp/rust --project-name rust --backend rust |
| 58 | + cd /tmp/rust/web |
| 59 | + pnpm install |
| 60 | + pnpm rust |
| 61 | + pnpm build |
| 62 | + pnpm test |
| 63 | +
|
| 64 | + - name: Test @uatp/create-web Python |
| 65 | + run: | |
| 66 | + npm exec ./packages/create-web -- --directory /tmp/python --project-name python --backend python |
| 67 | + cd /tmp/python/web |
| 68 | + pnpm install |
| 69 | + pnpm python |
| 70 | + pnpm build |
| 71 | + pnpm test |
| 72 | +
|
| 73 | + - name: Test @uatp/create-web no-backend |
| 74 | + run: | |
| 75 | + npm exec ./packages/create-web -- --directory /tmp/none --project-name none --backend none |
| 76 | + cd /tmp/none/web |
| 77 | + pnpm install |
| 78 | + pnpm build |
| 79 | + pnpm test |
| 80 | +
|
| 81 | +
|
| 82 | +
|
| 83 | + pre-commit: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + steps: |
| 86 | + - name: Checkout |
| 87 | + uses: actions/checkout@v4 |
| 88 | + |
| 89 | + - name: Set up Python |
| 90 | + uses: actions/setup-python@v5 |
| 91 | + |
| 92 | + - name: Install pnpm |
| 93 | + uses: pnpm/action-setup@v4 |
| 94 | + with: |
| 95 | + version: 9 |
| 96 | + |
| 97 | + - name: Install pnpm components |
| 98 | + run: | |
| 99 | + pnpm install |
| 100 | +
|
| 101 | + - name: Run pre-commit |
| 102 | + uses: pre-commit/action@v3.0.1 |
| 103 | + |
| 104 | + - name: Update pre-commit |
| 105 | + uses: pre-commit-ci/lite-action@main |
| 106 | + if: always() |
0 commit comments