From 636bb14e52d68f54b18a972998a57fe0e66bd980 Mon Sep 17 00:00:00 2001 From: Martyn Janes Date: Fri, 1 Dec 2023 13:53:57 +0200 Subject: [PATCH] Consistent GitHub Actions --- .../workflows/automation-testing-full.yaml | 31 ++++++++++++++--- .github/workflows/automation-testing.yaml | 23 ++++++++++--- .github/workflows/e2e.yml | 34 +++++++++++++++++++ .github/workflows/publish-HOWTOs.yml | 16 ++++----- .github/workflows/publish-NPM.yaml | 30 ++++++++++++---- .github/workflows/test.yml | 2 +- .../e2e/tests/platform.spec.ts | 8 +++-- 7 files changed, 116 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/automation-testing-full.yaml b/.github/workflows/automation-testing-full.yaml index 7a89c330e8..f07f6c0841 100644 --- a/.github/workflows/automation-testing-full.yaml +++ b/.github/workflows/automation-testing-full.yaml @@ -12,47 +12,68 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Setup Node 16 + + - name: Setup Node 18 uses: actions/setup-node@v3 with: - node-version: 16 - - name: Install Packages - run: | - npm install + node-version: 18 + registry-url: https://registry.npmjs.org + scope: '@openfin' + + - name: Restore root node_modules from cache + id: node-cache + uses: actions/cache@v3 + with: + path: node_modules + key: node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm ci + - name: Run JavaScript Tests with Mocha run: | npx fkill-cli OpenFin OpenFinRVM --force --silent npm run test-remote-mocha --prefix how-to/automation-testing/register-with-home-js + - name: Run WDIO tests run: | npm run kill --prefix how-to/automation-testing/wdio npm run dos --prefix how-to/automation-testing/wdio npm run test --prefix how-to/automation-testing/wdio + - name: Run Selenium tests run: | npm run kill --prefix how-to/automation-testing/selenium npm run dos --prefix how-to/automation-testing/selenium npm run test --prefix how-to/automation-testing/selenium + - name: Run JavaScript Tests with Jasmine run: | npx fkill-cli OpenFin OpenFinRVM --force --silent npm run test-remote-jasmine --prefix how-to/automation-testing/register-with-home-js + - name: Run JavaScript Tests with Jest run: | npx fkill-cli OpenFin OpenFinRVM --force --silent npm run test-remote-jest --prefix how-to/automation-testing/register-with-home-js + - name: Run TypeScript Tests with Mocha run: | npx fkill-cli OpenFin OpenFinRVM --force --silent npm run test-remote-mocha --prefix how-to/automation-testing/register-with-home-ts + - name: Run TypeScript Tests with Jasmine run: | npx fkill-cli OpenFin OpenFinRVM --force --silent npm run test-remote-jasmine --prefix how-to/automation-testing/register-with-home-ts + - name: Run TypeScript Tests with Jest run: | npx fkill-cli OpenFin OpenFinRVM --force --silent npm run test-remote-jest --prefix how-to/automation-testing/register-with-home-ts + - name: Run JavaScript Tests with Mocha for Store run: | npx fkill-cli OpenFin OpenFinRVM --force --silent diff --git a/.github/workflows/automation-testing.yaml b/.github/workflows/automation-testing.yaml index 7667bce898..5991066e50 100644 --- a/.github/workflows/automation-testing.yaml +++ b/.github/workflows/automation-testing.yaml @@ -12,13 +12,26 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Setup Node 16 + + - name: Setup Node 18 uses: actions/setup-node@v3 with: - node-version: 16 - - name: Install Packages - run: | - npm install + node-version: 18 + registry-url: https://registry.npmjs.org + scope: '@openfin' + + - name: Restore root node_modules from cache + id: node-cache + uses: actions/cache@v3 + with: + path: node_modules + key: node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm ci + - name: Run JavaScript Tests with Mocha run: | npx fkill-cli OpenFin OpenFinRVM --force --silent diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000000..3b5bfc2c00 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,34 @@ +name: Workspace Platform Starter - E2E Tests + +on: workflow_dispatch + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Setup Node 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: https://registry.npmjs.org + scope: '@openfin' + + - name: Restore root node_modules from cache + id: node-cache + uses: actions/cache@v3 + with: + path: node_modules + key: node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm ci + + - name: Run Workspace Platform Starter E2E Tests + working-directory: ./how-to/workspace-platform-starter + run: npm run e2e diff --git a/.github/workflows/publish-HOWTOs.yml b/.github/workflows/publish-HOWTOs.yml index 4b0c703970..2c1214ab4f 100644 --- a/.github/workflows/publish-HOWTOs.yml +++ b/.github/workflows/publish-HOWTOs.yml @@ -17,24 +17,24 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Setup Node.js + - name: Setup Node 18 uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 registry-url: https://registry.npmjs.org scope: '@openfin' - - name: Install dependencies - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm ci - - name: Restore root node_modules from cache id: node-cache uses: actions/cache@v3 with: path: node_modules - key: node-modules-${{ hashFiles('package-lock.json') }} + key: node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm ci - name: Build packages run: npm run build diff --git a/.github/workflows/publish-NPM.yaml b/.github/workflows/publish-NPM.yaml index 23e5b66e8f..a58503824e 100644 --- a/.github/workflows/publish-NPM.yaml +++ b/.github/workflows/publish-NPM.yaml @@ -4,16 +4,34 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v3 + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node 18 + uses: actions/setup-node@v3 with: - node-version: '19' - registry-url: 'https://registry.npmjs.org' - - run: npm run setup + node-version: 18 + registry-url: https://registry.npmjs.org + scope: '@openfin' + + - name: Restore root node_modules from cache + id: node-cache + uses: actions/cache@v3 + with: + path: node_modules + key: node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm ci + + - run: npm run build working-directory: ./how-to/workspace-platform-starter + - run: NAME=@openfin/default-workspace-platform npm run prepare-package working-directory: ./how-to/workspace-platform-starter + - run: npm publish --access restricted working-directory: ./how-to/workspace-platform-starter/packaged env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2846266617..7ab40721a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Check Tests run +name: Workspace Platform Starter - Unit Tests on: pull_request: diff --git a/how-to/workspace-platform-starter/e2e/tests/platform.spec.ts b/how-to/workspace-platform-starter/e2e/tests/platform.spec.ts index 4cf2033fc0..f23a6244f5 100644 --- a/how-to/workspace-platform-starter/e2e/tests/platform.spec.ts +++ b/how-to/workspace-platform-starter/e2e/tests/platform.spec.ts @@ -6,9 +6,11 @@ describe("Platform", () => { expect(isReady).toEqual(true); }); - it("The title should be set", async () => { - const title = await WebDriver.getTitle(); - expect(title).toEqual("Platform Provider"); + it("The platform title should be set", async () => { + const windows = await WebDriver.getWindows(); + expect(windows.length).toBeGreaterThan(0); + const titles = windows.map((w) => w.title); + expect(titles).toContain("Platform Provider"); }); it("The runtime version should be set", async () => {