-
Notifications
You must be signed in to change notification settings - Fork 115
72 lines (64 loc) · 2.74 KB
/
test-all-samples.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
65
66
67
68
69
70
71
72
name: Test All Samples
on:
merge_group:
schedule:
- cron: '30 1 * * *'
workflow_dispatch: {}
pull_request:
branches:
- main
paths:
- 'scripts/.util/tools.json'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.paths.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Discover changed paths
id: paths
run: |
set -eo pipefail
all_java_smoke_test_paths=$( find ./java -iname "smoke_test" | jq --raw-input | jq --slurp --compact-output )
all_other_smoke_test_paths='["ca-certificates","dotnet-core","git","go","nodejs","php","procfile","python","ruby","web-servers"]'
all_paths=$( echo -e "$all_java_smoke_test_paths\n$all_other_smoke_test_paths" | jq -s 'add' -c )
echo "These are the Java projects we'll run smoke tests against: $all_java_smoke_test_paths" >> $GITHUB_STEP_SUMMARY
echo "These are the other folders we'll run smoke tests against: : $all_other_smoke_test_paths" >> $GITHUB_STEP_SUMMARY
echo "These are all the smoke test locations: $all_paths" >> $GITHUB_STEP_SUMMARY
echo "matrix={\"suite\":$all_paths}" >> $GITHUB_OUTPUT
echo "This is how the matrix will look like: $(cat $GITHUB_OUTPUT)"
smoke:
needs: prepare
name: Smoke Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Checkout
uses: actions/checkout@v4
- name: Test ${{ matrix.suite }}
run: |
./scripts/smoke.sh --builder paketobuildpacks/builder-jammy-full:latest --suite ${{ matrix.suite }}
- name: File Issue
if: ${{ failure() && github.event_name != 'pull_request' }}
run: |
echo "${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}" | gh auth login --with-token
failure_issue=$(gh issue list --json number --label "test-failure" --jq .[0].number)
if [ -z $failure_issue ]; \
then gh issue create \
--title "Failure: 'Test All Samples' workflow" \
--label "test-failure" \
--body "[Test ${{ matrix.suite }} workflow](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) failed. Please take a look to ensure samples are working. (cc @paketo-buildpacks/content-maintainers)" \
-R ${{github.repository}}; \
else gh issue comment $failure_issue --body "Another failure occurred: [Test ${{ matrix.suite }} workflow](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) failed."; \
fi
echo $failure_issue