-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from trustpilot/moving-to-go-mod
Moving to go mod
- Loading branch information
Showing
15 changed files
with
290 additions
and
268 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
on: push | ||
name: test-and-build | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
|
||
- name: Get dependencies | ||
run: | | ||
go mod download | ||
- name: Run unit-tests | ||
run: | | ||
GO111MODULE=on CGO_ENABLED=0 go test ./... | ||
- name: Build executables | ||
run: | | ||
./build.sh | ||
- name: Upload artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: binaries | ||
path: .build | ||
|
||
dockerimage: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Download artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: binaries | ||
path: .build | ||
|
||
- name: Build docker image | ||
run: | | ||
docker build . -t trustpilot/beat-exporter | ||
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,79 @@ | ||
on: | ||
release: | ||
types: [published] | ||
name: handle-release | ||
jobs: | ||
artifacts: | ||
name: Create and upload release artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code at release tag | ||
uses: actions/checkout@v1 | ||
with: | ||
ref: ${{ github.ref }} | ||
fetch-depth: 1 | ||
|
||
- name: Get dependencies | ||
run: | | ||
go mod download | ||
- name: Build executables | ||
run: | | ||
./build.sh | ||
- name: Create artifact archives | ||
run: | | ||
./create-artifacts.sh | ||
- name: Upload artifacts archives | ||
uses: skx/github-action-publish-binaries@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: './.release/beat-exporter-*' | ||
|
||
docker: | ||
name: Publish docker images | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
with: | ||
ref: ${{ github.ref }} | ||
fetch-depth: 1 | ||
|
||
- name: Get dependencies | ||
run: | | ||
go mod download | ||
- name: Build executables | ||
run: | | ||
./build.sh | ||
- name: Build and push docker image with version tags | ||
uses: jerray/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: trustpilot/beat-exporter | ||
auto_tag: true | ||
|
||
- name: Build and push docker image with latest tag | ||
uses: jerray/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: trustpilot/beat-exporter | ||
tags: latest |
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,6 +1,7 @@ | ||
vendor | ||
.build | ||
.tarballs | ||
.release | ||
.vscode | ||
.DS_Store | ||
beat-exporter | ||
beat-exporter.exe |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,14 +1,7 @@ | ||
FROM quay.io/prometheus/golang-builder as builder | ||
FROM quay.io/prometheus/busybox:latest | ||
LABEL MAINTAINER="Audrius Karabanovas <[email protected]>" | ||
|
||
ADD . /go/src/github.com/trustpilot/beat-exporter | ||
WORKDIR /go/src/github.com/trustpilot/beat-exporter | ||
|
||
RUN make | ||
|
||
FROM quay.io/prometheus/busybox:latest | ||
MAINTAINER Audrius Karabanovas <[email protected]> | ||
|
||
COPY --from=builder /go/src/github.com/trustpilot/beat-exporter/beat-exporter /bin/beat-exporter | ||
COPY .build/linux-amd64/beat-exporter /bin/beat-exporter | ||
|
||
EXPOSE 9479 | ||
ENTRYPOINT [ "/bin/beat-exporter" ] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.