Skip to content

Commit d740d7f

Browse files
authored
Merge pull request #46 from rog-golang-buddies/v0.2.0-review-updates
V0.2.0 review updates #46
2 parents de6ee03 + 34330ec commit d740d7f

19 files changed

+181
-101
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ updates:
55
schedule:
66
interval: weekly
77
open-pull-requests-limit: 5
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/SonarCloud.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/gitleaks.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
name: Gitleaks
2-
3-
on: [pull_request, push, workflow_dispatch]
4-
1+
name: gitleaks
2+
on: [push]
53
jobs:
64
gitleaks:
7-
name: Secret Scan
85
runs-on: ubuntu-latest
96
steps:
10-
- name: Check out the repo
7+
- name: Checkout
118
uses: actions/checkout@v2
129
- name: Run gitleaks
1310
run: docker run -v ${{ github.workspace }}:/path zricethezav/gitleaks:latest detect -v --source="/path" --redact
14-
1511
run-if-failed:
16-
name: Github Security Report (if gitleaks job fails)
12+
name: gen-report (if gitleaks fails)
1713
runs-on: ubuntu-latest
1814
needs: [gitleaks]
1915
if: always() && (needs.gitleaks.result == 'failure')
2016
permissions:
2117
security-events: write
2218
steps:
23-
- name: Check out the repo
19+
- name: Checkout
2420
uses: actions/checkout@v2
2521
- name: Generate gitleaks SARIF file
2622
# Exit 0 so we can get the failed report results from this step.

.github/workflows/go-test.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/golangci-lint.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
name: golangci-lint
2-
on:
3-
push:
4-
pull_request:
2+
on: [push]
53
permissions:
64
contents: read
75
# Optional: allow read access to pull request. Use with `only-new-issues` option.
86
# pull-requests: read
97
jobs:
10-
golangci:
11-
name: lint
8+
lint:
129
runs-on: ubuntu-latest
1310
steps:
1411
- uses: actions/setup-go@v3
1512
with:
1613
go-version: 1.17
17-
- uses: actions/checkout@v3
18-
- name: golangci-lint
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Run linters
1917
uses: golangci/golangci-lint-action@v3
2018
with:
2119
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version

.github/workflows/mkdocs.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
name: gen-docs
1+
name: mkdocs
22
on:
33
push:
44
branches:
5-
- master
65
- main
76
jobs:
87
deploy:
98
runs-on: ubuntu-latest
109
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-python@v2
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Setup Python
13+
uses: actions/setup-python@v2
1314
with:
1415
python-version: 3.x
15-
- run: pip install mkdocs-material
16-
- run: mkdocs gh-deploy --force
16+
- name: Install mkdocs-material
17+
run: pip install mkdocs-material
18+
- name: Publish to gh-pages
19+
run: mkdocs gh-deploy --force

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
name: release
2-
32
on:
43
push:
54
branches:
65
- main
76
jobs:
8-
tag:
7+
semantic-release:
98
runs-on: ubuntu-latest
109
strategy:
1110
matrix:
1211
node-version:
1312
- 16.x
1413
steps:
15-
- name: Checkout
14+
-
15+
name: Checkout
1616
uses: actions/checkout@v3
1717
with:
1818
fetch-depth: 0
19-
- name: Release
19+
-
20+
name: Release
2021
env:
2122
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2223
run: npx semantic-release
2324
goreleaser:
2425
runs-on: ubuntu-latest
25-
needs: tag
26+
needs: semantic-release
2627
steps:
2728
-
2829
name: Checkout

.github/workflows/tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: tests
2+
on: [push]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v2
9+
- name: Setup Go
10+
uses: actions/setup-go@v2
11+
with:
12+
go-version: 1.18
13+
- name: Go Test
14+
run: go test -v ./...

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.dll
55
*.so
66
*.dylib
7+
bin/
78

89
# Test binary, built with `go test -c`
910
*.test
@@ -14,4 +15,9 @@
1415
# Dependency directories (remove the comment below to include it)
1516
# vendor/
1617

17-
bin/
18+
# Code editor personal settings
19+
.vscode/
20+
.idea/
21+
22+
# Other
23+
.DS_Store

Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
FROM golang:1.18 as build
2-
WORKDIR /go/src/app
1+
FROM golang:1.18-alpine as builder
2+
3+
RUN apk update && apk upgrade && \
4+
apk add --no-cache make bash
5+
6+
WORKDIR /src
37
COPY . .
4-
# Static build requires CGO_ENABLED=0
5-
RUN mkdir -p /go/bin && CGO_ENABLED=0 go build -ldflags="-w -s" -o /go/bin/app ./...
8+
9+
# Build executable
10+
RUN make build
611

712
# Using a distroless image from https://github.com/GoogleContainerTools/distroless
8-
# Image sourced from https://console.cloud.google.com/gcr/images/distroless/global/static
913
FROM gcr.io/distroless/static:nonroot
10-
COPY --from=build /go/bin/app /
11-
# numeric version of user nonroot:nonroot provided in image
14+
15+
# Copy executable from builder image
16+
COPY --from=builder /src/bin/app /
17+
18+
# Numeric version of user nonroot:nonroot provided in image
1219
USER 65532:65532
20+
21+
# Run the executable
1322
CMD ["/app"]

0 commit comments

Comments
 (0)