Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)

Speed up CI by parallelizing more things (#1716)

* speed up CI by parallelizing more things

* add node_modules caching for when package-lock hasn't changed

* Wasn't quite able to do it with artifacts so instead build a composite action

* simplify with matrix

* use the new shared setup action where appropriate

authored by

Darius Jahandarie and committed by
GitHub
f342886c fd577b82

+80 -114
+25
.github/actions/setup/action.yml
··· 1 + name: Setup 2 + description: Setup the workspace for the CI 3 + runs: 4 + using: "composite" 5 + steps: 6 + - name: Setup node 7 + uses: actions/setup-node@v4 8 + with: 9 + node-version-file: "package.json" 10 + 11 + - name: Restore dependencies 12 + id: restore-dependencies 13 + uses: actions/cache@v4 14 + with: 15 + path: node_modules 16 + key: js-depend-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} 17 + 18 + - name: Install dependencies 19 + if: steps.restore-dependencies.outputs.cache-hit != 'true' 20 + shell: bash 21 + run: npm ci 22 + 23 + - name: Build third-party libraries 24 + shell: bash 25 + run: npm run build:libs
-32
.github/workflows/bench.yml
··· 1 - name: Performance Benchmarks 2 - permissions: 3 - contents: read 4 - on: 5 - push: 6 - branches: [master] 7 - pull_request: 8 - workflow_dispatch: 9 - jobs: 10 - benchmark: 11 - runs-on: ubuntu-latest 12 - 13 - steps: 14 - - name: Checkout 15 - uses: actions/checkout@v4 16 - 17 - - name: Setup node 18 - uses: actions/setup-node@v4 19 - with: 20 - node-version-file: "package.json" 21 - 22 - - name: Install dependencies 23 - run: npm ci 24 - 25 - - name: Build Libs 26 - run: npm run build:libs 27 - 28 - - name: Run Benchmarks 29 - uses: CodSpeedHQ/action@v3 30 - with: 31 - token: ${{ secrets.CODSPEED_TOKEN }} 32 - run: npm run bench
+46 -74
.github/workflows/ci.yml
··· 10 10 merge_group: 11 11 12 12 jobs: 13 - static-analysis: 14 - name: Static Analysis 15 - runs-on: ubuntu-latest 16 - steps: 17 - - name: Checkout 18 - uses: actions/checkout@v4 19 - 20 - - name: Setup node 21 - uses: actions/setup-node@v4 22 - with: 23 - node-version-file: "package.json" 24 - 25 - - name: Install dependencies 26 - run: npm ci 27 - 28 - - name: Build third-party libraries 29 - run: npm run build:libs 30 - 31 - - name: Run static analysis tests 32 - run: npm run test:static-analysis 33 - 34 - static-analysis-json: 35 - name: Static Analysis (JSON) 13 + tests: 14 + name: ${{ matrix.name }} 36 15 runs-on: ubuntu-latest 37 - steps: 38 - - name: Checkout 39 - uses: actions/checkout@v4 40 - 41 - - name: Setup node 42 - uses: actions/setup-node@v4 43 - with: 44 - node-version-file: "package.json" 45 - 46 - - name: Install dependencies 47 - run: npm ci 48 - 49 - - name: Build third-party libraries 50 - run: npm run build:libs 51 - 52 - - name: Run static analysis tests 53 - run: npm run test:json 16 + strategy: 17 + matrix: 18 + include: 19 + - name: JavaScript 20 + test: test:js 21 + - name: TypeScript (main) 22 + test: test:ts:main 23 + - name: TypeScript (dev) 24 + test: test:ts:dev 25 + - name: TypeScript (test) 26 + test: test:ts:test 27 + - name: TypeScript (bench) 28 + test: test:ts:bench 29 + - name: CSS 30 + test: test:css 31 + - name: HTML 32 + test: test:html 33 + - name: Markdown 34 + test: test:md 35 + - name: JSON 36 + test: test:json 37 + - name: Unit Tests 38 + test: test:unit 39 + - name: Unit Tests (options) 40 + test: test:unit:options 54 41 55 - unit-tests: 56 - name: Unit Tests 57 - runs-on: ubuntu-latest 58 42 steps: 59 - - name: Checkout 60 - uses: actions/checkout@v4 61 - 62 - - name: Setup node 63 - uses: actions/setup-node@v4 64 - with: 65 - node-version-file: "package.json" 66 - 67 - - name: Install dependencies 68 - run: npm ci 43 + - uses: actions/checkout@v4 44 + - uses: ./.github/actions/setup 69 45 70 - - name: Build third-party libraries 71 - run: npm run build:libs 72 - 73 - - name: Run unit tests 74 - run: npm run test:unit 75 - 76 - - name: Run unit tests (options) 77 - run: npm run test:unit:options 46 + - name: Run ${{ matrix.name }} tests 47 + run: npm run ${{ matrix.test }} 78 48 79 49 test-build: 80 50 name: Test Build 81 51 runs-on: ubuntu-latest 82 52 steps: 83 - - name: Checkout 84 - uses: actions/checkout@v4 85 - 86 - - name: Setup node 87 - uses: actions/setup-node@v4 88 - with: 89 - node-version-file: "package.json" 90 - 91 - - name: Install dependencies 92 - run: npm ci 93 - 94 - - name: Build Libs 95 - run: npm run build:libs 53 + - uses: actions/checkout@v4 54 + - uses: ./.github/actions/setup 96 55 97 56 - name: Build Legal 98 57 run: npm run license-report:html ··· 106 65 file: ext/manifest.json 107 66 schema: "https://json.schemastore.org/chrome-manifest.json" 108 67 fixSchemas: true 68 + 69 + bench: 70 + name: Benchmarks 71 + runs-on: ubuntu-latest 72 + steps: 73 + - uses: actions/checkout@v4 74 + - uses: ./.github/actions/setup 75 + 76 + - name: Run Benchmarks 77 + uses: CodSpeedHQ/action@513a19673a831f139e8717bf45ead67e47f00044 # v3.2 78 + with: 79 + token: ${{ secrets.CODSPEED_TOKEN }} 80 + run: npm run bench
+1
.github/workflows/create-prerelease-on-tag.yml
··· 22 22 with: 23 23 node-version-file: "package.json" 24 24 25 + # intentially do not use cache to keep the build more comprehensible and sandboxed 25 26 - name: Install dependencies 26 27 run: npm ci 27 28
+1 -7
.github/workflows/playwright.yml
··· 26 26 packages: fonts-ipafont-mincho 27 27 execute_install_scripts: true 28 28 29 - - uses: actions/setup-node@v4 30 - with: 31 - cache: "npm" 32 - node-version-file: "package.json" 33 - 34 - - name: Install dependencies 35 - run: npm ci 29 + - uses: ./.github/actions/setup 36 30 37 31 - name: Build 38 32 run: npm run build
+7 -1
package.json
··· 16 16 "build:libs": "node ./dev/bin/build-libs.js", 17 17 "build:serve:firefox-android": "node ./dev/bin/build.js --target firefox-android && web-ext run -s ./builds/yomitan-firefox-android", 18 18 "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", 19 + 20 + 21 + "//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.", 19 22 "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", 20 23 "test:fast": "npm run test:js && npm run test:ts && npm run test:unit && npm run test:json:format", 21 24 "test:static-analysis": "npm run test:js && npm run test:ts && npm run test:css && npm run test:html && npm run test:md", 25 + "test:ts": "npm run test:ts:main && npm run test:ts:dev && npm run test:ts:test && npm run test:ts:bench", 26 + "//END-WARNING": "", 27 + 28 + 22 29 "test:js": "npx eslint . --ignore-pattern '**/*.json'", 23 30 "test:json": "npm run test:json:format && npm run test:json:types", 24 31 "test:json:format": "npx eslint '**/*.json'", ··· 27 34 "test:html": "npx html-validate \"ext/**/*.html\" \"test/**/*.html\" \"dev/**/*.html\"", 28 35 "test:md": "prettier . --check", 29 36 "test:md:write": "prettier . --write", 30 - "test:ts": "npm run test:ts:main && npm run test:ts:dev && npm run test:ts:test && npm run test:ts:bench", 31 37 "test:ts:main": "npx tsc --noEmit --project jsconfig.json", 32 38 "test:ts:dev": "npx tsc --noEmit --project dev/jsconfig.json", 33 39 "test:ts:test": "npx tsc --noEmit --project test/jsconfig.json",