forked from cloudfoundry/go-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (112 loc) · 3.81 KB
/
test-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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Test Pull Request
on:
pull_request:
branches:
- develop
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.19.x
- name: Checkout
uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
- name: Run Unit Tests
run: ./scripts/unit.sh
integration-matrix:
name: Integration Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
needs: unit
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Matrix
id: set-matrix
run: |
matrix="$(jq -r -c '.integration.matrix' ./config.json)"
printf "Output: matrix=%s\n" "${matrix}"
printf "matrix=%s\n" "${matrix}" >> "$GITHUB_OUTPUT"
integration:
name: Integration Test
runs-on: ubuntu-latest
needs: integration-matrix
strategy:
matrix:
include: ${{ fromJSON(needs.integration-matrix.outputs.matrix) }}
steps:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.19.x
- name: Checkout
uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
- name: Run Integration Tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/integration.sh \
--platform docker \
--github-token "${GITHUB_TOKEN}" \
--cached ${{ matrix.cached }} \
--parallel ${{ matrix.parallel }}
roundup:
name: Integration Tests
if: ${{ always() }}
runs-on: ubuntu-latest
needs: integration
steps:
- run: |
result="${{ needs.integration.result }}"
if [[ "${result}" == "success" ]]; then
echo "All integration tests passed"
exit 0
else
echo "One or more integration tests failed"
exit 1
fi
approve:
name: Approve Bot PRs
if: ${{ github.event.pull_request.user.login == 'cf-buildpacks-eng' || github.event.pull_request.user.login == 'dependabot[bot]' }}
runs-on: ubuntu-latest
needs: roundup
steps:
- name: Check Commit Verification
id: unverified-commits
uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main
with:
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
repo: ${{ github.repository }}
number: ${{ github.event.number }}
- name: Check for Human Commits
id: human-commits
uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main
with:
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
repo: ${{ github.repository }}
number: ${{ github.event.number }}
bots: 'dependabot[bot],web-flow,cf-buildpacks-eng'
- name: Checkout
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Dispatch
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
uses: paketo-buildpacks/github-config/actions/dispatch@main
with:
repos: ${{ github.repository }}
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
event: approve-bot-pr
payload: |
{
"number": "${{ github.event.pull_request.number }}",
"login": "${{ github.event.pull_request.user.login }}",
"tracker_story": "${{ steps.story-id.outputs.story_id }}"
}