Skip to content

Commit

Permalink
Chore: pr workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
till committed Sep 6, 2022
1 parent 76f30b6 commit 91e59b5
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .envrc-dist
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export DOCKER_HOST=unix:///Users/till/.colima/default/docker.sock
export BP_QUANTUM_DOCKER_USERNAME=
export BP_QUANTUM_DOCKER_PASSWORD=
44 changes: 44 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: pr

on:
pull_request

jobs:
test:
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: "r.planetary-quantum.com"
DOCKER_REPO: "buildpacks"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.19
- uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.BP_QUANTUM_DOCKER_USERNAME }}
password: ${{ secrets.BP_QUANTUM_DOCKER_PASSWORD }}
- uses: buildpacks/github-actions/setup-pack@v4.8.1
- id: package
run: |
#!/usr/bin/env bash
set -euo pipefail
BP_ID="$(cat buildpack.toml | yj -t | jq -r .buildpack.id)"
VERSION="$(cat buildpack.toml | yj -t | jq -r .buildpack.version)"
PACKAGE="${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPO }}/$(echo "$BP_ID" | sed 's/\//_/g')"
echo "::set-output name=package::$PACKAGE"
echo "::set-output name=version::$VERSION"
- run: make build
- run: |
pack -v \
buildpack \
package --publish \
${{ steps.package.outputs.package }}:${{ steps.package.outputs.version }}
- run: |
make setup \
builder=paketobuildpacks/builder:tiny
- run: |
make smoke \
buildpack=${{ steps.package.outputs.package }}:${{ steps.package.outputs.version }}
32 changes: 25 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@ sample:=deno

buildpack?=.
bin_dir:=$(CURDIR)/bin
builder:=r.planetary-quantum.com/runway-public/paketo-builder:full
builder?=r.planetary-quantum.com/runway-public/paketo-builder:full

.PHONY: build
build: clean
GOOS=linux go build \
-ldflags="-s -w" \
-o "$(bin_dir)/detect" \
"$(CURDIR)/cmd/detect/main.go"
build: clean bin/detect bin/build

bin/build:
GOOS=linux go build \
-ldflags="-s -w" \
-o "$(bin_dir)/build" \
"$(CURDIR)/cmd/build/main.go"

bin/detect:
GOOS=linux go build \
-ldflags="-s -w" \
-o "$(bin_dir)/detect" \
"$(CURDIR)/cmd/detect/main.go"

.PHONY: clean
clean:
rm -f $(bin_dir)/detect
rm -f $(bin_dir)/run
rm -f $(bin_dir)/build


.PHONY: setup
Expand All @@ -30,6 +33,21 @@ setup:

.PHONY: test
test: build
pack \
build \
test-$(sample)-app \
--path ./samples/$(sample) \
--buildpack .


.PHONY: act-pr
act-pr:
act "pull_request" \
-s BP_QUANTUM_DOCKER_USERNAME \
-s BP_QUANTUM_DOCKER_PASSWORD

.PHONY: smoke
smoke:
pack \
build \
test-$(sample)-app \
Expand Down
2 changes: 1 addition & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ api = "0.7"

[buildpack]
id = "deno-buildpack"
version = "0.1.0"
version = "dev"
homepage = "https://runway.planetary-quantum.com"
description = "A deno buildpack (for runway)"

Expand Down
2 changes: 2 additions & 0 deletions package.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[buildpack]
uri = "."

0 comments on commit 91e59b5

Please sign in to comment.