From ad8a2d65800fca1516861e9cbd4b38a3011c96fd Mon Sep 17 00:00:00 2001 From: Josh Dolitsky <393494+jdolitsky@users.noreply.github.com> Date: Wed, 30 Sep 2020 20:56:43 -0400 Subject: [PATCH] Add GitHub Actions CI (#183) Signed-off-by: jdolitsky <393494+jdolitsky@users.noreply.github.com> --- .codefresh/master.yml | 30 ------------------------------ .codefresh/pr.yml | 11 ----------- .codefresh/release.yml | 34 ---------------------------------- .github/workflows/build-pr.yml | 25 +++++++++++++++++++++++++ .github/workflows/build.yml | 24 ++++++++++++++++++++++++ README.md | 2 +- 6 files changed, 50 insertions(+), 76 deletions(-) delete mode 100644 .codefresh/master.yml delete mode 100644 .codefresh/pr.yml delete mode 100644 .codefresh/release.yml create mode 100644 .github/workflows/build-pr.yml create mode 100644 .github/workflows/build.yml diff --git a/.codefresh/master.yml b/.codefresh/master.yml deleted file mode 100644 index b2ff7f081..000000000 --- a/.codefresh/master.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: '1.0' -stages: -- test -- build -- release -steps: - - UnitTest: - title: Run unit tests - stage: test - image: golang:1.13-alpine - commands: - - apk add git make bash file - - cf_export GOCACHE="${{CF_VOLUME_PATH}}/gocache" - - cf_export GOPATH="${{CF_VOLUME_PATH}}/gopath" - - make test - BuildDockerImage: - title: Build Docker image - stage: build - type: build - image_name: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} - tag: ${{CF_BRANCH_TAG_NORMALIZED}} - PushDockerImage: - title: Push Docker image (latest) - stage: release - type: push - candidate: ${{BuildDockerImage}} - image_name: orasbot/${{CF_REPO_NAME}} - registry: dockerhub - diff --git a/.codefresh/pr.yml b/.codefresh/pr.yml deleted file mode 100644 index 24e7c7a5c..000000000 --- a/.codefresh/pr.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: '1.0' -stages: -- test -steps: - UnitTest: - title: Run unit tests - stage: test - image: golang:1.13-alpine - commands: - - apk add git make bash file - - make test diff --git a/.codefresh/release.yml b/.codefresh/release.yml deleted file mode 100644 index fdfb2cdc2..000000000 --- a/.codefresh/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Note: must set env var GITHUB_TOKEN for goreleaser -version: '1.0' -stages: -- test -- build -- release -steps: - UnitTest: - title: Run unit tests - stage: test - image: golang:1.13-alpine - commands: - - apk add git make bash file - - make test - BuildDockerImage: - title: Build Docker image - stage: build - type: build - image_name: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} - UploadReleaseArtifacts: - title: Upload release artifacts - stage: release - image: goreleaser/goreleaser:v0.106.0 - commands: - - git checkout tags/${{CF_BRANCH_TAG_NORMALIZED}} - - goreleaser --rm-dist - PushDockerImageTagged: - title: Push Docker image (tag) - stage: release - type: push - candidate: ${{BuildDockerImage}} - image_name: orasbot/${{CF_REPO_NAME}} - tag: ${{CF_BRANCH_TAG_NORMALIZED}} - registry: dockerhub diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 000000000..f4281b7b7 --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,25 @@ +name: build-pr + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: setup go environment + uses: actions/setup-go@v1 + with: + go-version: '1.15.2' + - name: run unit tests + run: make test + - name: upload coverage report + uses: actions/upload-artifact@master + with: + name: oras-coverage-report-${{ github.sha }} + path: .cover/ + if: always() diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..3d2fbda4c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: build + +on: + push: + branches: master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: setup go environment + uses: actions/setup-go@v1 + with: + go-version: '1.15.2' + - name: run unit tests + run: make test + - name: upload coverage report + uses: actions/upload-artifact@master + with: + name: oras-coverage-report-${{ github.sha }} + path: .cover/ + if: always() diff --git a/README.md b/README.md index 3d330439d..d2d83b2b5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OCI Registry As Storage -[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/orasbot/deislabs%2Foras%2Fmaster?type=cf-1)]( https://g.codefresh.io/public/accounts/orasbot/pipelines/deislabs/oras/master) +[![GitHub Actions status](https://github.com/deislabs/oras/workflows/build/badge.svg)](https://github.com/deislabs/oras/actions?query=workflow%3Abuild) [![Go Report Card](https://goreportcard.com/badge/github.com/deislabs/oras)](https://goreportcard.com/report/github.com/deislabs/oras) [![GoDoc](https://godoc.org/github.com/deislabs/oras?status.svg)](https://godoc.org/github.com/deislabs/oras)