Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[support/4.x] Backport: Run GitHub Actions tests on Windows #3993

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 39 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ on:

workflow_dispatch:
inputs:
runner:
description: Run tests on
type: choice
default: ubuntu-latest
options:
- macos-latest
- ubuntu-latest
- windows-latest
types:
description: Check type declarations
type: boolean
Expand All @@ -30,11 +22,19 @@ concurrency:
jobs:
install:
name: Install
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
runs-on: ${{ matrix.runner }}

env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

strategy:
fail-fast: false

matrix:
runner:
- ubuntu-latest
- windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -44,9 +44,17 @@ jobs:

build:
name: Build
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
runs-on: ${{ matrix.runner }}
needs: [install]

strategy:
fail-fast: false

matrix:
runner:
- ubuntu-latest
- windows-latest

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -62,14 +70,18 @@ jobs:
run: npm run build:types

lint:
name: ${{ matrix.task.description }}
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
name: ${{ matrix.task.description }} (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
needs: [install]

strategy:
fail-fast: false

matrix:
runner:
- ubuntu-latest
- windows-latest

task:
- description: Lint Sass
name: lint-scss
Expand Down Expand Up @@ -109,19 +121,23 @@ jobs:
run: ${{ matrix.task.run }}

test:
name: ${{ matrix.task.description }}
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
name: ${{ matrix.task.description }} (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
needs: [install, build]

env:
# Use 2x CPU cores unless on Windows (runs slower when concurrent)
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
MAX_WORKERS: ${{ inputs.runner == 'windows-latest' && '1' || '2' }}
MAX_WORKERS: ${{ matrix.runner == 'windows-latest' && '1' || '2' }}

strategy:
fail-fast: false

matrix:
runner:
- ubuntu-latest
- windows-latest

task:
- description: Nunjucks macro tests
name: test-macro
Expand Down Expand Up @@ -181,13 +197,13 @@ jobs:
- name: Save test coverage
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.task.description }} coverage
name: ${{ matrix.task.description }} coverage (${{ matrix.runner }})
path: coverage
if-no-files-found: ignore

verify:
name: ${{ matrix.task.description }}
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
name: ${{ matrix.task.description }} (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
needs: [install, build]

# Skip when scheduled or run manually
Expand All @@ -197,6 +213,10 @@ jobs:
fail-fast: false

matrix:
runner:
- ubuntu-latest
- windows-latest

task:
- description: Verify package build
name: test-build-package
Expand All @@ -221,12 +241,9 @@ jobs:

package:
name: Export ${{ matrix.conditions }}, Node.js ${{ matrix.node-version }}
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
runs-on: ubuntu-latest
needs: [install, build]

# Skip when scheduled or run manually
if: ${{ !inputs.runner }}

strategy:
fail-fast: false

Expand Down