-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexander Jung <alex@nderjung.net>
- Loading branch information
0 parents
commit 617c6ea
Showing
21 changed files
with
2,225 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,10 @@ | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.go] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[Makefile] | ||
indent_style = tab |
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,114 @@ | ||
name: 'resource-pipeline' | ||
on: | ||
push: | ||
pull_request: | ||
types: [ opened, reopened ] | ||
jobs: | ||
unit-test: | ||
strategy: | ||
matrix: | ||
go-version: [1.14.x, 1.15.x] | ||
platform: [ubuntu-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
|
||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- uses: actions/checkout@v1 | ||
|
||
- name: Cache go dependencies | ||
id: unit-cache-go-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go-${{ matrix.go-version }}- | ||
|
||
- name: Install go dependencies | ||
if: steps.unit-cache-go-dependencies.outputs.cache-hit != 'true' | ||
run: go get ./... | ||
|
||
- name: Test | ||
run: make ci-unit-test | ||
|
||
build-artifacts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: '1.15.x' | ||
|
||
- uses: actions/checkout@v1 | ||
|
||
- name: Install tooling | ||
run: | | ||
make ci-install-go-tools | ||
make ci-install-ci-tools | ||
- name: Cache go dependencies | ||
id: package-cache-go-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-prod-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go-prod- | ||
|
||
- name: Install dependencies | ||
if: steps.package-cache-go-dependencies.outputs.cache-hit != 'true' | ||
run: go get ./... | ||
|
||
- name: Linting, formatting, and other static code analyses | ||
run: make ci-static-analysis | ||
|
||
- name: Build snapshot artifacts | ||
run: make ci-build-snapshot-packages | ||
|
||
- run: docker images ndrjng/concourse-github-pr-comment-resource | ||
|
||
- name: Test production image | ||
run: make ci-test-production-image | ||
|
||
release: | ||
needs: [ unit-test, build-artifacts ] | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
|
||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: '1.15.x' | ||
|
||
- uses: actions/checkout@v1 | ||
|
||
- name: Install tooling | ||
run: make ci-install-ci-tools | ||
|
||
- name: Cache go dependencies | ||
id: release-cache-go-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-prod-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go-prod- | ||
|
||
- name: Install dependencies | ||
if: steps.release-cache-go-dependencies.outputs.cache-hit != 'true' | ||
run: go get ./... | ||
|
||
- name: Docker login | ||
run: make ci-docker-login | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Publish GitHub release | ||
run: make ci-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} | ||
|
||
- name: Docker logout | ||
run: make ci-docker-logout | ||
|
||
- name: Smoke test published image | ||
run: make ci-test-production-image |
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,6 @@ | ||
// CONCOURSE | ||
.credentials.yml | ||
|
||
// GO | ||
coverage.out | ||
dist/ |
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,34 @@ | ||
release: | ||
prerelease: false | ||
|
||
builds: | ||
- binary: dist/github-pr-comment | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildTime={{.Date}}`. | ||
|
||
dockers: | ||
- binaries: | ||
- github-pr-comment | ||
dockerfile: Dockerfile | ||
# todo: on 1.0 remove 'v' prefix | ||
image_templates: | ||
- "ndrjng/concourse-github-pr-resource-resource:latest" | ||
- "ndrjng/concourse-github-pr-resource-resource:{{ .Tag }}" | ||
- "ndrjng/concourse-github-pr-resource-resource:v{{ .Major }}" | ||
- "ndrjng/concourse-github-pr-resource-resource:v{{ .Major }}.{{ .Minor }}" | ||
extra_files: | ||
- go.mod | ||
- go.sum | ||
- main.go | ||
- cmd/ | ||
- api/ | ||
- actions/ | ||
- assets/ | ||
- Makefile | ||
|
||
|
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,68 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# | ||
# Authors: Alexander Jung <alex@nderjung.net> | ||
# | ||
# Copyright (c) 2020, Alexander Jung. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# 3. Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
ARG GOLANG_VERSION=1.15 | ||
|
||
FROM golang:${GOLANG_VERSION} AS devenv | ||
|
||
ARG ORG=nderjung | ||
ARG REPO=concourse-github-pr-comment-resource | ||
|
||
RUN set -xe; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
sudo; | ||
|
||
COPY . /go/src/github.com/${ORG}/${REPO} | ||
|
||
FROM devenv AS build | ||
|
||
ARG GOOS=linux | ||
ARG GOARCH=amd64 | ||
ARG ORG=nderjung | ||
ARG REPO=concourse-github-pr-comment-resource | ||
|
||
WORKDIR /go/src/github.com/${ORG}/${REPO} | ||
|
||
RUN set -xe; \ | ||
BUILDPATH=/github-pr-comment make build | ||
|
||
FROM concourse/buildroot:base AS run | ||
|
||
ARG BIN=github-pr-resource | ||
|
||
COPY --from=build /github-pr-comment /bin/github-pr-comment | ||
|
||
# Required by concrouse resource | ||
COPY /assets/check /opt/resource/check | ||
COPY /assets/in /opt/resource/in | ||
COPY /assets/out /opt/resource/out | ||
|
||
RUN chmod +x /opt/resource/* |
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,30 @@ | ||
SPDX-License-Identifier: BSD-3-Clause | ||
|
||
Authors: Alexander Jung <alex@nderjung.net> | ||
|
||
Copyright (c) 2020, Alexander Jung. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.