-
-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (57 loc) · 2.08 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Pull request
on: pull_request
jobs:
setup:
runs-on: ubuntu-latest
# This job is the originator for determining the list of tasks to be farmed out to a matrix.
# This declares the output from the `tasks --list` step
outputs:
tasks: ${{ steps.tasks.outputs.tasks }}
steps:
- uses: actions/checkout@v3
with:
# Ensure you check out enough history to allow oneRepo to determine the
# merge-base and changed files. `0` will pull all history and should be sufficiently
# safe, unless your repo is gigabytes in size
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn
# Determine the tasks for the given lifecycle and send them to the github output
- uses: paularmstrong/onerepo/actions/get-tasks@main
id: tasks # important!: this must match the ID used in the output
with:
packageManager: yarn
lifecycle: pre-merge
verbosity: 2
tasks:
runs-on: ubuntu-latest
needs: setup
# A conditional here prevents the job from failing unexpectedly in the rare case
# that there are no tasks to run at all.
if: ${{ fromJSON(needs.setup.outputs.tasks).parallel != '[]' && fromJSON(needs.setup.outputs.tasks).parallel != '[]' }}
strategy:
# Run all tasks, even if some fail
fail-fast: false
matrix:
# Because we run all tasks on separate runners, we do not need to worry about
# which tasks are parallel or serial – they can all be parallel
task:
- ${{ fromJSON(needs.setup.outputs.tasks).parallel }}
- ${{ fromJSON(needs.setup.outputs.tasks).serial }}
name: ${{ join(matrix.task.*.name, ', ') }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn
- uses: paularmstrong/onerepo/actions/run-task@main
with:
task: |
${{ toJSON(matrix.task) }}