-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d781e90
commit 73074ca
Showing
2 changed files
with
100 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,69 @@ | ||
VERSION 0.8 | ||
|
||
deps: | ||
FROM golang:1.23.0-alpine3.19 | ||
|
||
WORKDIR /work | ||
|
||
RUN apk add git file | ||
|
||
RUN mkdir -p /go/cache && mkdir -p /go/modcache | ||
ENV GOCACHE=/go/cache | ||
ENV GOMODCACHE=/go/modcache | ||
CACHE --persist --sharing shared /go | ||
|
||
COPY ../lib/project+src/src /lib/project | ||
COPY ../lib/tools+src/src /lib/tools | ||
|
||
COPY go.mod go.sum . | ||
RUN go mod download | ||
|
||
src: | ||
FROM +deps | ||
|
||
CACHE --persist --sharing shared /go | ||
|
||
COPY . . | ||
RUN go generate ./... | ||
|
||
check: | ||
FROM +src | ||
|
||
RUN gofmt -l . | grep . && exit 1 || exit 0 | ||
RUN go vet ./... | ||
|
||
build: | ||
FROM +src | ||
|
||
ARG GOOS | ||
ARG GOARCH | ||
ARG version="0.0.0" | ||
|
||
ENV CGO_ENABLED=0 | ||
RUN go build -ldflags="-extldflags=-static -X main.version=$version" -o bin/gh-job-checker main.go | ||
RUN file bin/gh-job-checker | ||
|
||
SAVE ARTIFACT bin/gh-job-checker gh-job-checker | ||
|
||
test: | ||
FROM +build | ||
|
||
RUN go test ./... | ||
|
||
github: | ||
FROM scratch | ||
|
||
ARG version="dev" | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG USERPLATFORM | ||
|
||
COPY \ | ||
--platform=$USERPLATFORM \ | ||
(+build/forge \ | ||
--GOOS=$TARGETOS \ | ||
--GOARCH=$TARGETARCH \ | ||
--version=$version) bin/gh-job-checker | ||
|
||
SAVE ARTIFACT bin/gh-job-checker gh-job-checker |
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,31 @@ | ||
version: "1.0" | ||
project: { | ||
name: "gh-job-checker" | ||
ci: targets: { | ||
github: { | ||
args: { | ||
version: string | *"dev" @forge(name="GIT_TAG") | ||
} | ||
platforms: [ | ||
"linux/amd64", | ||
"linux/arm64", | ||
"darwin/amd64", | ||
"darwin/arm64", | ||
] | ||
} | ||
test: retries: 3 | ||
} | ||
release: { | ||
github: { | ||
on: tag: {} | ||
config: { | ||
name: string | *"dev" @forge(name="GIT_TAG") | ||
prefix: project.name | ||
token: { | ||
provider: "env" | ||
path: "GITHUB_TOKEN" | ||
} | ||
} | ||
} | ||
} | ||
} |