|
4 | 4 |
|
5 | 5 | jobs: |
6 | 6 | build: |
| 7 | + name: "Deno tests and build npm files" |
7 | 8 | runs-on: ubuntu-22.04 |
8 | 9 | steps: |
9 | 10 | - name: Checkout repo |
|
28 | 29 | - name: Setup Node |
29 | 30 | uses: actions/setup-node@v3 |
30 | 31 | with: |
31 | | - node-version: '18.x' |
| 32 | + node-version: '18.x' # Build files using a fixed node version |
32 | 33 | registry-url: 'https://registry.npmjs.org' |
33 | 34 |
|
34 | | - - name: Test building of npm files |
| 35 | + - name: Build npm files |
35 | 36 | run: deno task npm |
| 37 | + |
| 38 | + - name: Zip build files |
| 39 | + run: zip npm.zip ./npm -r |
| 40 | + |
| 41 | + - name: Upload build files for smoke tests |
| 42 | + uses: actions/upload-artifact@v3 |
| 43 | + with: |
| 44 | + name: npm |
| 45 | + path: npm.zip |
| 46 | + retention-days: 1 |
| 47 | + |
| 48 | + smoke-tests-commonjs: |
| 49 | + name: "Smoke tests (CommonJS)" |
| 50 | + needs: build |
| 51 | + runs-on: ubuntu-22.04 |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + node-version: [7.x, 8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x, 17.x, 18.x, 19.x] |
| 55 | + steps: |
| 56 | + - name: Checkout repo |
| 57 | + uses: actions/checkout@v3 |
| 58 | + |
| 59 | + - name: Setup Node |
| 60 | + uses: actions/setup-node@v3 |
| 61 | + with: |
| 62 | + node-version: ${{ matrix.node-version }} |
| 63 | + registry-url: 'https://registry.npmjs.org' |
| 64 | + |
| 65 | + - name: Download build files |
| 66 | + uses: actions/download-artifact@v3 |
| 67 | + with: |
| 68 | + name: npm |
| 69 | + |
| 70 | + - name: Unzip build files |
| 71 | + run: unzip npm.zip |
| 72 | + |
| 73 | + - name: Run smoke tests |
| 74 | + env: |
| 75 | + SERPAPI_TEST_KEY: ${{ secrets.SERPAPI_TEST_KEY }} |
| 76 | + run: | |
| 77 | + cd smoke_tests/commonjs |
| 78 | + npm i |
| 79 | + npm test |
| 80 | +
|
| 81 | + smoke-tests-esm: |
| 82 | + name: "Smoke tests (ESM)" |
| 83 | + needs: build |
| 84 | + runs-on: ubuntu-22.04 |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + node-version: [14.x, 15.x, 16.x, 17.x, 18.x, 19.x] |
| 88 | + steps: |
| 89 | + - name: Checkout repo |
| 90 | + uses: actions/checkout@v3 |
| 91 | + |
| 92 | + - name: Setup Node |
| 93 | + uses: actions/setup-node@v3 |
| 94 | + with: |
| 95 | + node-version: ${{ matrix.node-version }} |
| 96 | + registry-url: 'https://registry.npmjs.org' |
| 97 | + |
| 98 | + - name: Download build files |
| 99 | + uses: actions/download-artifact@v3 |
| 100 | + with: |
| 101 | + name: npm |
| 102 | + |
| 103 | + - name: Unzip build files |
| 104 | + run: unzip npm.zip |
| 105 | + |
| 106 | + - name: Run smoke tests |
| 107 | + env: |
| 108 | + SERPAPI_TEST_KEY: ${{ secrets.SERPAPI_TEST_KEY }} |
| 109 | + run: | |
| 110 | + cd smoke_tests/esm |
| 111 | + npm i |
| 112 | + npm test |
0 commit comments