Because the source code is written in ESM syntax and we cannot use the `esm` package to make `require()` ESM compatible, since that package does not support legacy versions of Node.js. Also in our usage tests in CI, we need to mimck the npm packaging behaviour where building is involved.remove-build-output-from-git
| @@ -3,15 +3,41 @@ name: Package usage | |||||
| on: [push, pull_request] | on: [push, pull_request] | ||||
| jobs: | jobs: | ||||
| build: | |||||
| runs-on: ubuntu-latest | |||||
| steps: | |||||
| - uses: actions/checkout@v2 | |||||
| - name: Setup Node.js | |||||
| uses: actions/setup-node@v1 | |||||
| with: | |||||
| node-version: 14.x | |||||
| - name: npm install and build | |||||
| run: | | |||||
| npm install | |||||
| npm run build | |||||
| - name: Store build-output for later | |||||
| uses: actions/upload-artifact@v2 | |||||
| with: | |||||
| name: build-output | |||||
| path: | | |||||
| mustache.js | |||||
| mustache.mjs | |||||
| package: | package: | ||||
| runs-on: ubuntu-latest | runs-on: ubuntu-latest | ||||
| needs: build | |||||
| steps: | steps: | ||||
| - uses: actions/checkout@v2 | - uses: actions/checkout@v2 | ||||
| - name: Setup Node.js | - name: Setup Node.js | ||||
| uses: actions/setup-node@v1 | uses: actions/setup-node@v1 | ||||
| with: | with: | ||||
| node-version: 14.x | node-version: 14.x | ||||
| - name: Get build-output from build step | |||||
| uses: actions/download-artifact@v2 | |||||
| with: | |||||
| name: build-output | |||||
| - name: Create package tarball | - name: Create package tarball | ||||
| run: | | run: | | ||||
| export ARCHIVE_FILENAME=$(npm pack | tail -n 1) | export ARCHIVE_FILENAME=$(npm pack | tail -n 1) | ||||
| @@ -71,12 +97,17 @@ jobs: | |||||
| browser-usage: | browser-usage: | ||||
| runs-on: ubuntu-latest | runs-on: ubuntu-latest | ||||
| needs: build | |||||
| steps: | steps: | ||||
| - uses: actions/checkout@v1 | - uses: actions/checkout@v1 | ||||
| - name: Setup Node.js | - name: Setup Node.js | ||||
| uses: actions/setup-node@v1 | uses: actions/setup-node@v1 | ||||
| with: | with: | ||||
| node-version: 12.x | node-version: 12.x | ||||
| - name: Get build-output from build step | |||||
| uses: actions/download-artifact@v2 | |||||
| with: | |||||
| name: build-output | |||||
| - name: Install and test | - name: Install and test | ||||
| run: | | run: | | ||||
| npm ci | npm ci | ||||
| @@ -85,10 +116,15 @@ jobs: | |||||
| deno-usage: | deno-usage: | ||||
| runs-on: ubuntu-latest | runs-on: ubuntu-latest | ||||
| needs: build | |||||
| steps: | steps: | ||||
| - uses: actions/checkout@v1 | - uses: actions/checkout@v1 | ||||
| - uses: denolib/setup-deno@master | - uses: denolib/setup-deno@master | ||||
| with: | with: | ||||
| deno-version: 'v1.0.0' | deno-version: 'v1.0.0' | ||||
| - name: Get build-output from build step | |||||
| uses: actions/download-artifact@v2 | |||||
| with: | |||||
| name: build-output | |||||
| - run: deno --version | - run: deno --version | ||||
| - run: deno test --allow-net=deno.land test/module-systems/deno-test.ts | - run: deno test --allow-net=deno.land test/module-systems/deno-test.ts | ||||
| @@ -35,6 +35,27 @@ jobs: | |||||
| npm install | npm install | ||||
| npm run test-unit | npm run test-unit | ||||
| build: | |||||
| runs-on: ubuntu-latest | |||||
| steps: | |||||
| - uses: actions/checkout@v2 | |||||
| - name: Setup Node.js | |||||
| uses: actions/setup-node@v1 | |||||
| with: | |||||
| node-version: 14.x | |||||
| - name: npm install and build | |||||
| run: | | |||||
| npm install | |||||
| npm run build | |||||
| - name: Store build-output for later | |||||
| uses: actions/upload-artifact@v2 | |||||
| with: | |||||
| name: build-output | |||||
| path: | | |||||
| mustache.js | |||||
| mustache.mjs | |||||
| tests-on-legacy: | tests-on-legacy: | ||||
| runs-on: ubuntu-latest | runs-on: ubuntu-latest | ||||
| @@ -42,6 +63,7 @@ jobs: | |||||
| matrix: | matrix: | ||||
| node-version: [0.10.x, 0.12.x, 4.x, 6.x, 8.x] | node-version: [0.10.x, 0.12.x, 4.x, 6.x, 8.x] | ||||
| needs: build | |||||
| steps: | steps: | ||||
| - uses: actions/checkout@v2 | - uses: actions/checkout@v2 | ||||
| with: | with: | ||||
| @@ -50,6 +72,10 @@ jobs: | |||||
| uses: actions/setup-node@v1 | uses: actions/setup-node@v1 | ||||
| with: | with: | ||||
| node-version: ${{ matrix.node-version }} | node-version: ${{ matrix.node-version }} | ||||
| - name: Get build-output from build step | |||||
| uses: actions/download-artifact@v2 | |||||
| with: | |||||
| name: build-output | |||||
| - name: npm install and test | - name: npm install and test | ||||
| run: | | run: | | ||||
| npm install mocha@3 chai@3 | npm install mocha@3 chai@3 | ||||
| @@ -36,7 +36,8 @@ | |||||
| "pre-test-browser": "node test/create-browser-suite.js", | "pre-test-browser": "node test/create-browser-suite.js", | ||||
| "test-browser": "npm run pre-test-browser && zuul -- test/context-test.js test/parse-test.js test/scanner-test.js test/render-test-browser.js", | "test-browser": "npm run pre-test-browser && zuul -- test/context-test.js test/parse-test.js test/scanner-test.js test/render-test-browser.js", | ||||
| "test-browser-local": "npm run pre-test-browser && zuul --local 8080 -- test/context-test.js test/scanner-test.js test/parse-test.js test/render-test-browser.js", | "test-browser-local": "npm run pre-test-browser && zuul --local 8080 -- test/context-test.js test/scanner-test.js test/parse-test.js test/render-test-browser.js", | ||||
| "postversion": "scripts/bump-version-in-source" | |||||
| "postversion": "scripts/bump-version-in-source", | |||||
| "prepublishOnly": "npm run build" | |||||
| }, | }, | ||||
| "devDependencies": { | "devDependencies": { | ||||
| "chai": "^3.4.0", | "chai": "^3.4.0", | ||||