Skip to content

Commit

Permalink
admin/ui updates:
Browse files Browse the repository at this point in the history
- updating jquery to 3.6.0
- updating materialize to 1.0.0
- updating material icons to 4.0.0
- adding go generate makefile target
- adding go generate target to build target
- adding admin cleaning target
- removing assets from git, they will be fetched at build
  • Loading branch information
dcarbone committed Dec 24, 2021
1 parent bf654ba commit 9c545f1
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 107 deletions.
40 changes: 38 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,56 @@ all: test

# help prints a help screen
help:
@echo "generate - go generate"
@echo "build - go build"
@echo "install - go install"
@echo "test - go test"
@echo "gofmt - go fmt"
@echo "linux - go build linux/amd64"
@echo "release - tag, build and publish release with goreleaser"
@echo "pkg - build, test and create pkg/fabio.tar.gz"
@echo "clean-adm - remove admin ui assets"
@echo "clean - remove temp files"
@echo "clean-all - execute all clean commands"

# generate executes all go:generate statements
.PHONY: generate
generate: clean-adm
go generate $(GOFLAGS) ./...

# build compiles fabio and the test dependencies
build: gofmt
.PHONY: build
build: generate gofmt
go build $(GOFLAGS)

# test builds and runs the tests
.PHONY: test
test: build
go test $(GOFLAGS) -v -test.timeout 15s ./...

# mod performs go module maintenance
.PHONY: mod
mod:
go mod tidy
go mod vendor

# gofmt runs gofmt on the code
.PHONY: gofmt
gofmt:
gofmt -s -w `find . -type f -name '*.go' | grep -v vendor`

# linux builds a linux binary
.PHONY: linux
linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -tags netgo $(GOFLAGS)

# install runs go install
.PHONY: install
install:
CGO_ENABLED=0 go install -trimpath $(GOFLAGS)

# pkg builds a fabio.tar.gz package with only fabio in it
.PHONY: pkg
pkg: build test
rm -rf pkg
mkdir pkg
Expand All @@ -73,26 +88,31 @@ pkg: build test
#
# Run this in sub-shells instead of dependencies so that
# later targets can pick up the new tag value.
.PHONY: release
release:
$(MAKE) tag
$(MAKE) preflight docker-test gorelease homebrew

# preflight runs some checks before a release
.PHONY: preflight
preflight:
[ "$(CUR_TAG)" == "$(LAST_TAG)" ] || ( echo "master not tagged. Last tag is $(LAST_TAG)" ; exit 1 )
grep -q "$(LAST_TAG)" CHANGELOG.md main.go || ( echo "CHANGELOG.md or main.go not updated. $(LAST_TAG) not found"; exit 1 )

# tag tags the build
.PHONY: tag
tag:
build/tag.sh

# gorelease runs goreleaser to build and publish the artifacts
.PHONY: gorelease
gorelease:
[ -x "$(GORELEASER)" ] || ( echo "goreleaser not installed"; exit 1)
GOVERSION=$(GOVERSION) goreleaser --rm-dist

# homebrew updates the brew recipe since goreleaser can only
# handle taps right now.
.PHONY: homebrew
homebrew:
build/homebrew.sh $(LAST_TAG)

Expand All @@ -102,6 +122,7 @@ homebrew:
# We download the binaries outside the Docker build to
# cache the binaries and prevent repeated downloads since
# ADD <url> downloads the file every time.
.PHONY: docker-test
docker-test:
docker build \
--build-arg consul_version=$(CI_CONSUL_VERSION) \
Expand All @@ -111,6 +132,7 @@ docker-test:
.

# travis runs tests on Travis CI
.PHONY: travis
travis:
wget -q -O ~/consul.zip https://releases.hashicorp.com/consul/$(CI_CONSUL_VERSION)/consul_$(CI_CONSUL_VERSION)_linux_amd64.zip
wget -q -O ~/vault.zip https://releases.hashicorp.com/vault/$(CI_VAULT_VERSION)/vault_$(CI_VAULT_VERSION)_linux_amd64.zip
Expand All @@ -121,13 +143,15 @@ travis:
make test

# travis-pages runs the GitHub pages (https://fabiolb.net/) deploy on Travis CI
.PHONY: travis-pages
travis-pages:
wget -q -O ~/hugo.tgz https://github.com/gohugoio/hugo/releases/download/v$(CI_HUGO_VERSION)/hugo_$(CI_HUGO_VERSION)_Linux-64bit.tar.gz
tar -C ~/bin -zxf ~/hugo.tgz hugo
hugo version
(cd docs && hugo --verbose)

# github runs tests on github actions
.PHONY: github
github:
wget -q -O ~/consul.zip https://releases.hashicorp.com/consul/$(CI_CONSUL_VERSION)/consul_$(CI_CONSUL_VERSION)_linux_amd64.zip
wget -q -O ~/vault.zip https://releases.hashicorp.com/vault/$(CI_VAULT_VERSION)/vault_$(CI_VAULT_VERSION)_linux_amd64.zip
Expand All @@ -138,17 +162,29 @@ github:
make test

# github-pages runs the GitHub pages (https://fabiolb.net/) deploy on github actions
.PHONY: github-pages
github-pages:
wget -q -O ~/hugo.tgz https://github.com/gohugoio/hugo/releases/download/v$(CI_HUGO_VERSION)/hugo_$(CI_HUGO_VERSION)_Linux-64bit.tar.gz
mkdir -p ~/bin
tar -C ~/bin -zxf ~/hugo.tgz hugo
hugo version
(cd docs && hugo --verbose)

# clean-adm cleans up all downloaded assets in admin/ui
.PHONY: clean-adm
clean-adm:
rm -rf admin/ui/assets/cdnjs.cloudflare.com/ajax/libs/materialize
rm -f admin/ui/assets/code.jquery.com/*.js
rm -f admin/ui/assets/fonts/material*
rm -f admin/ui/assets/fonts/Material*

# clean removes intermediate files
.PHONY: clean
clean:
go clean
rm -rf pkg dist fabio
find . -name '*.test' -delete

.PHONY: all help build test mod gofmt linux install pkg release preflight tag gorelease homebrew docker-test travis travis-pages clean
# clean-all executes all "clean*" commands
.PHONY: clean-all
clean-all: clean clean-adm
2 changes: 2 additions & 0 deletions admin/ui/assets/cdnjs.cloudflare.com/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

1 change: 0 additions & 1 deletion admin/ui/assets/cdnjs.cloudflare.com/robots.txt

This file was deleted.

2 changes: 2 additions & 0 deletions admin/ui/assets/code.jquery.com/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 0 additions & 2 deletions admin/ui/assets/code.jquery.com/jquery-3.3.1.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions admin/ui/assets/fonts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Binary file removed admin/ui/assets/fonts/MaterialIcons-Regular.eot
Binary file not shown.
Binary file removed admin/ui/assets/fonts/MaterialIcons-Regular.ttf
Binary file not shown.
Binary file removed admin/ui/assets/fonts/MaterialIcons-Regular.woff
Binary file not shown.
Binary file removed admin/ui/assets/fonts/MaterialIcons-Regular.woff2
Binary file not shown.
36 changes: 0 additions & 36 deletions admin/ui/assets/fonts/material-icons.css

This file was deleted.

8 changes: 4 additions & 4 deletions admin/ui/generate.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ui

//go:generate wget -pP assets https://code.jquery.com/jquery-3.3.1.min.js
//go:generate wget -pP assets https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js
//go:generate wget -pP assets https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css
//go:generate wget -pP assets https://code.jquery.com/jquery-3.6.0.min.js
//go:generate wget -pP assets https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js
//go:generate wget -pP assets https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css

// https://google.github.io/material-design-icons/#setup-method-2-self-hosting
//go:generate wget -nH -nd -pP assets/fonts https://raw.githubusercontent.com/google/material-design-icons/3.0.1/iconfont/MaterialIcons-Regular.ttf
Expand All @@ -11,4 +11,4 @@ package ui
//go:generate wget -nH -nd -pP assets/fonts https://raw.githubusercontent.com/google/material-design-icons/3.0.1/iconfont/MaterialIcons-Regular.woff2
//go:generate wget -nH -nd -pP assets/fonts https://raw.githubusercontent.com/google/material-design-icons/3.0.1/iconfont/material-icons.css

//go:generate go run ../../vendor/github.com/rakyll/statik -f -src assets
//go:generate go run ../../vendor/github.com/rakyll/statik/statik.go -f -src assets
Loading

0 comments on commit 9c545f1

Please sign in to comment.