|
| 1 | +# Ensures packages and demos test correctly |
| 2 | +name: Test Isolated Demos |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + |
| 7 | +jobs: |
| 8 | + test: |
| 9 | + name: Test Isolated Demos |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + persist-credentials: false |
| 15 | + |
| 16 | + - name: Setup NodeJS |
| 17 | + uses: actions/setup-node@v4 |
| 18 | + with: |
| 19 | + node-version-file: '.nvmrc' |
| 20 | + |
| 21 | + - uses: pnpm/action-setup@v2 |
| 22 | + name: Install pnpm |
| 23 | + with: |
| 24 | + # Pnpm 9.4 introduces this https://github.com/pnpm/pnpm/pull/7633 |
| 25 | + # which causes workspace:^1.2.0 to be converted to 1.2.0^1.2.0 |
| 26 | + version: 9.3 |
| 27 | + run_install: false |
| 28 | + |
| 29 | + - name: Get pnpm store directory |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 33 | +
|
| 34 | + - uses: actions/cache@v3 |
| 35 | + name: Setup pnpm cache |
| 36 | + with: |
| 37 | + path: ${{ env.STORE_PATH }} |
| 38 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 39 | + restore-keys: | |
| 40 | + ${{ runner.os }}-pnpm-store- |
| 41 | +
|
| 42 | + - name: Install |
| 43 | + run: pnpm install |
| 44 | + |
| 45 | + - name: Build Packages |
| 46 | + run: pnpm build:packages |
| 47 | + |
| 48 | + - name: Start Verdaccio |
| 49 | + run: | |
| 50 | + npm install -g verdaccio |
| 51 | + nohup verdaccio -c verdaccio-config.yaml & |
| 52 | + sleep 10 # Give Verdaccio some time to start |
| 53 | +
|
| 54 | + - name: Prepare For Test Publish |
| 55 | + run: npx tsx scripts/test-publish-helper.ts |
| 56 | + |
| 57 | + - name: Registry login |
| 58 | + run: npx npm-cli-login -u test -p test -e [email protected] -r http://localhost:4873 |
| 59 | + |
| 60 | + - name: Config Temporary Registry |
| 61 | + run: echo "@powersync:registry=http://localhost:4873" >> ~/.npmrc |
| 62 | + |
| 63 | + # No actual auth is ever supplied to this action. |
| 64 | + # It should never be able to publish to NPMJS |
| 65 | + - name: Test publish |
| 66 | + run: pnpm -r publish --no-git-checks |
| 67 | + |
| 68 | + - name: Test Demos |
| 69 | + run: npx tsx scripts/isolated-demo-test.ts |
0 commit comments