From 4dbc88deb7e5b55f0f31647f558876c193fa50e3 Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Sun, 7 Feb 2021 13:42:22 +0100 Subject: [PATCH] Extract usage tests into separate GitHub Actions workflow Primarily to group similar kinds of "usage" tests together, which are all either verifying the use of mustache.js from consuming party' point of view. --- .github/workflows/usage.yml | 94 ++++++++++++++++++++++++++++++++++++ .github/workflows/verify.yml | 63 ------------------------ 2 files changed, 94 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/usage.yml diff --git a/.github/workflows/usage.yml b/.github/workflows/usage.yml new file mode 100644 index 0000000..5608b2e --- /dev/null +++ b/.github/workflows/usage.yml @@ -0,0 +1,94 @@ +name: Package usage + +on: [push, pull_request] + +jobs: + package: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 14.x + - name: Create package tarball + run: | + export ARCHIVE_FILENAME=$(npm pack | tail -n 1) + mv $ARCHIVE_FILENAME mustache.tgz + - name: Store package tarball for later + uses: actions/upload-artifact@v2 + with: + name: package-output + path: mustache.tgz + + common-js-usage: + runs-on: ubuntu-latest + + needs: package + steps: + - uses: actions/checkout@v1 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Get package tarball from package step + uses: actions/download-artifact@v2 + with: + name: package-output + - name: Package, install and test + run: | + export UNPACK_DESTINATION=$(mktemp -d) + mv mustache.tgz $UNPACK_DESTINATION + cp test/module-systems/commonjs-test.js $UNPACK_DESTINATION + cd $UNPACK_DESTINATION + npm install mustache.tgz + node commonjs-test.js + + esm-usage: + runs-on: ubuntu-latest + + needs: package + steps: + - uses: actions/checkout@v1 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: '>=13.2.0' + - name: Get package tarball from package step + uses: actions/download-artifact@v2 + with: + name: package-output + - name: Package, install and test + run: | + export UNPACK_DESTINATION=$(mktemp -d) + mv mustache.tgz $UNPACK_DESTINATION + cp test/module-systems/esm-test.mjs $UNPACK_DESTINATION + cd $UNPACK_DESTINATION + npm install mustache.tgz + node esm-test.mjs + + browser-usage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Install and test + run: | + npm ci + npx mocha test/module-systems/browser-test.js + + deno-usage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: denolib/setup-deno@master + with: + deno-version: 'v1.0.0' + - run: deno --version + - run: deno test --allow-net=deno.land test/module-systems/deno-test.ts diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 5a1a5fe..6406f5e 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -43,69 +43,6 @@ jobs: npm install mocha@3 chai@3 npm run test-unit - common-js-usage: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: Package, install and test - run: | - export ARCHIVE_FILENAME=$(npm pack | tail -n 1) - export UNPACK_DESTINATION=$(mktemp -d) - mv $ARCHIVE_FILENAME $UNPACK_DESTINATION - cp test/module-systems/commonjs-test.js $UNPACK_DESTINATION - cd $UNPACK_DESTINATION - npm install $ARCHIVE_FILENAME - node commonjs-test.js - - esm-usage: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: '>=13.2.0' - - name: Package, install and test - run: | - export ARCHIVE_FILENAME=$(npm pack | tail -n 1) - export UNPACK_DESTINATION=$(mktemp -d) - mv $ARCHIVE_FILENAME $UNPACK_DESTINATION - cp test/module-systems/esm-test.mjs $UNPACK_DESTINATION - cd $UNPACK_DESTINATION - npm install $ARCHIVE_FILENAME - node esm-test.mjs - - browser-usage: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: Install and test - run: | - npm ci - npx mocha test/module-systems/browser-test.js - - deno-usage: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - uses: denolib/setup-deno@master - with: - deno-version: 'v1.0.0' - - run: deno --version - - run: deno test --allow-net=deno.land test/module-systems/deno-test.ts - build-output-sync: runs-on: ubuntu-latest