Skip to content

Commit

Permalink
Merge pull request #7 from salesforce/goreleaser-docker-fix
Browse files Browse the repository at this point in the history
Add goreleaser to workflows/ci.yaml
  • Loading branch information
justinharringa committed Sep 15, 2021
2 parents 8fb4830 + 528beda commit 10c929d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,23 @@ jobs:
- name: checkout
uses: actions/checkout@master
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: build and test binary
run: make ci
- name: docker build
run: make local-docker-build
- name: GoReleaser Build
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --skip-publish --snapshot --rm-dist
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Docker Login
uses: docker/login-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
.idea

# Build / CI artifacts
bin
/ci-result-to-slack
coverage.out
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ project_name: ci-result-to-slack
builds:
- env: [CGO_ENABLED=0]
main: ./cmd/ci-result-to-slack
binary: bin/ci-result-to-slack
goos:
- linux
- windows
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM gcr.io/distroless/base-debian11

COPY ./bin/ci-result-to-slack /ci-result-to-slack
COPY ./ci-result-to-slack /ci-result-to-slack

ENTRYPOINT ["/ci-result-to-slack"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci: build test

build: clean
@echo "Building..."
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -o bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME)/main.go
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -o $(BINARY_NAME) ./cmd/$(BINARY_NAME)/main.go

test: clean
@echo "Running unit tests..."
Expand All @@ -23,7 +23,7 @@ lint:

clean:
@echo "Cleaning..."
rm -rf ./bin/$(BINARY_NAME)
rm -rf .$(BINARY_NAME)
rm -rf coverage.out

local-docker-test: ## Build and run unit tests in docker container like CI without building the container
Expand Down

0 comments on commit 10c929d

Please sign in to comment.