-
Notifications
You must be signed in to change notification settings - Fork 4
109 lines (95 loc) · 2.85 KB
/
test-pull-request.yml
File metadata and controls
109 lines (95 loc) · 2.85 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
103
104
105
106
107
108
109
name: Test Pull Request
on:
pull_request:
branches:
- main
env:
BUILDERS_FILEPATH: "builders.json"
jobs:
preparation:
name: Preparation
runs-on: ubuntu-24.04
outputs:
combos: ${{ steps.get_combos.outputs.combos }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Get Combos
id: get_combos
run: |
builders=$(jq -n -c '[]')
if [ -f ${{ env.BUILDERS_FILEPATH }} ]; then
builders=$(jq -c '.builders' ${{ env.BUILDERS_FILEPATH }})
else
# Strip off the Github org prefix from repo name
# paketo-buildpacks/builder-with-some-name --> builder-with-some-name
registry_repo=$(echo "${{ github.repository }}" | sed 's/^.*\///')
builders=$(jq -n -c '[
{
"name": "'"${registry_repo}"'",
"path": ".",
"container_repository": "'"${registry_repo}"'",
"test_runners": ["ubuntu-24.04"]
}
]')
fi
builders=$(jq -c '.[]' <<< "$builders")
combos=$(jq -n -c '[]')
for builder in $builders; do
runners=$(echo $builder | jq -r '.test_runners[]')
builder_name=$(echo $builder | jq -r '.name')
builder_path=$(echo $builder | jq -r '.path')
for runner in $runners; do
combos=$(
jq \
--arg builder_name "$builder_name" \
--arg runner "$runner" \
--arg builder_path "$builder_path" \
'. + [{"builder": $builder_name, "runner": $runner, "path": $builder_path}]' \
<<< "$combos"
)
done
done
combos=$(jq -c <<< "$combos")
echo "combos=$combos"
echo "combos=$combos" >> "$GITHUB_OUTPUT"
smoke:
name: Smoke Test
needs: preparation
strategy:
matrix:
combos: ${{ fromJSON(needs.preparation.outputs.combos) }}
runs-on: ${{ matrix.combos.runner }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run Smoke Tests
run: ./scripts/smoke.sh --builder-dir "${{ matrix.combos.path }}"
roundup:
name: Smoke Test
if: ${{ always() }}
runs-on: ubuntu-24.04
needs: smoke
steps:
- run: |
result="${{ needs.smoke.result }}"
if [[ $result == "success" ]]; then
echo "Smoke tests passed against all builders"
exit 0
else
echo "Smoke tests failed on one or more builders"
exit 1
fi
upload:
name: Upload Workflow Event Payload
runs-on: ubuntu-24.04
steps:
- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: event-payload
path: ${{ github.event_path }}