From e9cdbcf378eff1390deab983a722a7f0e59ba787 Mon Sep 17 00:00:00 2001 From: Mark Root Date: Fri, 3 Nov 2023 10:22:04 -0500 Subject: [PATCH 1/5] Create Github Actions testing .yml connects #6 Tests will run for linux, windows and mac. Added "test-ci" script to run tests with a headless version of chrome. --- .github/workflows/node.js.yml | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 00000000..b80b9f84 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,57 @@ +name: CI Testing On PR into Develop Branch + +on: + pull_request: + branches: [ "develop" ] + +jobs: + ubuntu-build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm run build --if-present + - run: npm test-ci + + windows-build: + runs-on: windows-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm run build --if-present + - run: npm test-ci + + mac-build: + runs-on: mac-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm run build --if-present + - run: npm test-ci From 78f7424bc11d3ef44948ee858997a80afb013d9e Mon Sep 17 00:00:00 2001 From: rmroot Date: Fri, 3 Nov 2023 10:23:45 -0500 Subject: [PATCH 2/5] Add test-ci scripts and update README --- README.md | 4 +++- package.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 72555a2e..e13d9dc8 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,9 @@ This project was generated with [Angular CLI](https://github.com/angular/angular Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). -Karma unit tests use Google Chrome as a default browser. This will need to be installed on your machine for the tests to run. Otherwise you can check the documentation on how to target other browsers using a config file: [Karma Config](https://karma-runner.github.io/6.4/config/configuration-file.html) +Karma unit tests use Google Chrome as a default browser. This will need to be installed on your machine for the tests to run using `ng test` or `npm run test`. + +Otherwise, you can run the tests with a headless version of chrome using `ng test --browsers=ChromeHeadless` or `npm run test-ci` ## Further help diff --git a/package.json b/package.json index 4e6627c9..f6da3feb 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "build-watch": "ng build --base-href . --watch", "electron": "electron .", "dist": "electron-builder", - "test": "ng test" + "test": "ng test", + "test-ci": "ng test --no-watch --no-progress --browsers=ChromeHeadless" }, "private": true, "build": { From 8a5404f8b9a9a61a69c08ad69753c66dab2cfefc Mon Sep 17 00:00:00 2001 From: rmroot Date: Fri, 3 Nov 2023 10:25:22 -0500 Subject: [PATCH 3/5] fix testing script with npm install instruction --- .github/workflows/node.js.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index b80b9f84..7da0a223 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -19,6 +19,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: npm install - run: npm run build --if-present - run: npm test-ci @@ -36,6 +37,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: npm install - run: npm run build --if-present - run: npm test-ci @@ -53,5 +55,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: npm install - run: npm run build --if-present - run: npm test-ci From 54abd98a9d9ecf5afd0977bdb6d64c7c9bff3a5c Mon Sep 17 00:00:00 2001 From: rmroot Date: Fri, 3 Nov 2023 10:27:09 -0500 Subject: [PATCH 4/5] fix test ci command call in script --- .github/workflows/node.js.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7da0a223..3940470d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -21,7 +21,7 @@ jobs: cache: 'npm' - run: npm install - run: npm run build --if-present - - run: npm test-ci + - run: npm run test-ci windows-build: runs-on: windows-latest @@ -39,7 +39,7 @@ jobs: cache: 'npm' - run: npm install - run: npm run build --if-present - - run: npm test-ci + - run: npm run test-ci mac-build: runs-on: mac-latest @@ -57,4 +57,4 @@ jobs: cache: 'npm' - run: npm install - run: npm run build --if-present - - run: npm test-ci + - run: npm run test-ci From 3d82989eeb20175c4157981d6200733217b1c52a Mon Sep 17 00:00:00 2001 From: rmroot Date: Fri, 3 Nov 2023 14:49:46 -0500 Subject: [PATCH 5/5] remove mac/windows builds in CI. Only use linux --- .github/workflows/node.js.yml | 38 +---------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 3940470d..dd5807f6 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -21,40 +21,4 @@ jobs: cache: 'npm' - run: npm install - run: npm run build --if-present - - run: npm run test-ci - - windows-build: - runs-on: windows-latest - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm install - - run: npm run build --if-present - - run: npm run test-ci - - mac-build: - runs-on: mac-latest - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm install - - run: npm run build --if-present - - run: npm run test-ci + - run: npm run test-ci \ No newline at end of file