diff --git a/.github/workflows/nodejs-next-test.js b/.github/workflows/nodejs-next-test.js new file mode 100644 index 0000000000..aa4be25ccb --- /dev/null +++ b/.github/workflows/nodejs-next-test.js @@ -0,0 +1,95 @@ +name: Node.js CI (Next) +on: + push: + branches: + # Treat the below branches as special case for working on workflows + - actions-** + - upcoming-** + schedule: + # run this Action every 14 days + - cron: '0 * */14 * *' + workflow_dispatch: + + +jobs: + lint: + name: Lint + runs-on: ubuntu-18.04 + + strategy: + matrix: + node-version: [12.x] + + steps: + - name: Checkout Source Files + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set Environment variables + run: cp sample.env .env + + - name: Lint Source Files + run: | + npm ci + npm run ensure-env --if-present + npm run lint --if-present + + test: + name: Test + needs: lint + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - name: Checkout Source Files + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set Environment variables + run: cp sample.env .env + + - name: Install Dependencies + env: SHOW_UPCOMING_CHANGES=true + run: | + npm ci + npm run ensure-env --if-present + + - name: Run Tests + run: npm test