From 4464e714015db7177055b160e43382630ca2f2cf Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Wed, 19 Jun 2024 12:40:52 -0400 Subject: [PATCH] Parallelize conformance test runs in CI (#1110) --- .github/workflows/ci.yaml | 6 +- .github/workflows/node-conformance.yaml | 77 +++++++++++++++++++++++++ .github/workflows/web-conformance.yaml | 59 +++++++++++++++++++ Makefile | 36 ++++++++---- 4 files changed, 164 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/node-conformance.yaml create mode 100644 .github/workflows/web-conformance.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0a8d1533..0917c0e8e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,8 +20,8 @@ jobs: path: | ~/.tmp .tmp - key: ${{ runner.os }}-connect-web-ci-${{ hashFiles('Makefile') }} + key: ${{ runner.os }}-connect-es-ci-${{ hashFiles('Makefile') }} restore-keys: | - ${{ runner.os }}-connect-web-ci- + ${{ runner.os }}-connect-es-ci- - name: make - run: make && make checkdiff + run: make ci && make checkdiff diff --git a/.github/workflows/node-conformance.yaml b/.github/workflows/node-conformance.yaml new file mode 100644 index 000000000..44eefbacb --- /dev/null +++ b/.github/workflows/node-conformance.yaml @@ -0,0 +1,77 @@ +name: Node Conformance +on: + push: + branches: [main] + tags: ['v*'] + pull_request: + branches: [main] + workflow_dispatch: +permissions: + contents: read +jobs: + node: + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [18, 20, 21] + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: checkout + uses: actions/checkout@v4 + - name: cache + uses: actions/cache@v4 + with: + path: | + ~/.tmp + .tmp + key: ${{ runner.os }}-connect-node-conformance-${{ hashFiles('Makefile') }} + restore-keys: | + ${{ runner.os }}-connect-node-conformance- + - name: testconnectnodeconformance + run: make testconnectnodeconformance + fastify: + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [18, 20, 21] + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: checkout + uses: actions/checkout@v4 + - name: cache + uses: actions/cache@v4 + with: + path: | + ~/.tmp + .tmp + key: ${{ runner.os }}-connect-fastify-conformance-${{ hashFiles('Makefile') }} + restore-keys: | + ${{ runner.os }}-connect-fastify-conformance- + - name: testconnectfastifyconformance + run: make testconnectfastifyconformance + express: + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [18, 20, 21] + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: checkout + uses: actions/checkout@v4 + - name: cache + uses: actions/cache@v4 + with: + path: | + ~/.tmp + .tmp + key: ${{ runner.os }}-connect-express-conformance-${{ hashFiles('Makefile') }} + restore-keys: | + ${{ runner.os }}-connect-express-conformance- + - name: testconnectexpressconformance + run: make testconnectexpressconformance diff --git a/.github/workflows/web-conformance.yaml b/.github/workflows/web-conformance.yaml new file mode 100644 index 000000000..c4a119b5e --- /dev/null +++ b/.github/workflows/web-conformance.yaml @@ -0,0 +1,59 @@ +name: Web Conformance +on: + push: + branches: [main] + tags: ['v*'] + pull_request: + branches: [main] + workflow_dispatch: +permissions: + contents: read +jobs: + chrome: + runs-on: ubuntu-22.04 + steps: + - name: checkout + uses: actions/checkout@v4 + - name: cache + uses: actions/cache@v4 + with: + path: | + ~/.tmp + .tmp + key: ${{ runner.os }}-connect-web-chrome-conformance-${{ hashFiles('Makefile') }} + restore-keys: | + ${{ runner.os }}-connect-web-chrome-conformance- + - name: testwebchromeconformance + run: make testwebchromeconformance + firefox: + runs-on: ubuntu-22.04 + steps: + - name: checkout + uses: actions/checkout@v4 + - name: cache + uses: actions/cache@v4 + with: + path: | + ~/.tmp + .tmp + key: ${{ runner.os }}-connect-web-firefox-conformance-${{ hashFiles('Makefile') }} + restore-keys: | + ${{ runner.os }}-connect-web-firefox-conformance- + - name: testwebfirefoxconformance + run: make testwebfirefoxconformance + safari: + runs-on: macos-12 + steps: + - name: checkout + uses: actions/checkout@v4 + - name: cache + uses: actions/cache@v4 + with: + path: | + ~/.tmp + .tmp + key: ${{ runner.os }}-connect-web-safari-conformance-${{ hashFiles('Makefile') }} + restore-keys: | + ${{ runner.os }}-connect-web-safari-conformance- + - name: testwebsafariconformance + run: make testwebsafariconformance diff --git a/Makefile b/Makefile index 6a0b9b740..104b151d7 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ $(BUILD)/connect-web: $(GEN)/connect-web $(BUILD)/connect $(BUILD)/connect-confo @mkdir -p $(@D) @touch $(@) -$(BUILD)/connect-conformance: $(BUILD)/connect $(GEN)/connect-conformance packages/connect-conformance/tsconfig.json $(shell find packages/connect-conformance/src -name '*.ts') +$(BUILD)/connect-conformance: $(GEN)/connect-conformance $(BUILD)/connect packages/connect-conformance/tsconfig.json $(shell find packages/connect-conformance/src -name '*.ts') npm run -w packages/connect-conformance clean npm run -w packages/connect-conformance build @mkdir -p $(@D) @@ -154,7 +154,10 @@ help: ## Describe useful make targets @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}' .PHONY: all -all: build test format lint bench ## build, test, format, lint, and bench (default) +all: build test testconformance format lint bench ## build, test, testconformance, format, lint, and bench (default) + +.PHONY: ci +ci: build test format lint bench ## build, test, format, lint, and bench (default) .PHONY: clean clean: ## Delete build artifacts and installed dependencies @@ -165,7 +168,7 @@ clean: ## Delete build artifacts and installed dependencies build: $(BUILD)/connect $(BUILD)/connect-web $(BUILD)/connect-node $(BUILD)/connect-fastify $(BUILD)/connect-express $(BUILD)/connect-next $(BUILD)/protoc-gen-connect-es $(BUILD)/example $(BUILD)/connect-migrate ## Build .PHONY: test -test: testconnectpackage testconnectnodepackage testconnectwebpackage testconnectexpresspackage testconformance testconnectmigrate ## Run all tests, except browserstack +test: testconnectpackage testconnectnodepackage testconnectwebpackage testconnectexpresspackage testconnectmigrate ## Run all tests, except browserstack .PHONY: testconnectpackage testconnectpackage: $(BUILD)/connect @@ -189,26 +192,37 @@ testconnectexpresspackage: $(BUILD)/connect-express npm run -w packages/connect-express jasmine .PHONY: testconformance -testconformance: testnodeconformance testwebconformance +testconformance: testconnectnodeconformance testconnectfastifyconformance testconnectexpressconformance testwebconformance -.PHONY: testnodeconformance -testnodeconformance: $(BUILD)/connect-conformance $(BUILD)/connect-node $(BUILD)/connect-fastify $(BUILD)/connect-express +.PHONY: testconnectnodeconformance +testconnectnodeconformance: $(BUILD)/connect-node # Vanilla Node Server and Client npm run -w packages/connect-node conformance + +.PHONY: testconnectexpressconformance +testconnectexpressconformance: $(BUILD)/connect-express # Express Server npm run -w packages/connect-express conformance + +.PHONY: testconnectfastifyconformance +testconnectfastifyconformance: $(BUILD)/connect-fastify # Fastify Server npm run -w packages/connect-fastify conformance .PHONY: testwebconformance -testwebconformance: $(BUILD)/connect-conformance +testwebconformance: testwebchromeconformance testwebfirefoxconformance testwebsafariconformance + +.PHONY: testwebchromeconformance +testwebchromeconformance: $(BUILD)/connect-web npm run -w packages/connect-web conformance:client:chrome + +.PHONY: testwebfirefoxconformance +testwebfirefoxconformance: $(BUILD)/connect-web npm run -w packages/connect-web conformance:client:firefox - npm run -w packages/connect-web conformance:client:node - @# Requires one to enable the 'Allow Remote Automation' option in Safari's Develop menu. -ifeq ($(NODE_OS),darwin) + +.PHONY: testwebsafariconformance +testwebsafariconformance: $(BUILD)/connect-web npm run -w packages/connect-web conformance:client:safari -endif .PHONY: testwebconformancelocal testwebconformancelocal: $(BUILD)/connect-conformance