From 2352a9f545d92764fbc6a6f3f7aafb03d59efaa5 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 17 May 2020 10:39:16 -0600 Subject: [PATCH 1/2] Run rendering and spec tests in parallel --- .github/workflows/test.yml | 100 +++++++++++++++++++++++++++++++++++-- package.json | 3 +- 2 files changed, 97 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11027d873d..6456af4524 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,8 +12,8 @@ env: CI: true jobs: - run: - name: Node ${{ matrix.node }} / ${{ matrix.os }} + pretest: + name: Pre-Test (Node ${{ matrix.node }} / ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: @@ -33,14 +33,104 @@ jobs: with: node-version: ${{ matrix.node }} - - run: node --version - - run: npm --version + - name: Determine Cache Directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + + - name: Configure Job Cache + uses: actions/cache@v1 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install Dependencies run: npm ci - name: Run Tests - run: npm test + run: npm run pretest + + spec: + name: Spec (Node ${{ matrix.node }} / ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + node: + - 14 + + steps: + - name: Clone Repository + uses: actions/checkout@v2 + + - name: Set Node.js Version + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Determine Cache Directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + + - name: Configure Job Cache + uses: actions/cache@v1 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install Dependencies + run: npm ci + + - name: Run Tests + run: npm run test-spec + + rendering: + name: Rendering (Node ${{ matrix.node }} / ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + node: + - 14 + + steps: + - name: Clone Repository + uses: actions/checkout@v2 + + - name: Set Node.js Version + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Determine Cache Directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + + - name: Configure Job Cache + uses: actions/cache@v1 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install Dependencies + run: npm ci + + - name: Run Tests + run: npm run test-rendering - name: Store Rendering Test Artifacts if: ${{ always() }} diff --git a/package.json b/package.json index d4eea6383e..ad097399b0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "lint": "eslint tasks test rendering src/ol examples config", "pretest": "npm run lint && npm run typecheck", "test-rendering": "node rendering/test.js", - "test": "npm run karma -- --single-run --log-level error && npm run test-rendering -- --force", + "test-spec": "npm run karma -- --single-run --log-level error", + "test": "npm run test-spec && npm run test-rendering -- --force", "karma": "karma start test/karma.config.js", "start": "npm run serve-examples", "serve-examples": "webpack-dev-server --config examples/webpack/config.js --mode development --watch", From cb1c25374bef9e9920b247ed23606990e43d1a70 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 17 May 2020 11:17:08 -0600 Subject: [PATCH 2/2] Only store actual.png from rendering tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6456af4524..ed1c8a8591 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -137,4 +137,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: rendering-tests - path: rendering/cases/ + path: rendering/cases/**/actual.png