Browse Source

fix: Remove docker build

Matthias Ladkau 3 months ago
parent
commit
d5d029be3b
4 changed files with 50 additions and 18 deletions
  1. 7 13
      Jenkinsfile
  2. 43 0
      Makefile
  3. 0 2
      go.mod
  4. 0 3
      go.sum

+ 7 - 13
Jenkinsfile

@@ -12,14 +12,9 @@ pipeline {
      * a new product version. The versioning will be according to the rules
      * of “Semantic Versioning” (https://semver.org/).
      *
-     * Building is done using goreleaser (https://goreleaser.com/) for different
-     * platforms.
+     * Building is done using simple make.
      *
-     * Testing produces code coverage badges which can be embedded on other
-     * pages.
-     *
-     * Everything runs in docker containers to ensure isolation of the build
-     * system and to allow painless upgrades.
+     * Testing produces code coverage badges which can be embedded web pages.
      */
 
     stages {
@@ -60,8 +55,7 @@ pipeline {
                     sh 'git fetch --tags'
                 }
 
-                sh 'mkdir -p .cache'
-                sh 'docker run --rm --user $(id -u):$(id -g) -v $PWD/.cache:/.cache -v $PWD:/go/code -w /go/code goreleaser/goreleaser --snapshot --skip-publish --rm-dist'
+                sh '/opt/env-go/bin/env-go make dist'
             }
         }
         stage('Test') {
@@ -74,12 +68,12 @@ pipeline {
 
                 sh """echo '<svg width="88" height="20" xmlns="http://www.w3.org/2000/svg"><g shape-rendering="crispEdges"><path fill="#555" d="M0 0h41v20H0z"/><path fill="#fc1" d="M41 0h40v20H41z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="20.5" y="14">tests</text><text x="60" y="14">fail</text></g></svg>' > test_result.svg"""
 
-                sh 'docker run --rm -e GOPATH=/tmp -v $PWD:/go golang go test -p 1 --coverprofile=coverage.out ./...'
-                sh 'docker run --rm -e GOPATH=/tmp -v $PWD:/go golang go tool cover --html=coverage.out -o coverage.html'
+                sh 'CGO_ENABLED=0 /opt/env-go/bin/env-go go test -p 1 --coverprofile=coverage.out ./...'
+                sh '/opt/env-go/bin/env-go go tool cover --html=coverage.out -o coverage.html'
 
                 echo 'Determine overall coverage and writing badge'
                 script {
-                  coverage = sh(returnStdout: true, script: 'docker run --rm -e GOPATH=/tmp -v $PWD:/go golang go tool cover -func=coverage.out | tee coverage.txt | tail -1 | grep -o "[0-9]*.[0-9]*%$" | tr -d "\\n"')
+                  coverage = sh(returnStdout: true, script: '/opt/env-go/bin/env-go go tool cover -func=coverage.out | tee coverage.txt | tail -1 | grep -o "[0-9]*.[0-9]*%$" | tr -d "\\n"')
 
                   echo "Overall coverage is: ${coverage}"
 
@@ -105,7 +99,7 @@ pipeline {
                 sshagent (credentials: ['Gogs']) {
                     sh 'git fetch --tags'
                 }
-                sh 'docker run --rm -v $PWD:/app standard-version'
+                sh 'standard-version'
 
                 // The new version is inserted into the code
                 //

+ 43 - 0
Makefile

@@ -0,0 +1,43 @@
+export NAME=rufs
+export TAG=`git describe --abbrev=0 --tags`
+export CGO_ENABLED=0
+export GOOS=linux
+
+all: build
+clean:
+	rm -f rufs
+
+mod:
+	go mod init || true
+	go mod tidy
+test:
+	go test -p 1 ./...
+
+fmt:
+	gofmt -l -w -s .
+
+vet:
+	go vet ./...
+
+build: clean mod fmt vet
+	go build -o $(NAME) ./cli/...
+
+build-win: clean mod fmt vet
+	GOOS=windows GOARCH=amd64 go build -o $(NAME).exe ./cli/...
+
+dist: build build-win
+	rm -fR dist
+
+	mkdir -p dist/$(NAME)_linux_amd64
+	mv $(NAME) dist/$(NAME)_linux_amd64
+	cp LICENSE dist/$(NAME)_linux_amd64
+	cp NOTICE dist/$(NAME)_linux_amd64
+	tar --directory=dist -cz $(NAME)_linux_amd64 > dist/$(NAME)_$(TAG)_linux_amd64.tar.gz
+
+	mkdir -p dist/$(NAME)_windows_amd64
+	mv $(NAME).exe dist/$(NAME)_windows_amd64
+	cp LICENSE dist/$(NAME)_windows_amd64
+	cp NOTICE dist/$(NAME)_windows_amd64
+	tar --directory=dist -cz $(NAME)_windows_amd64 > dist/$(NAME)_$(TAG)_windows_amd64.tar.gz
+
+	sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt

+ 0 - 2
go.mod

@@ -4,8 +4,6 @@ go 1.12
 
 require (
 	devt.de/krotik/common v1.1.0
-	github.com/hanwen/go-fuse v1.0.0
 	github.com/hanwen/go-fuse/v2 v2.0.2
-	github.com/kylelemons/godebug v1.1.0 // indirect
 	golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24 // indirect
 )

+ 0 - 3
go.sum

@@ -1,5 +1,3 @@
-devt.de/krotik/common v1.0.0 h1:nMmFFkjqb8C/oFVfsEi39qnCUbu3J1FXg+FZn5gSOQU=
-devt.de/krotik/common v1.0.0/go.mod h1:X4nsS85DAxyHkwSg/Tc6+XC2zfmGeaVz+37F61+eSaI=
 devt.de/krotik/common v1.1.0 h1:8xNZ2CwGWon6PqpWHwPhYMnkEOIiIPwdCgGoJCMyj6o=
 devt.de/krotik/common v1.1.0/go.mod h1:X4nsS85DAxyHkwSg/Tc6+XC2zfmGeaVz+37F61+eSaI=
 github.com/hanwen/go-fuse v1.0.0 h1:GxS9Zrn6c35/BnfiVsZVWmsG803xwE7eVRDvcf/BEVc=
@@ -7,7 +5,6 @@ github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFi
 github.com/hanwen/go-fuse/v2 v2.0.2 h1:BtsqKI5RXOqDMnTgpCb0IWgvRgGLJdqYVZ/Hm6KgKto=
 github.com/hanwen/go-fuse/v2 v2.0.2/go.mod h1:HH3ygZOoyRbP9y2q7y3+JM6hPL+Epe29IbWaS0UA81o=
 github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
-github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE=
 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24 h1:R8bzl0244nw47n1xKs1MUMAaTNgjavKcN/aX2Ss3+Fo=