Cleanup workflows (#281)

This commit is contained in:
CrazyMax
2021-02-20 11:58:09 +01:00
committed by GitHub
parent 00655a9d1f
commit cd853fd3c4
6 changed files with 32 additions and 45 deletions
-6
View File
@@ -36,9 +36,6 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
buildkitd-flags: --debug
-
name: Test
uses: docker/bake-action@v1
@@ -80,9 +77,6 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
buildkitd-flags: --debug
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
-2
View File
@@ -32,8 +32,6 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
-
name: Build docs
uses: docker/bake-action@v1
-2
View File
@@ -21,8 +21,6 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
-
name: Validate
uses: docker/bake-action@v1
+2 -2
View File
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.2
ARG GO_VERSION=1.15
ARG GORELEASER_VERSION=0.149.0
ARG GORELEASER_VERSION=0.157.0
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
ARG GORELEASER_VERSION
@@ -23,7 +23,7 @@ ARG GIT_REF
RUN --mount=type=bind,target=/src,rw \
--mount=type=cache,target=/root/.cache/go-build \
--mount=target=/go/pkg/mod,type=cache \
./hack/goreleaser.sh
./hack/goreleaser.sh "diun" "/out"
FROM scratch AS artifacts
COPY --from=build /out/*.tar.gz /
+29 -32
View File
@@ -1,5 +1,8 @@
#!/usr/bin/env sh
APPNAME=$1
DISTPATH=$2
: ${TARGETPLATFORM=}
: ${TARGETOS=}
: ${TARGETARCH=}
@@ -8,15 +11,25 @@
: ${GOARCH=}
: ${GOOS=}
: ${GOARM=}
: ${GOMIPS=}
: ${GOBIN=}
: ${GIT_REF=}
set -eu
if [ ! -z "$TARGETPLATFORM" ]; then
usage() {
echo "usage: $0 <appname> <distpath>"
exit 1
}
if [ -z "$APPNAME" ] || [ -z "$DISTPATH" ]; then
usage
fi
if [ -n "$TARGETPLATFORM" ]; then
os="$(echo $TARGETPLATFORM | cut -d"/" -f1)"
arch="$(echo $TARGETPLATFORM | cut -d"/" -f2)"
if [ ! -z "$os" ] && [ ! -z "$arch" ]; then
if [ -n "$os" ] && [ -n "$arch" ]; then
export GOOS="$os"
export GOARCH="$arch"
if [ "$arch" = "arm" ]; then
@@ -35,16 +48,16 @@ if [ ! -z "$TARGETPLATFORM" ]; then
fi
fi
if [ ! -z "$TARGETOS" ]; then
if [ -n "$TARGETOS" ]; then
export GOOS="$TARGETOS"
fi
if [ ! -z "$TARGETARCH" ]; then
if [ -n "$TARGETARCH" ]; then
export GOARCH="$TARGETARCH"
fi
if [ "$TARGETARCH" = "arm" ]; then
if [ ! -z "$TARGETVARIANT" ]; then
if [ -n "$TARGETVARIANT" ]; then
case "$TARGETVARIANT" in
"v5")
export GOARM="5"
@@ -61,31 +74,12 @@ if [ "$TARGETARCH" = "arm" ]; then
fi
fi
if [ "$CGO_ENABLED" = "1" ]; then
case "$GOARCH" in
"amd64")
export CC="x86_64-linux-gnu-gcc"
;;
"ppc64le")
export CC="powerpc64le-linux-gnu-gcc"
;;
"s390x")
export CC="s390x-linux-gnu-gcc"
;;
"arm64")
export CC="aarch64-linux-gnu-gcc"
;;
"arm")
case "$GOARM" in
"5")
export CC="arm-linux-gnueabi-gcc"
;;
*)
export CC="arm-linux-gnueabihf-gcc"
;;
esac
;;
esac
if case $TARGETARCH in "mips"*) true;; *) false;; esac; then
if [ -n "$TARGETVARIANT" ]; then
export GOMIPS="$TARGETVARIANT"
else
export GOMIPS="hardfloat"
fi
fi
if [ "$GOOS" = "wasi" ]; then
@@ -97,7 +91,8 @@ if [ -z "$GOBIN" ] && [ -n "$GOPATH" ] && [ -n "$GOARCH" ] && [ -n "$GOOS" ]; th
fi
cat > ./.goreleaser.yml <<EOL
dist: /out
project_name: ${APPNAME}
dist: ${DISTPATH}
builds:
-
@@ -112,9 +107,11 @@ builds:
- ${GOARCH}
goarm:
- ${GOARM}
gomips:
- ${GOMIPS}
hooks:
post:
- cp "{{ .Path }}" /usr/local/bin/diun
- cp "{{ .Path }}" /usr/local/bin/${APPNAME}
archives:
-
+1 -1
View File
@@ -5,7 +5,7 @@ FROM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache gcc linux-headers musl-dev
WORKDIR /src
FROM golangci/golangci-lint:v1.27-alpine AS golangci-lint
FROM golangci/golangci-lint:v1.37-alpine AS golangci-lint
FROM base AS lint
RUN --mount=type=bind,target=. \