|
| 1 | +name: Test npm package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: "Package version to test" |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + test_npm_binaries: |
| 12 | + runs-on: ${{ matrix.platforms }} |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + platforms: [ubuntu-latest, windows-2019, macos-11] |
| 17 | + node-version: [14.x, 16.x, 18.x] |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Use Node.js ${{ matrix.node-version }} |
| 21 | + uses: actions/setup-node@v1 |
| 22 | + with: |
| 23 | + node-version: ${{ matrix.node-version }} |
| 24 | + - run: npm i -g npm@latest |
| 25 | + - name: Set up the unit tests |
| 26 | + run: | |
| 27 | + curl https://codeload.github.com/mmomtchev/pymport/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip |
| 28 | + unzip repo.zip |
| 29 | + mv pymport-${{ github.event.inputs.version }}/package.json . |
| 30 | + mv pymport-${{ github.event.inputs.version }}/test . |
| 31 | + npm install |
| 32 | + - name: Install from npm |
| 33 | + run: npm install --force pymport@${{ github.event.inputs.version }} |
| 34 | + - name: Run the unit tests |
| 35 | + run: | |
| 36 | + cd test |
| 37 | + npx mocha --reporter=tap -r ts-node/register -r tsconfig-paths/register --timeout 20000 --v8-expose-gc *.test.ts |
| 38 | + env: |
| 39 | + TS_NODE_PROJECT: tsconfig.test.json |
| 40 | + MOCHA_SKIP_EXEC: 1 |
| 41 | + |
| 42 | + test_npm_rebuild: |
| 43 | + runs-on: ${{ matrix.platforms }} |
| 44 | + |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + platforms: [ubuntu-latest, windows-2019, macos-11] |
| 48 | + node-version: [14.x, 16.x, 18.x] |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Use Node.js ${{ matrix.node-version }} |
| 52 | + uses: actions/setup-node@v1 |
| 53 | + with: |
| 54 | + node-version: ${{ matrix.node-version }} |
| 55 | + - run: npm i -g npm@latest |
| 56 | + - name: Set up the unit tests |
| 57 | + run: | |
| 58 | + curl https://codeload.github.com/mmomtchev/pymport/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip |
| 59 | + unzip repo.zip |
| 60 | + mv pymport-${{ github.event.inputs.version }}/package.json . |
| 61 | + mv pymport-${{ github.event.inputs.version }}/test . |
| 62 | + npm install |
| 63 | + - name: Rebuild with npm |
| 64 | + run: npm install --verbose --force pymport@${{ github.event.inputs.version }} --build-from-source |
| 65 | + - name: Run the unit tests |
| 66 | + run: | |
| 67 | + cd test |
| 68 | + npx mocha --reporter=tap -r ts-node/register -r tsconfig-paths/register --timeout 20000 --v8-expose-gc *.test.ts |
| 69 | + env: |
| 70 | + TS_NODE_PROJECT: tsconfig.test.json |
| 71 | + MOCHA_SKIP_EXEC: 1 |
0 commit comments