mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Convert linting to Makefile action. Patch Dockerfile and CI script
This commit is contained in:
parent
a591b33262
commit
c44f738ba8
3 changed files with 33 additions and 14 deletions
|
@ -9,9 +9,8 @@ RUN pacman -Syu --overwrite=* --needed --noconfirm \
|
||||||
gcc gnupg libldap go git tar make awk linux-api-headers pacman-contrib && paccache -rfk0
|
gcc gnupg libldap go git tar make awk linux-api-headers pacman-contrib && paccache -rfk0
|
||||||
|
|
||||||
# Dependency for linting
|
# Dependency for linting
|
||||||
RUN go get -u golang.org/x/lint/golint && mv /root/go/bin/golint /bin/
|
|
||||||
|
|
||||||
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /bin v1.20.0
|
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /bin v1.20.0
|
||||||
|
RUN go get golang.org/x/lint/golint && mv /root/go/bin/golint /bin/
|
||||||
|
|
||||||
ENV ARCH=$BUILD_ARCH
|
ENV ARCH=$BUILD_ARCH
|
||||||
ADD . .
|
ADD . .
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -82,6 +82,11 @@ test-vendor: vendor
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
golangci-lint run
|
||||||
|
golint -set_exit_status . ./pkg/...
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt:
|
fmt:
|
||||||
#go fmt -mod=vendor $(GOFILES) ./... Doesn't work yet but will be supported soon
|
#go fmt -mod=vendor $(GOFILES) ./... Doesn't work yet but will be supported soon
|
||||||
|
|
39
testdata/travis.sh
vendored
39
testdata/travis.sh
vendored
|
@ -1,35 +1,50 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -evx
|
#set -evx
|
||||||
|
|
||||||
# Objective of this script is to be the most vendor agnostic possible
|
# Objective of this script is to be the most vendor agnostic possible
|
||||||
# It builds and tests yay independently of hardware
|
# It builds and tests yay independently of hardware
|
||||||
|
|
||||||
export VERSION=$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
|
VERSION="$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')"
|
||||||
|
export VERSION
|
||||||
export ARCH="x86_64"
|
export ARCH="x86_64"
|
||||||
echo '::set-env name=VERSION::$VERSION'
|
|
||||||
echo '::set-env name=ARCH::$ARCH'
|
|
||||||
|
|
||||||
docker build --build-arg BUILD_ARCH=${ARCH} --target builder_env -t yay-builder_env .
|
docker build --build-arg BUILD_ARCH=${ARCH} --target builder_env -t yay-builder_env . || exit $?
|
||||||
docker build --build-arg BUILD_ARCH=${ARCH} --target builder -t yay-builder .
|
docker build --build-arg BUILD_ARCH=${ARCH} --target builder -t yay-builder . || exit $?
|
||||||
|
|
||||||
# Our unit test and packaging container
|
# Our unit test and packaging container
|
||||||
docker run --name yay-go-tests yay-builder_env:latest make test && golint && golangci-lint run
|
docker run --name yay-go-tests yay-builder_env:latest make test
|
||||||
|
rc=$?
|
||||||
docker rm yay-go-tests
|
docker rm yay-go-tests
|
||||||
|
|
||||||
# docker run yay-builder make lint
|
if [[ $rc != 0 ]]; then
|
||||||
|
exit $rc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lint project
|
||||||
|
docker run --name yay-go-lint yay-builder_env:latest make lint
|
||||||
|
rc=$?
|
||||||
|
docker rm yay-go-lint
|
||||||
|
|
||||||
|
if [[ $rc != 0 ]]; then
|
||||||
|
exit $rc
|
||||||
|
fi
|
||||||
|
|
||||||
# Build image for integration testing
|
# Build image for integration testing
|
||||||
docker build -t yay .
|
# docker build -t yay . || exit $?
|
||||||
|
|
||||||
# Do integration testing
|
# Do integration testing
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
# Create a release asset
|
# Create a release asset
|
||||||
docker run --name artifact_factory yay-builder make release ARCH=${ARCH} VERSION=${VERSION}
|
docker run --name artifact_factory yay-builder make release ARCH=${ARCH} VERSION="${VERSION}"
|
||||||
|
rc=$?
|
||||||
|
if [[ $rc != 0 ]]; then
|
||||||
|
docker rm artifact_factory
|
||||||
|
exit $rc
|
||||||
|
fi
|
||||||
|
|
||||||
# Copy bin and release to artifacts folder
|
# Copy bin and release to artifacts folder
|
||||||
mkdir artifacts
|
mkdir artifacts
|
||||||
docker cp artifact_factory:/app/yay_${VERSION}_${ARCH}.tar.gz ./artifacts/
|
docker cp artifact_factory:/app/yay_"${VERSION}"_${ARCH}.tar.gz ./artifacts/
|
||||||
|
|
||||||
# Cleanup docker
|
# Cleanup docker
|
||||||
docker rm artifact_factory
|
docker rm artifact_factory
|
||||||
|
|
Loading…
Reference in a new issue