Skip to content

Commit 5bdfa47

Browse files
cf-buildpacks-engryanmoran
authored andcommitted
Updating github-config
1 parent c23bb14 commit 5bdfa47

2 files changed

Lines changed: 62 additions & 9 deletions

File tree

.github/workflows/test-pull-request.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,27 @@ jobs:
2424
- name: Run Unit Tests
2525
run: ./scripts/unit.sh
2626

27-
integration:
28-
name: Integration Tests
27+
integration-matrix:
28+
name: Integration Matrix
2929
runs-on: ubuntu-latest
30+
outputs:
31+
matrix: ${{ steps.set-matrix.outputs.matrix }}
3032
needs: unit
33+
steps:
34+
- name: Set Matrix
35+
id: set-matrix
36+
run: |
37+
matrix="$(jq -r -c '.integration.matrix' ./config.json)"
38+
printf "Output: matrix=%s\n" "${matrix}"
39+
printf "matrix=%s\n" "${matrix}"
40+
41+
integration:
42+
name: Integration Test
43+
runs-on: ubuntu-latest
44+
needs: integration-matrix
45+
strategy:
46+
matrix:
47+
include: ${{ fromJSON(needs.integration-matrix.outputs.matrix) }}
3148
steps:
3249

3350
- name: Setup Go
@@ -43,13 +60,34 @@ jobs:
4360
- name: Run Integration Tests
4461
env:
4562
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
run: ./scripts/integration.sh --platform docker --github-token "${GITHUB_TOKEN}"
63+
run: |
64+
./scripts/integration.sh \
65+
--platform docker \
66+
--github-token "${GITHUB_TOKEN}" \
67+
--cached ${{ matrix.cached }} \
68+
--parallel ${{ matrix.parallel }}
69+
70+
roundup:
71+
name: Integration Tests
72+
if: ${{ always() }}
73+
runs-on: ubuntu-latest
74+
needs: integration
75+
steps:
76+
- run: |
77+
result="${{ needs.integration.result }}"
78+
if [[ "${result}" == "success" ]]; then
79+
echo "All integration tests passed"
80+
exit 0
81+
else
82+
echo "One or more integration tests failed"
83+
exit 1
84+
fi
4785
4886
approve:
4987
name: Approve Bot PRs
5088
if: ${{ github.event.pull_request.user.login == 'cf-buildpacks-eng' || github.event.pull_request.user.login == 'dependabot[bot]' }}
5189
runs-on: ubuntu-latest
52-
needs: integration
90+
needs: roundup
5391
steps:
5492

5593
- name: Check Commit Verification

scripts/integration.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ USAGE
2525
}
2626

2727
function main() {
28-
local src stack platform token
28+
local src stack platform token cached parallel
2929
src="$(find "${ROOTDIR}/src" -mindepth 1 -maxdepth 1 -type d )"
3030
stack="${CF_STACK:-$(jq -r -S .stack "${ROOTDIR}/config.json")}"
3131
platform="cf"
@@ -42,6 +42,16 @@ function main() {
4242
shift 2
4343
;;
4444

45+
--cached)
46+
cached="${2}"
47+
shift 2
48+
;;
49+
50+
--parallel)
51+
parallel="${2}"
52+
shift 2
53+
;;
54+
4555
--help|-h)
4656
shift 1
4757
usage
@@ -64,10 +74,15 @@ function main() {
6474
fi
6575
fi
6676

67-
IFS=$'\n' read -r -d '' -a matrix < <(
68-
jq -r -S -c .integration.matrix[] "${ROOTDIR}/config.json" \
69-
&& printf "\0"
70-
)
77+
declare -a matrix
78+
if [[ "${cached:-}" != "" && "${parallel:-}" != "" ]]; then
79+
matrix+=("{\"cached\":${cached},\"parallel\":${parallel}}")
80+
else
81+
IFS=$'\n' read -r -d '' -a matrix < <(
82+
jq -r -S -c .integration.matrix[] "${ROOTDIR}/config.json" \
83+
&& printf "\0"
84+
)
85+
fi
7186

7287
util::tools::buildpack-packager::install --directory "${ROOTDIR}/.bin"
7388
util::tools::cf::install --directory "${ROOTDIR}/.bin"

0 commit comments

Comments
 (0)