Skip to content

Commit 4b62c2b

Browse files
committed
Move to ghcr
1 parent c433c0b commit 4b62c2b

2 files changed

Lines changed: 38 additions & 35 deletions

File tree

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,47 @@
1-
name: lint-test-build-push
1+
name: build-push
22
on:
33
push:
4-
paths-ignore:
5-
- "**/*.md"
6-
- "renovate.json5"
7-
branches:
8-
- "**"
9-
tags:
10-
- "*"
11-
12-
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
14-
cancel-in-progress: true
15-
16-
permissions:
17-
contents: read
4+
workflow_dispatch:
5+
186
jobs:
197
lint-test:
208
runs-on: ubuntu-24.04
219
steps:
22-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23-
24-
- name: check valid yml
25-
run: yq . *.yaml
10+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
2611

27-
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
12+
- name: Set up Go
13+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
2814
with:
29-
go-version: ">=1.25.0"
15+
go-version-file: "go.mod"
3016

3117
- name: golangci-lint
32-
uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # v9
18+
uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9
3319
with:
3420
version: latest
3521

3622
- name: Install dependencies
3723
run: go get .
3824

39-
- name: Build
40-
run: go build -v ./...
25+
- run: go build
26+
27+
- name: unit test
28+
run: go test -race -v ./...
4129

42-
- name: Test with the Go CLI
43-
run: go test -v -race ./...
30+
- name: coverage
31+
run: go test -v -coverprofile=coverage.out -covermode=atomic ./...
32+
33+
- name: upload coverage to codecov
34+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
35+
with:
36+
files: ./coverage.out
37+
fail_ci_if_error: false
38+
env:
39+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4440

45-
build-push:
41+
run:
4642
needs: [lint-test]
47-
uses: libops/actions/.github/workflows/build-push.yml@main
43+
uses: libops/.github/.github/workflows/build-push-ghcr.yaml@main
4844
permissions:
4945
contents: read
5046
packages: write
51-
id-token: write
5247
secrets: inherit

Dockerfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
FROM golang:1.25-alpine3.22@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb
1+
FROM ghcr.io/libops/go1.25:main@sha256:f43c9b34f888d2ac53e87c8e061554f826b8eb580863d7b21fd787b6f0378f8f AS builder
2+
3+
SHELL ["/bin/ash", "-o", "pipefail", "-ex", "-c"]
24

35
WORKDIR /app
46

5-
COPY . ./
7+
COPY go.* ./
8+
RUN --mount=type=cache,target=/go/pkg/mod \
9+
go mod download
10+
11+
COPY *.go ./
12+
13+
RUN --mount=type=cache,target=/root/.cache/go-build \
14+
CGO_ENABLED=0 go build -ldflags="-s -w" -o /app/binary .
15+
16+
FROM ghcr.io/libops/go1.25:main@sha256:f43c9b34f888d2ac53e87c8e061554f826b8eb580863d7b21fd787b6f0378f8f
617

7-
RUN go mod download \
8-
&& go build -o /app/ppb \
9-
&& go clean -cache -modcache
18+
COPY --from=builder /app/binary /app/binary
1019

11-
ENTRYPOINT ["/app/ppb"]

0 commit comments

Comments
 (0)