Skip to content

Commit

Permalink
speed up CI by parallelizing more things
Browse files Browse the repository at this point in the history
  • Loading branch information
djahandarie committed Dec 28, 2024
1 parent a0302f0 commit e7fd994
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 73 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/bench.yml

This file was deleted.

174 changes: 134 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
merge_group:

jobs:
static-analysis:
name: Static Analysis
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -28,47 +28,138 @@ jobs:
- name: Build third-party libraries
run: npm run build:libs

- name: Run static analysis tests
run: npm run test:static-analysis
- name: Upload workspace
uses: actions/upload-artifact@v4
with:
name: workspace
path: .

static-analysis-json:
name: Static Analysis (JSON)
js:
needs: setup
name: JavaScript
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Setup node
uses: actions/setup-node@v4
- name: Test JavaScript
run: npm run test:js

ts-main:
needs: setup
name: TypeScript (main)
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
node-version-file: "package.json"
name: workspace

- name: Install dependencies
run: npm ci
- name: Test TypeScript (main)
run: npm run test:ts:main

- name: Build third-party libraries
run: npm run build:libs
ts-dev:
needs: setup
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Run static analysis tests
run: npm run test:json
- name: Test TypeScript (dev)
run: npm run test:ts:dev

unit-tests:
name: Unit Tests
ts-test:
needs: setup
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Setup node
uses: actions/setup-node@v4
- name: Test TypeScript (test)
run: npm run test:ts:test

ts-bench:
needs: setup
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
node-version-file: "package.json"
name: workspace

- name: Install dependencies
run: npm ci
- name: Test TypeScript (bench)
run: npm run test:ts:bench

- name: Build third-party libraries
run: npm run build:libs
css:
needs: setup
name: CSS
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Test CSS
run: npm run test:css

html:
needs: setup
name: HTML
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Test HTML
run: npm run test:html

markdown:
needs: setup
name: Markdown
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Test Markdown
run: npm run test:md

json:
needs: setup
name: JSON
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Test JSON
run: npm run test:json

unit-tests:
needs: setup
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace

- name: Run unit tests
run: npm run test:unit
Expand All @@ -77,22 +168,14 @@ jobs:
run: npm run test:unit:options

test-build:
needs: setup
name: Test Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
- name: Download workspace
uses: actions/download-artifact@v4
with:
node-version-file: "package.json"

- name: Install dependencies
run: npm ci

- name: Build Libs
run: npm run build:libs
name: workspace

- name: Build Legal
run: npm run license-report:html
Expand All @@ -106,3 +189,14 @@ jobs:
file: ext/manifest.json
schema: "https://json.schemastore.org/chrome-manifest.json"
fixSchemas: true

bench:
needs: setup
name: Benchmarks
runs-on: ubuntu-latest
steps:
- name: Run Benchmarks
uses: CodSpeedHQ/action@513a19673a831f139e8717bf45ead67e47f00044 # v3.2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: npm run bench
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@
"build:libs": "node ./dev/bin/build-libs.js",
"build:serve:firefox-android": "node ./dev/bin/build.js --target firefox-android && web-ext run -s ./builds/yomitan-firefox-android",
"build:serve:kiwi-browser": "node ./dev/bin/build.js --target chrome-dev && adb shell mkdir -p /sdcard/yomitan && adb push ./builds/yomitan-chrome-dev.zip /sdcard/yomitan/yomitan-kiwi-browser.zip",


"//WARNING": "These are convenience functions for running from CLI but are NOT called from CI because they are not parallel. Make sure you update CI scripts if you update these.",
"test": "npm run test:js && npm run test:ts && npm run test:css && npm run test:html && npm run test:unit && npm run test:unit:options && npm run test:json && npm run test:md && npm run test:build",
"test:fast": "npm run test:js && npm run test:ts && npm run test:unit && npm run test:json:format",
"test:static-analysis": "npm run test:js && npm run test:ts && npm run test:css && npm run test:html && npm run test:md",
"test:ts": "npm run test:ts:main && npm run test:ts:dev && npm run test:ts:test && npm run test:ts:bench",
"//END-WARNING": "",


"test:js": "npx eslint . --ignore-pattern '**/*.json'",
"test:json": "npm run test:json:format && npm run test:json:types",
"test:json:format": "npx eslint '**/*.json'",
Expand All @@ -27,7 +34,6 @@
"test:html": "npx html-validate \"ext/**/*.html\" \"test/**/*.html\" \"dev/**/*.html\"",
"test:md": "prettier . --check",
"test:md:write": "prettier . --write",
"test:ts": "npm run test:ts:main && npm run test:ts:dev && npm run test:ts:test && npm run test:ts:bench",
"test:ts:main": "npx tsc --noEmit --project jsconfig.json",
"test:ts:dev": "npx tsc --noEmit --project dev/jsconfig.json",
"test:ts:test": "npx tsc --noEmit --project test/jsconfig.json",
Expand Down

0 comments on commit e7fd994

Please sign in to comment.