forked from paketo-buildpacks/packit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes: - running tests for PRs - creating a release with jam build artifacts
- Loading branch information
Ryan Moran
committed
May 11, 2020
1 parent
d7060ff
commit 7eee3b6
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Run Unit Tests | ||
run: go test -v -count=1 ./... | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: unit | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Tag | ||
id: tag | ||
uses: paketo-buildpacks/github-config/actions/tag@master | ||
- name: Package Jam | ||
run : ./scripts/package.sh | ||
- name: Create Release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag.outputs.tag }} | ||
release_name: ${{ steps.tag.outputs.tag }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Jam (darwin) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: build/jam-darwin | ||
asset_name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz | ||
asset_content_type: application/octet-stream | ||
- name: Upload Jam (linux) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: build/jam-linux | ||
asset_name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz | ||
asset_content_type: application/octet-stream | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Test Pull Request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Run Unit Tests | ||
run: go test -v -count=1 ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.DS_Store | ||
.idea | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
readonly ROOT_DIR="$(cd "$(dirname "${0}")/.." && pwd)" | ||
readonly ARTIFACTS_DIR="${ROOT_DIR}/build" | ||
|
||
function main() { | ||
mkdir -p "${ARTIFACTS_DIR}" | ||
|
||
pushd "${ROOT_DIR}" > /dev/null || return | ||
for os in darwin linux; do | ||
echo "* building jam on ${os}" | ||
GOOS="${os}" GOARCH="amd64" go build -o "${ARTIFACTS_DIR}/jam-${os}" ./cargo/jam/main.go | ||
chmod +x "${ARTIFACTS_DIR}/jam-${os}" | ||
done | ||
popd > /dev/null || return | ||
} | ||
|
||
main "${@:-}" |