6 Commits

Author SHA1 Message Date
cnbattle f44600c18f del darwin 2022-10-31 13:50:19 +08:00
cnbattle 9b4ed9f580 del arm 2022-10-31 13:45:12 +08:00
cnbattle e431ebc97e U dockerfile 2022-10-29 11:03:45 +08:00
cnbattle a86f39abbb U golang to 1.19 2022-10-29 10:51:42 +08:00
cnbattle f34695b6ae U upx to v4.0.0 2022-10-29 10:42:58 +08:00
cnbattle ff652546da add Docker Pulls 2020-06-26 18:02:50 +08:00
13 changed files with 51 additions and 146 deletions
+12 -98
View File
@@ -9,7 +9,7 @@ platform:
steps: steps:
- name: vet - name: vet
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- make vet - make vet
volumes: volumes:
@@ -18,7 +18,7 @@ steps:
- name: lint - name: lint
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- make lint - make lint
volumes: volumes:
@@ -27,7 +27,7 @@ steps:
- name: misspell - name: misspell
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- make misspell-check - make misspell-check
volumes: volumes:
@@ -36,7 +36,7 @@ steps:
- name: test - name: test
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- make test - make test
volumes: volumes:
@@ -58,7 +58,7 @@ platform:
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-upx-original" - "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-upx-original"
environment: environment:
@@ -70,7 +70,7 @@ steps:
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-upx-original" - "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-upx-original"
environment: environment:
@@ -88,7 +88,7 @@ steps:
- name: executable - name: executable
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- ./release/linux/amd64/drone-upx --help - ./release/linux/amd64/drone-upx --help
@@ -133,6 +133,7 @@ trigger:
depends_on: depends_on:
- testing - testing
--- ---
kind: pipeline kind: pipeline
name: linux-arm64 name: linux-arm64
@@ -144,7 +145,7 @@ platform:
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-upx-original" - "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-upx-original"
environment: environment:
@@ -156,7 +157,7 @@ steps:
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-upx-original" - "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-upx-original"
environment: environment:
@@ -174,7 +175,7 @@ steps:
- name: executable - name: executable
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- ./release/linux/arm64/drone-upx --help - ./release/linux/arm64/drone-upx --help
@@ -219,92 +220,6 @@ trigger:
depends_on: depends_on:
- testing - testing
---
kind: pipeline
name: linux-arm
platform:
os: linux
arch: arm
steps:
- name: build-push
pull: always
image: golang:1.14
commands:
- "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-upx-original"
environment:
CGO_ENABLED: 0
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.14
commands:
- "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-upx-original"
environment:
CGO_ENABLED: 0
when:
event:
- tag
- name : upx
image: cnbattle/drone-upx
settings:
level: 9
save_file: ./release/linux/arm/drone-upx
original_file: ./release/linux/arm/drone-upx-original
- name: executable
pull: always
image: golang:1.14
commands:
- ./release/linux/arm/drone-upx --help
- name: dryrun
pull: always
image: plugins/docker:linux-arm
settings:
cache_from: cnbattle/drone-upx
dockerfile: docker/Dockerfile.linux.arm
dry_run: true
repo: cnbattle/drone-upx
tags: linux-arm
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm
settings:
auto_tag: true
auto_tag_suffix: linux-arm
cache_from: cnbattle/drone-upx
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: cnbattle/drone-upx
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/pull/**"
- "refs/tags/**"
depends_on:
- testing
--- ---
kind: pipeline kind: pipeline
name: release-binary name: release-binary
@@ -316,7 +231,7 @@ platform:
steps: steps:
- name: build-all-binary - name: build-all-binary
pull: always pull: always
image: golang:1.14 image: golang:1.19
commands: commands:
- make release - make release
when: when:
@@ -370,7 +285,6 @@ trigger:
depends_on: depends_on:
- linux-amd64 - linux-amd64
- linux-arm64 - linux-arm64
- linux-arm
- release-binary - release-binary
... ...
+3 -2
View File
@@ -1,7 +1,8 @@
FROM alpine FROM alpine
ADD https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz /usr/local RUN apk add --no-cache ca-certificates xz && rm -rf /var/cache/apk/*
RUN xz -d -c /usr/local/upx-3.96-amd64_linux.tar.xz | tar -xOf - upx-3.96-amd64_linux/upx > /bin/upx && \ ADD https://github.com/upx/upx/releases/download/v4.0.0/upx-4.0.0-amd64_linux.tar.xz /usr/local
RUN xz -d -c /usr/local/upx-4.0.0-amd64_linux.tar.xz | tar -xOf - upx-4.0.0-amd64_linux/upx > /bin/upx && \
chmod a+x /bin/upx chmod a+x /bin/upx
ADD release/linux/amd64/drone-upx /bin/ ADD release/linux/amd64/drone-upx /bin/
+5 -5
View File
@@ -7,7 +7,7 @@ GO ?= go
DEPLOY_ACCOUNT := cnbattle DEPLOY_ACCOUNT := cnbattle
DEPLOY_IMAGE := $(EXECUTABLE) DEPLOY_IMAGE := $(EXECUTABLE)
TARGETS ?= linux darwin windows TARGETS ?= linux windows
ARCHS ?= amd64 386 ARCHS ?= amd64 386
SOURCES ?= $(shell find . -name "*.go" -type f) SOURCES ?= $(shell find . -name "*.go" -type f)
TAGS ?= TAGS ?=
@@ -35,21 +35,21 @@ vet:
lint: lint:
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mgechev/revive; \ $(GO) install github.com/mgechev/revive@latest; \
fi fi
revive -config .revive.toml ./... || exit 1 revive -config .revive.toml ./... || exit 1
.PHONY: misspell-check .PHONY: misspell-check
misspell-check: misspell-check:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \ $(GO) install github.com/client9/misspell/cmd/misspell@latest; \
fi fi
misspell -error $(SOURCES) misspell -error $(SOURCES)
.PHONY: misspell .PHONY: misspell
misspell: misspell:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \ $(GO) install github.com/client9/misspell/cmd/misspell@latest; \
fi fi
misspell -w $(SOURCES) misspell -w $(SOURCES)
@@ -80,7 +80,7 @@ release-dirs:
release-build: release-build:
@which gox > /dev/null; if [ $$? -ne 0 ]; then \ @which gox > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mitchellh/gox; \ $(GO) install github.com/mitchellh/gox@latest; \
fi fi
gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}" gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"
+3 -2
View File
@@ -1,10 +1,11 @@
# drone-upx # drone-upx
[![Build Status](https://cloud.drone.io/api/badges/cnbattle/drone-upx/status.svg)](https://cloud.drone.io/cnbattle/drone-upx) [![Build Status](https://cloud.drone.io/api/badges/cnbattle/drone-upx/status.svg)](https://cloud.drone.io/cnbattle/drone-upx)
[![LINK](https://img.shields.io/badge/link-Github-%23FF4D5B.svg?style=flat-square)](https://github.com/cnbattle/drone-upx) [![LINK](https://img.shields.io/badge/link-Github-%23FF4D5B.svg)](https://github.com/cnbattle/drone-upx)
[![Go Report Card](https://goreportcard.com/badge/github.com/cnbattle/drone-upx)](https://goreportcard.com/report/github.com/cnbattle/drone-upx) [![Go Report Card](https://goreportcard.com/badge/github.com/cnbattle/drone-upx)](https://goreportcard.com/report/github.com/cnbattle/drone-upx)
[![Docker Pulls](https://img.shields.io/docker/pulls/cnbattle/drone-upx.svg)](https://img.shields.io/docker/pulls/cnbattle/drone-upx.svg)
[![GoDoc](https://godoc.org/github.com/cnbattle/drone-upx?status.svg)](https://godoc.org/github.com/cnbattle/drone-upx) [![GoDoc](https://godoc.org/github.com/cnbattle/drone-upx?status.svg)](https://godoc.org/github.com/cnbattle/drone-upx)
[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg?style=flat-square)](https://github.com/996icu/996.ICU/blob/master/LICENSE) [![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE)
## Use ## Use
``` ```
+1
View File
@@ -1,3 +1,4 @@
// Package cmd cmd
package cmd package cmd
import ( import (
+4 -5
View File
@@ -1,11 +1,10 @@
FROM plugins/base:linux-amd64 FROM plugins/base:linux-amd64
ADD https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz /usr/local RUN apk add --no-cache ca-certificates xz && rm -rf /var/cache/apk/*
RUN xz -d -c /usr/local/upx-3.96-amd64_linux.tar.xz | tar -xOf - upx-3.96-amd64_linux/upx > /bin/upx && \ ADD https://github.com/upx/upx/releases/download/v4.0.0/upx-4.0.0-amd64_linux.tar.xz /usr/local
RUN xz -d -c /usr/local/upx-4.0.0-amd64_linux.tar.xz | tar -xOf - upx-4.0.0-amd64_linux/upx > /bin/upx && \
chmod a+x /bin/upx chmod a+x /bin/upx
RUN apk add --no-cache ca-certificates && \
rm -rf /var/cache/apk/*
COPY release/linux/amd64/drone-upx /bin/ COPY release/linux/amd64/drone-upx /bin/
ENTRYPOINT ["/bin/drone-upx"] ENTRYPOINT ["/bin/drone-upx"]
-11
View File
@@ -1,11 +0,0 @@
FROM plugins/base:linux-arm
ADD https://github.com/upx/upx/releases/download/v3.96/upx-3.96-arm_linux.tar.xz /usr/local
RUN xz -d -c /usr/local/upx-3.96-arm_linux.tar.xz | tar -xOf - upx-3.96-arm_linux/upx > /bin/upx && \
chmod a+x /bin/upx
RUN apk add --no-cache ca-certificates && \
rm -rf /var/cache/apk/*
COPY release/linux/arm/drone-upx /bin/
ENTRYPOINT ["/bin/drone-upx"]
+4 -5
View File
@@ -1,11 +1,10 @@
FROM plugins/base:linux-arm64 FROM plugins/base:linux-arm64
ADD https://github.com/upx/upx/releases/download/v3.96/upx-3.96-arm64_linux.tar.xz /usr/local RUN apk add --no-cache ca-certificates xz && rm -rf /var/cache/apk/*
RUN xz -d -c /usr/local/upx-3.96-arm64_linux.tar.xz | tar -xOf - upx-3.96-arm64_linux/upx > /bin/upx && \ ADD https://github.com/upx/upx/releases/download/v4.0.0/upx-4.0.0-arm64_linux.tar.xz /usr/local
RUN xz -d -c /usr/local/upx-4.0.0-arm64_linux.tar.xz | tar -xOf - upx-4.0.0-arm64_linux/upx > /bin/upx && \
chmod a+x /bin/upx chmod a+x /bin/upx
RUN apk add --no-cache ca-certificates && \
rm -rf /var/cache/apk/*
COPY release/linux/arm64/drone-upx /bin/ COPY release/linux/arm64/drone-upx /bin/
ENTRYPOINT ["/bin/drone-upx"] ENTRYPOINT ["/bin/drone-upx"]
-9
View File
@@ -1,9 +0,0 @@
FROM microsoft/nanoserver:10.0.14393.1884
ADD https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz /usr/local
RUN xz -d -c /usr/local/upx-3.96-amd64_linux.tar.xz | tar -xOf - upx-3.96-amd64_linux/upx > /bin/upx && \
chmod a+x /bin/upx
COPY drone-upx.exe /drone-upx.exe
ENTRYPOINT [ "\\drone-upx.exe" ]
-6
View File
@@ -17,9 +17,3 @@ manifests:
architecture: arm64 architecture: arm64
os: linux os: linux
variant: v8 variant: v8
-
image: cnbattle/drone-upx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
+3 -1
View File
@@ -1,11 +1,13 @@
// Package cmd main
package main package main
import ( import (
"errors" "errors"
"github.com/cnbattle/drone-upx/cmd"
"log" "log"
"os" "os"
"github.com/cnbattle/drone-upx/cmd"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
+8 -2
View File
@@ -1,5 +1,11 @@
module github.com/cnbattle/drone-upx module github.com/cnbattle/drone-upx
go 1.13 go 1.19
require github.com/urfave/cli/v2 v2.2.0 require github.com/urfave/cli/v2 v2.20.3
require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
)
+8
View File
@@ -0,0 +1,8 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/urfave/cli/v2 v2.20.3 h1:lOgGidH/N5loaigd9HjFsOIhXSTrzl7tBpHswZ428w4=
github.com/urfave/cli/v2 v2.20.3/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=