Skip to content

Commit 5a9328b

Browse files
emmjohnsonArjun Sreedharan
andauthored
Implements pip-install buildpack (#4)
* Implements pip-install buildpack - Per Python RFC 1 (https://github.com/paketo-community/python/blob/main/rfcs/0001-restructure.md) Fixes: #1 Signed-off-by: Arjun Sreedharan <asreedharan@vmware.com> * Add Readme Signed-off-by: Arjun Sreedharan <asreedharan@vmware.com> * remove comment Co-authored-by: Arjun Sreedharan <asreedharan@vmware.com>
1 parent 4234344 commit 5a9328b

52 files changed

Lines changed: 3214 additions & 1 deletion

Some content is hidden

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

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: gomod
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
open-pull-requests-limit: 10

.github/labels.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- name: status/possible-priority
2+
description: This issue is ready to work and should be considered as a potential priority
3+
color: F9D0C4
4+
- name: status/prioritized
5+
description: This issue has been triaged and resolving it is a priority
6+
color: BFD4F2
7+
- name: status/blocked
8+
description: This issue has been triaged and resolving it is blocked on some other issue
9+
color: 848978
10+
- name: bug
11+
description: Something isn't working
12+
color: d73a4a
13+
- name: enhancement
14+
description: A new feature or request
15+
color: a2eeef
16+
- name: documentation
17+
description: This issue relates to writing documentation
18+
color: D4C5F9

.github/workflows/auto-merge.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Auto-Merge
2+
3+
on:
4+
pull_request_review:
5+
types:
6+
- submitted
7+
8+
jobs:
9+
automerge:
10+
name: Merge or Rebase
11+
if: ${{ github.event.review.user.login == 'paketo-bot-reviewer' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Fetch Pull Request Details
18+
id: pull_request
19+
env:
20+
NUMBER: ${{ github.event.pull_request.number }}
21+
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
22+
run: |
23+
payload="$(
24+
curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${NUMBER}" \
25+
--silent \
26+
--location \
27+
--header "Authorization: token ${GITHUB_TOKEN}"
28+
)"
29+
30+
echo "::set-output name=mergeable_state::$(echo "${payload}" | jq -r -c .mergeable_state)"
31+
32+
- name: Merge
33+
if: ${{ steps.pull_request.outputs.mergeable_state == 'clean' || steps.pull_request.outputs.mergeable_state == 'unstable' }}
34+
uses: paketo-buildpacks/github-config/actions/pull-request/merge@main
35+
with:
36+
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
37+
number: ${{ github.event.pull_request.number }}
38+
39+
- name: Rebase
40+
if: ${{ steps.pull_request.outputs.mergeable_state == 'behind' }}
41+
uses: paketo-buildpacks/github-config/actions/pull-request/rebase@main
42+
with:
43+
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
44+
number: ${{ github.event.pull_request.number }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 0 * * *' # Once a day at midnight
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
language:
20+
- 'go'
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
- name: Initialize CodeQL
27+
uses: github/codeql-action/init@v1
28+
with:
29+
languages: ${{ matrix.language }}
30+
31+
- name: Autobuild
32+
uses: github/codeql-action/autobuild@v1
33+
34+
- name: Perform CodeQL Analysis
35+
uses: github/codeql-action/analyze@v1
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Create or Update Draft Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
repository_dispatch:
8+
types: [ version-bump ]
9+
workflow_dispatch: {}
10+
11+
jobs:
12+
unit:
13+
name: Unit Tests
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Setup Go
17+
uses: actions/setup-go@v1
18+
with:
19+
go-version: 1.16
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Run Unit Tests
23+
run: ./scripts/unit.sh
24+
25+
integration:
26+
name: Integration Tests
27+
runs-on: ubuntu-latest
28+
needs: unit
29+
steps:
30+
- name: Setup Go
31+
uses: actions/setup-go@v1
32+
with:
33+
go-version: 1.16
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
37+
- name: Run Integration Tests
38+
run: ./scripts/integration.sh --use-token
39+
env:
40+
GIT_TOKEN: ${{ github.token }}
41+
42+
release:
43+
name: Release
44+
runs-on: ubuntu-latest
45+
needs: integration
46+
steps:
47+
- name: Setup Go
48+
uses: actions/setup-go@v1
49+
with:
50+
go-version: 1.16
51+
- name: Checkout
52+
uses: actions/checkout@v2
53+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
54+
- name: Reset Draft Release
55+
id: reset
56+
uses: paketo-buildpacks/github-config/actions/release/reset-draft@main
57+
with:
58+
repo: ${{ github.repository }}
59+
token: ${{ github.token }}
60+
- name: Tag
61+
id: tag
62+
uses: paketo-buildpacks/github-config/actions/tag@main
63+
with:
64+
current_version: ${{ steps.reset.outputs.current_version }}
65+
- name: Package
66+
run: ./scripts/package.sh --version "${{ steps.tag.outputs.tag }}"
67+
- name: Create Release Notes
68+
id: create-release-notes
69+
uses: paketo-buildpacks/github-config/actions/release/notes@main
70+
- name: Create Release
71+
uses: paketo-buildpacks/github-config/actions/release/create@main
72+
with:
73+
repo: ${{ github.repository }}
74+
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
75+
tag_name: v${{ steps.tag.outputs.tag }}
76+
target_commitish: ${{ github.sha }}
77+
name: v${{ steps.tag.outputs.tag }}
78+
body: ${{ steps.create-release-notes.outputs.release_body }}
79+
draft: true
80+
assets: |
81+
[
82+
{
83+
"path": "build/buildpack.tgz",
84+
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz",
85+
"content_type": "application/gzip"
86+
},
87+
{
88+
"path": "build/buildpackage.cnb",
89+
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb",
90+
"content_type": "application/gzip"
91+
}
92+
]

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
golangci:
13+
name: lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: golangci-lint
18+
uses: golangci/golangci-lint-action@v2.3.0
19+
with:
20+
version: v1.32.2
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Push Buildpackage
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
push:
10+
name: Push
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Parse Event
15+
id: event
16+
run: |
17+
echo "::set-output name=tag::$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)"
18+
echo "::set-output name=download_url::$(jq -r '.release.assets[] | select(.name | endswith(".cnb")) | .url' "${GITHUB_EVENT_PATH}")"
19+
20+
- name: Download
21+
id: download
22+
uses: paketo-buildpacks/github-config/actions/release/download-asset@main
23+
with:
24+
url: ${{ steps.event.outputs.download_url }}
25+
output: "/github/workspace/buildpackage.cnb"
26+
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
27+
28+
- name: Push to GCR
29+
env:
30+
GCR_PUSH_BOT_JSON_KEY: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }}
31+
run: |
32+
echo "${GCR_PUSH_BOT_JSON_KEY}" | sudo skopeo login --username _json_key --password-stdin gcr.io
33+
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag }}"
34+
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:latest"
35+
36+
- name: Push to DockerHub
37+
id: push
38+
env:
39+
DOCKERHUB_USERNAME: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
40+
DOCKERHUB_PASSWORD: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }}
41+
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
42+
run: |
43+
REPOSITORY="${GITHUB_REPOSITORY_OWNER/-/}/${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" # translates 'paketo-buildpacks/bundle-install' to 'paketobuildpacks/bundle-install'
44+
IMAGE="index.docker.io/${REPOSITORY}"
45+
echo "${DOCKERHUB_PASSWORD}" | sudo skopeo login --username "${DOCKERHUB_USERNAME}" --password-stdin index.docker.io
46+
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://${IMAGE}:${{ steps.event.outputs.tag }}"
47+
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://${IMAGE}:latest"
48+
echo "::set-output name=image::${IMAGE}"
49+
echo "::set-output name=digest::$(sudo skopeo inspect "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" | jq -r .Digest)"
50+
51+
- name: Register with CNB Registry
52+
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:main
53+
with:
54+
id: ${{ github.repository }}
55+
version: ${{ steps.event.outputs.tag }}
56+
address: ${{ steps.push.outputs.image }}@${{ steps.push.outputs.digest }}
57+
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Synchronize Labels
2+
"on":
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- .github/labels.yml
8+
jobs:
9+
synchronize:
10+
name: Synchronize Labels
11+
runs-on:
12+
- ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: micnncim/action-label-syncer@v1
16+
env:
17+
GITHUB_TOKEN: ${{ github.token }}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Test Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
unit:
10+
name: Unit Tests
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup Go
14+
uses: actions/setup-go@v1
15+
with:
16+
go-version: 1.16
17+
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Run Unit Tests
22+
run: ./scripts/unit.sh
23+
24+
integration:
25+
name: Integration Tests
26+
runs-on: ubuntu-latest
27+
needs: unit
28+
steps:
29+
- name: Setup Go
30+
uses: actions/setup-go@v1
31+
with:
32+
go-version: 1.16
33+
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
37+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
38+
39+
- name: Run Integration Tests
40+
run: ./scripts/integration.sh --use-token
41+
env:
42+
GIT_TOKEN: ${{ github.token }}
43+
44+
approve:
45+
name: Approve Bot PRs
46+
if: ${{ github.event.pull_request.user.login == 'paketo-bot' || github.event.pull_request.user.login == 'dependabot[bot]' }}
47+
runs-on: ubuntu-latest
48+
needs: integration
49+
steps:
50+
- name: Check Commit Verification
51+
id: unverified-commits
52+
uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main
53+
with:
54+
token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }}
55+
repo: ${{ github.repository }}
56+
number: ${{ github.event.number }}
57+
58+
- name: Check for Human Commits
59+
id: human-commits
60+
uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main
61+
with:
62+
token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }}
63+
repo: ${{ github.repository }}
64+
number: ${{ github.event.number }}
65+
66+
- name: Checkout
67+
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
68+
uses: actions/checkout@v2
69+
70+
- name: Approve
71+
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
72+
uses: paketo-buildpacks/github-config/actions/pull-request/approve@main
73+
with:
74+
token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }}
75+
number: ${{ github.event.number }}

0 commit comments

Comments
 (0)