2020-10-15 21:40:33 +02:00
|
|
|
name: Test NPM on Windows
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- '*.*'
|
|
|
|
pull_request:
|
|
|
|
|
2020-10-20 15:52:28 +02:00
|
|
|
env:
|
|
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
|
|
|
|
2020-10-15 21:40:33 +02:00
|
|
|
jobs:
|
|
|
|
# Verifies that installing NPM dependencies and building WordPress works on Windows.
|
|
|
|
#
|
|
|
|
# Performs the following steps:
|
2020-10-20 19:44:27 +02:00
|
|
|
# - Cancels all previous workflow runs for pull requests that have not completed.
|
2020-10-15 21:40:33 +02:00
|
|
|
# - Checks out the repository.
|
|
|
|
# - Logs debug information about the runner container.
|
2020-10-29 02:46:44 +01:00
|
|
|
# - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
|
2020-10-15 21:40:33 +02:00
|
|
|
# - Sets up caching for NPM.
|
2020-10-29 02:20:42 +01:00
|
|
|
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
2020-10-15 21:40:33 +02:00
|
|
|
# - Builds WordPress to run from the `build` directory.
|
|
|
|
test-npm:
|
|
|
|
name: Tests NPM on Windows
|
|
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
2020-10-20 19:44:27 +02:00
|
|
|
- name: Cancel previous runs of this workflow (pull requests only)
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
uses: styfle/cancel-workflow-action@0.5.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
|
2020-10-15 21:40:33 +02:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Log debug information
|
|
|
|
run: |
|
|
|
|
npm --version
|
|
|
|
node --version
|
|
|
|
curl --version
|
|
|
|
git --version
|
|
|
|
svn --version
|
|
|
|
|
|
|
|
- name: Install NodeJS
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
|
|
|
|
- name: Get NPM cache directory
|
|
|
|
id: npm-cache
|
|
|
|
run: echo "::set-output name=dir::$(npm config get cache)"
|
|
|
|
|
|
|
|
- name: Cache NodeJS modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
path: ${{ steps.npm-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-npm-
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
2020-10-29 02:20:42 +01:00
|
|
|
run: npx install-changed --install-command="npm ci"
|
2020-10-15 21:40:33 +02:00
|
|
|
|
|
|
|
- name: Build WordPress
|
|
|
|
run: npm run build
|