-
Notifications
You must be signed in to change notification settings - Fork 233
102 lines (94 loc) · 2.92 KB
/
build.yml
File metadata and controls
102 lines (94 loc) · 2.92 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Build
# This workflow builds multiple quickstart images as defined in the images json
# passed to the workflow across the architectures defined in the archs input.
#
# See the images.json file in the repo for how to define the JSON for a set of
# images.
#
# This workflow is intended to be called by third parties to build custom
# quickstart images. See the repository README for an example.
on:
workflow_call:
inputs:
repo:
description: "Quickstart repo where quickstart is hosted"
type: "string"
default: "stellar/quickstart"
ref:
description: "Quickstart ref to build should match workflow (sha, branch, tag)"
type: "string"
default: "main"
images:
description: "A custom image.json (a single image from the same format as images.json), if not provided the full images.json is run"
type: "string"
required: true
archs:
description: 'Architectures to build for as an array (e.g. ["amd64", "arm64"])'
type: "string"
required: true
test:
description: "Whether the image tests should run"
type: "boolean"
default: true
env:
artifact_retention_days_for_image: 7
jobs:
complete:
if: always()
name: complete
needs: [setup, build, test]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
setup:
name: 1 setup
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
tag-prefix: ${{ steps.tag-prefix.outputs.tag-prefix }}
images: ${{ steps.images.outputs.images }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repo }}
ref: ${{ inputs.ref }}
- name: Sha
id: sha
run: |
echo "sha=$(git rev-parse HEAD)" | tee -a $GITHUB_OUTPUT
- name: Resolve Inherits from Repo images.json
id: images
env:
images: ${{ inputs.images }}
run: |
echo "Input:"
<<< $images jq -C
echo "Parent:"
< images.json jq -C
images_before="$images"
images="$(<<< $images ./.scripts/images-resolve-inherits images.json)"
echo "Diff:"
diff -u --color=always <(<<< $images_before jq) <(<<< $images jq) || true
echo "Output:"
<<< $images jq -C
echo "images=$images" >> $GITHUB_OUTPUT
build:
name: 2 build
needs: setup
uses: ./.github/workflows/internal-build.yml
with:
repo: ${{ inputs.repo }}
sha: ${{ needs.setup.outputs.sha }}
images: ${{ needs.setup.outputs.images }}
archs: ${{ inputs.archs }}
test:
if: inputs.test
name: 3 test
needs: [setup, build]
uses: ./.github/workflows/internal-test.yml
with:
repo: ${{ inputs.repo }}
sha: ${{ needs.setup.outputs.sha }}
images: ${{ needs.setup.outputs.images }}
archs: ${{ inputs.archs }}