From 6ac7303e1628df75b19dc698669643e15092bd82 Mon Sep 17 00:00:00 2001 From: Atul R Date: Fri, 22 Nov 2019 23:43:54 +0100 Subject: [PATCH] Adds automatic test and linting on pull requests for nodegui (#215) * adds test action * make c++11 mandatory * fix * fix * fix broken tests in windows * upgrade qode to 1.0.6 * Fixes recursive hell for layouts * adds cross env for windows * change to pull request --- .github/workflows/test.yml | 25 +++++++++++++++++++ package-lock.json | 18 ++++++------- package.json | 6 ++--- .../QtWidgets/QGridLayout/ngridlayout.hpp | 2 +- .../nodegui/core/FlexLayout/flexlayout.h | 2 +- 5 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..84bed28c1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@master + - uses: actions/setup-node@master + with: + node-version: '13.x' + - name: Install deps + run: npm install + - name: Build nodegui + run: npm run build + - name: Run tests + run: npm run test + - name: Run linters for cpp + run: npm run lint:cpp + - name: Run linters for ts + run: npm run lint:ts diff --git a/package-lock.json b/package-lock.json index 08aee925a..a14313367 100644 --- a/package-lock.json +++ b/package-lock.json @@ -452,9 +452,9 @@ } }, "@nodegui/qode": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-1.0.5.tgz", - "integrity": "sha512-JKb4JcC03VCdodmiL35VfznsCKHpiKOYbtgf9+KTHhH5p7IXvr+0k/LIq112T6Rpxd5zXa1pbsnfa2F8ReyWEg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-1.0.6.tgz", + "integrity": "sha512-Np6r91wDCzV4+PCepr83t+BjWBtZMh5WT9/68mXXSMJi+ueZbYXL0d5VAIJ84C87NMwnA/7hdoqppp8lgzymvg==", "requires": { "env-paths": "^2.2.0", "extract-zip": "^1.6.7", @@ -1731,9 +1731,9 @@ "dev": true }, "defer-to-connect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.0.2.tgz", - "integrity": "sha512-k09hcQcTDY+cwgiwa6PYKLm3jlagNzQ+RSvhjzESOGOx+MNOuXkxTfEvPrO1IOQ81tArCFYQgi631clB70RpQw==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.0.tgz", + "integrity": "sha512-WE2sZoctWm/v4smfCAdjYbrfS55JiMRdlY9ZubFhsYbteCK9+BvAx4YV7nPjYM6ZnX5BcoVKwfmyx9sIFTgQMQ==" }, "define-properties": { "version": "1.1.3", @@ -5103,9 +5103,9 @@ } }, "normalize-url": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.3.0.tgz", - "integrity": "sha512-0NLtR71o4k6GLP+mr6Ty34c5GA6CMoEsncKJxvQd8NzPxaHRJNnb5gZE8R1XF4CPIS7QPHLJ74IFszwtNVAHVQ==" + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" }, "npm-run-path": { "version": "2.0.2", diff --git a/package.json b/package.json index 61fbb0cf7..14228e2aa 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,12 @@ "postinstall": "npm run build:addon", "build": "tsc && npm run build:addon", "build:addon": "cross-env CMAKE_BUILD_PARALLEL_LEVEL=8 cmake-js compile", - "test": "qode ./node_modules/.bin/jest -i", + "test": "qode ./node_modules/jest/bin/jest -i", "lint:cpp": "clang-format -i --glob=src/cpp/**/*.[h,c]*", - "lint:ts": "tsc --noEmit && eslint './src/**/*.{ts,tsx,js,jsx}' --fix" + "lint:ts": "tsc --noEmit && cross-env eslint './src/**/*.{ts,tsx,js,jsx}' --fix" }, "dependencies": { - "@nodegui/qode": "^1.0.5", + "@nodegui/qode": "^1.0.6", "cmake-js": "^6.0.0", "cross-env": "^6.0.0", "cuid": "^2.1.6", diff --git a/src/cpp/include/nodegui/QtWidgets/QGridLayout/ngridlayout.hpp b/src/cpp/include/nodegui/QtWidgets/QGridLayout/ngridlayout.hpp index 126dd968f..5e54029f3 100644 --- a/src/cpp/include/nodegui/QtWidgets/QGridLayout/ngridlayout.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QGridLayout/ngridlayout.hpp @@ -6,6 +6,6 @@ class NGridLayout : public QGridLayout, public EventWidget { public: Q_OBJECT - EVENTWIDGET_IMPLEMENTATIONS(NGridLayout) + EVENTWIDGET_IMPLEMENTATIONS(QGridLayout) using QGridLayout::QGridLayout; }; diff --git a/src/cpp/include/nodegui/core/FlexLayout/flexlayout.h b/src/cpp/include/nodegui/core/FlexLayout/flexlayout.h index 45714cbbf..28c50ccd1 100644 --- a/src/cpp/include/nodegui/core/FlexLayout/flexlayout.h +++ b/src/cpp/include/nodegui/core/FlexLayout/flexlayout.h @@ -41,5 +41,5 @@ class FlexLayout : public QLayout, public EventWidget { Qt::Orientations expandingDirections() const override; bool hasHeightForWidth() const override; - EVENTWIDGET_IMPLEMENTATIONS(FlexLayout) + EVENTWIDGET_IMPLEMENTATIONS(QLayout) };