Skip to content

Commit 601c9c6

Browse files
Arjun Sreedharanrobdimsdale
authored andcommitted
integration: convert tests to switchblade framework
- Note: this buildpack does not use the common github-config as the buildpack is packaged with the legacy github.com/cloudfoundry/buildpack-packager - Use github token provided for tests as COMPOSER_GITHUB_OAUTH_TOKEN instead of providing it separately - Removed tests not directly related to buildpack functionality (e.g. testing CF functionality like profile scripts) - There were certain tests that ran app frameworks (like Cakephp) as vendored apps and online apps, but the fixtures were wrong - the "vendored" app did not have a vendor dir and was identical to the onilne app. I haven't put the effort to fix such fixtures and removed them. e.g. https://github.com/cloudfoundry/php-buildpack/tree/63193ece34e473e746742163b4c49786476cf1ca/fixtures/cake_local_deps - Tests on Symfony app framework was marked as pending last year (#1000). The tests do not currently run successfully on CF. So I haven't migrated them to switchblade.
1 parent 63193ec commit 601c9c6

File tree

5,727 files changed

+112386
-630872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,727 files changed

+112386
-630872
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Test Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
unit:
10+
name: Unit Tests
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Setup Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: stable
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: 'true'
23+
fetch-depth: 0
24+
25+
- name: Run Unit Tests
26+
run: ./scripts/unit.sh
27+
28+
integration-matrix:
29+
name: Integration Matrix
30+
runs-on: ubuntu-latest
31+
outputs:
32+
matrix: ${{ steps.set-matrix.outputs.matrix }}
33+
needs: unit
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: 'true'
39+
40+
- name: Set Matrix
41+
id: set-matrix
42+
run: |
43+
matrix="$(jq -r -c '.integration.matrix' ./config.json)"
44+
printf "Output: matrix=%s\n" "${matrix}"
45+
printf "matrix=%s\n" "${matrix}" >> "$GITHUB_OUTPUT"
46+
47+
integration:
48+
name: Integration Test
49+
runs-on: ubuntu-latest
50+
needs: integration-matrix
51+
strategy:
52+
matrix:
53+
include: ${{ fromJSON(needs.integration-matrix.outputs.matrix) }}
54+
steps:
55+
56+
- name: Setup Go
57+
uses: actions/setup-go@v5
58+
with:
59+
go-version: stable
60+
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
65+
submodules: 'true'
66+
67+
- name: Run Integration Tests
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
run: |
71+
./scripts/integration.sh \
72+
--platform docker \
73+
--github-token "${GITHUB_TOKEN}" \
74+
--cached ${{ matrix.cached }} \
75+
--parallel ${{ matrix.parallel }}
76+
77+
roundup:
78+
name: Integration Tests
79+
if: ${{ always() }}
80+
runs-on: ubuntu-latest
81+
needs: integration
82+
steps:
83+
- run: |
84+
result="${{ needs.integration.result }}"
85+
if [[ "${result}" == "success" ]]; then
86+
echo "All integration tests passed"
87+
exit 0
88+
else
89+
echo "One or more integration tests failed"
90+
exit 1
91+
fi
92+
93+
approve:
94+
name: Approve Bot PRs
95+
if: ${{ github.event.pull_request.user.login == 'cf-buildpacks-eng' || github.event.pull_request.user.login == 'dependabot[bot]' }}
96+
runs-on: ubuntu-latest
97+
needs: roundup
98+
steps:
99+
100+
- name: Check Commit Verification
101+
id: unverified-commits
102+
uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main
103+
with:
104+
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
105+
repo: ${{ github.repository }}
106+
number: ${{ github.event.number }}
107+
108+
- name: Check for Human Commits
109+
id: human-commits
110+
uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main
111+
with:
112+
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
113+
repo: ${{ github.repository }}
114+
number: ${{ github.event.number }}
115+
bots: 'dependabot[bot],web-flow,cf-buildpacks-eng'
116+
117+
- name: Checkout
118+
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
119+
uses: actions/checkout@v2
120+
with:
121+
ref: ${{ github.event.pull_request.head.sha }}
122+
123+
- name: Dispatch
124+
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
125+
uses: paketo-buildpacks/github-config/actions/dispatch@main
126+
with:
127+
repos: ${{ github.repository }}
128+
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
129+
event: approve-bot-pr
130+
payload: |
131+
{
132+
"number": "${{ github.event.pull_request.number }}",
133+
"login": "${{ github.event.pull_request.user.login }}",
134+
"tracker_story": "${{ steps.story-id.outputs.story_id }}"
135+
}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ binaries/precise/*
55
binaries/trusty/*
66
!binaries/trusty/index*.json
77
*.pyc
8-
*.so
98
*.swp
109
/env
1110
*_buildpack*.zip

config.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{
2-
"stack": "cflinuxfs3",
2+
"stack": "cflinuxfs4",
33
"oses": [
44
"linux"
5-
]
5+
],
6+
"integration": {
7+
"harness": "switchblade",
8+
"matrix": [
9+
{
10+
"cached": false,
11+
"parallel": true
12+
},
13+
{
14+
"cached": true,
15+
"parallel": true
16+
}
17+
]
18+
}
619
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"COMPOSER_VENDOR_DIR": "vendor",
3+
"COMPOSER_INSTALL_OPTIONS": ["--no-interaction"],
4+
"WEBDIR": "webroot",
5+
"LIBDIR": "library",
6+
"PHP_EXTENSIONS": ["pdo", "pdo_sqlite", "mcrypt", "pdo_mysql"]
7+
}
File renamed without changes.

0 commit comments

Comments
 (0)