Skip to content

Commit bc510fa

Browse files
committed
Rework unit tests to be reusable workflow
1 parent 5f1f516 commit bc510fa

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/on-push.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Orchestrate Actions on Push
2+
3+
on: [push]
4+
5+
jobs:
6+
install-vendor:
7+
uses: ./.github/workflows/install-vendor.yml
8+
run-unit-tests:
9+
needs: install-vendor
10+
uses: ./.github/workflows/run-unit-tests.yml
11+
with:
12+
vendor-cache-keys: ${{ needs.install-vendor.outputs.cache-keys }}

.github/workflows/run-unit-tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: Unit Tests
22

3-
on: [push]
3+
on:
4+
workflow_call:
5+
inputs:
6+
vendor-cache-keys:
7+
type: string
8+
required: true
49

510
jobs:
6-
install-vendor:
7-
uses: ./.github/workflows/install-vendor.yml
8-
unit-tests:
9-
needs: install-vendor
11+
run-unit-tests:
1012
runs-on: ${{ matrix.os }}
1113
strategy:
1214
matrix:
@@ -18,7 +20,7 @@ jobs:
1820
uses: actions/cache@v4
1921
with:
2022
path: vendor
21-
key: ${{ fromJSON(needs.install-vendor.outputs.cache-keys)[runner.os] }}
23+
key: ${{ fromJSON(inputs.vendor-cache-keys)[runner.os] }}
2224
- name: Use Node.js
2325
uses: actions/setup-node@v4
2426
with:

0 commit comments

Comments
 (0)