-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (50 loc) · 1.84 KB
/
build-sample-matrix.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
name: build-sample-matrix
on:
workflow_call:
inputs:
ref:
description: Branch name or sha commit for metanorma/metanorma-cli's samples-smoke-matrix.json
required: false
default: main
type: string
flavors-only:
description: Return only flavors matrix without os and ruby
required: false
default: false
type: boolean
smoke:
description: Return test matrix with minimal files for metanorma.yml
required: false
default: true
type: boolean
public-only:
description: Exclude private flavors
required: false
default: false
type: boolean
outputs:
samples-matrix:
description: "Will be empty if there is not tag on HEAD"
value: ${{ jobs.build-matrix.outputs.samples-matrix }}
jobs:
build-matrix:
runs-on: ubuntu-latest
outputs:
samples-matrix: ${{ steps.build.outputs.matrix }}
steps:
- id: build
run: |
curl -L https://raw.githubusercontent.com/metanorma/metanorma-cli/${{ inputs.ref }}/.github/workflows/samples-smoke-matrix.json | grep -v '//' > matrix.json
if [ "${{ inputs.flavors-only }}" = "true" ]; then
echo "$(jq 'del(.ruby, .os)' matrix.json)" > matrix.json
fi
if [ "${{ inputs.smoke }}" != "true" ]; then
echo "$(jq 'del(.flavor[].manifest)' matrix.json)" > matrix.json
fi
if [ "${{ inputs.public-only }}" = "true" ]; then
echo "$(jq 'walk(if (type == "object" and (.public == false or .id == "ribose")) then del(.) else . end )' matrix.json)" > matrix.json
echo "$(jq 'del(.flavor[] | nulls)' matrix.json)" > matrix.json
fi
echo "Result matrix JSON is:"
cat matrix.json
echo "matrix=$(cat matrix.json | tr '\n' ' ')" >> $GITHUB_OUTPUT