build: fix windows build, build on multiple os using node 12 only (#3449)

This commit is contained in:
Erez Rokah 2020-03-23 14:57:18 +02:00 committed by GitHub
parent ce69fdd66b
commit 228c6b41e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 33 deletions

View File

@ -18,14 +18,14 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
node-version: [10.x, 12.x] os: [macos-latest, windows-latest, ubuntu-latest]
node-version: [12.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
@ -36,9 +36,6 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: | restore-keys: |
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-
- name: update yarn to latest version
run: |
sudo apt update && sudo apt install yarn
- name: npm install, unit test and build - name: npm install, unit test and build
run: | run: |
node --version node --version
@ -53,25 +50,26 @@ jobs:
NODE_OPTIONS: --max-old-space-size=4096 NODE_OPTIONS: --max-old-space-size=4096
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:
name: dev-test-website-node-${{ matrix.node-version }} name: dev-test-website-${{ runner.os }}-node-${{ matrix.node-version }}
path: dev-test path: dev-test
# non forked workflow (has access to build secrets) # non forked workflow (has access to build secrets)
e2e-with-cypress-record: e2e-with-cypress-record:
needs: build needs: build
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
runs-on: ubuntu-16.04 runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
machine: [1, 2, 3, 4, 5, 6, 7, 8] machine: [1, 2, 3, 4, 5, 6, 7, 8]
node-version: [12.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Use Node.js 10.x - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 10.x node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1 - uses: actions/cache@v1
with: with:
path: ~/.cache/yarn path: ~/.cache/yarn
@ -80,11 +78,8 @@ jobs:
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-
- uses: actions/download-artifact@master - uses: actions/download-artifact@master
with: with:
name: dev-test-website-node-10.x name: dev-test-website-${{ runner.os }}-node-${{ matrix.node-version }}
path: dev-test path: dev-test
- name: update yarn to latest version
run: |
sudo apt update && sudo apt install yarn
- name: npm install and e2e test - name: npm install and e2e test
run: | run: |
node --version node --version
@ -101,14 +96,18 @@ jobs:
e2e-no-cypress-record: e2e-no-cypress-record:
needs: build needs: build
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true
runs-on: ubuntu-16.04 runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Use Node.js 10.x - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 10.x node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1 - uses: actions/cache@v1
with: with:
path: ~/.cache/yarn path: ~/.cache/yarn
@ -117,11 +116,8 @@ jobs:
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-
- uses: actions/download-artifact@master - uses: actions/download-artifact@master
with: with:
name: dev-test-website-node-10.x name: dev-test-website-${{ runner.os }}-node-${{ matrix.node-version }}
path: dev-test path: dev-test
- name: update yarn to latest version
run: |
sudo apt update && sudo apt install yarn
- name: npm install and e2e test - name: npm install and e2e test
run: | run: |
node --version node --version

View File

@ -28,7 +28,7 @@ jobs:
node-version: [12.x] node-version: [12.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:

View File

@ -7,12 +7,14 @@ For details on contributing to documentation, see [Website Directory Readme](htt
## Setup ## Setup
> Install Node.js (LTS) on your system: [https://nodejs.org/](https://nodejs.org/)
> Install yarn on your system: [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) > Install yarn on your system: [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
### Install dependencies ### Install dependencies
> Only required on the first run, subsequent runs can use `yarn start` to both > Only required on the first run, subsequent runs can use `yarn start` to both
bootstrap and run the development server. > bootstrap and run the development server.
```sh ```sh
$ git clone https://github.com/netlify/netlify-cms $ git clone https://github.com/netlify/netlify-cms
@ -44,6 +46,7 @@ Watches all CMS packages and transpiles them on change.
```sh ```sh
yarn watch yarn watch
``` ```
### start ### start
Starts the development server. This task runs both the `bootstrap` and `watch` scripts. Starts the development server. This task runs both the `bootstrap` and `watch` scripts.
@ -134,12 +137,12 @@ Netlify CMS uses the [Forking Workflow](https://www.atlassian.com/git/tutorials/
1. Fork the repo. 1. Fork the repo.
2. Create a branch from `master`. If you're addressing a specific issue, prefix your branch name with the issue number. 2. Create a branch from `master`. If you're addressing a specific issue, prefix your branch name with the issue number.
2. If you've added code that should be tested, add tests. 3. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation. 4. If you've changed APIs, update the documentation.
4. Run `yarn test` and ensure the test suite passes. 5. Run `yarn test` and ensure the test suite passes.
5. Use `yarn format` to format and lint your code. 6. Use `yarn format` to format and lint your code.
6. PR's must be rebased before merge (feel free to ask for help). 7. PR's must be rebased before merge (feel free to ask for help).
7. PR should be reviewed by two maintainers prior to merging. 8. PR should be reviewed by two maintainers prior to merging.
## License ## License

View File

@ -7,7 +7,7 @@ const pkg = require(path.join(process.cwd(), 'package.json'));
const isProduction = process.env.NODE_ENV === 'production'; const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test'; const isTest = process.env.NODE_ENV === 'test';
const moduleNameToPath = libName => `${path.resolve(__dirname, `../node_modules/${libName}`)}/`; const moduleNameToPath = libName => path.resolve(__dirname, '..', 'node_modules', libName);
const rules = () => ({ const rules = () => ({
js: () => ({ js: () => ({