eintopf.info@v0.13.16/Makefile (about)

     1  .PHONY: help                  ## Show this help
     2  help:
     3  	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/ ##//' | sed -e 's/.PHONY: //'
     4  
     5  .PHONY: all                   ## Download dependencies, build the project and run tests
     6  all: assert-tools download-dependencies build test
     7  
     8  .PHONY: watch
     9  watch:
    10  	go run github.com/cortesi/modd/cmd/modd -f scripts/modd.conf
    11  
    12  .PHONY: run-api-dev           ## Runs the dev api
    13  run-api-dev: eintopf.dev.db
    14  	EINTOPF_SQLITE_DB="eintopf.dev.db" \
    15  	EINTOPF_KILLSWITCH_HASHES="foo" \
    16  	EINTOPF_MEDIA_PATH="test/data/media" \
    17  	EINTOPF_BACKSTAGE_ASSET_PATH="backstage/build" \
    18  	EINTOPF_ADMIN_EMAIL="admin@example.com" \
    19  	EINTOPF_ADMIN_PASSWORD="admin" \
    20  	EINTOPF_AUTH_KEY_PATH="auth-key-dev" \
    21  	EINTOPF_THEMES="themes/eintopf,test/customTheme" \
    22  	EINTOPF_BASE_URL="http://localhost:3333/" \
    23  	EINTOPF_TIMEZONE=Europe/Berlin \
    24  	EINTOPF_HTTP_READ_TIMEOUT=35s \
    25  	EINTOPF_HTTP_HANDLER_TIMEOUT=35s \
    26  	EINTOPF_HTTP_WRITE_TIMEOUT=35s \
    27  	EINTOPF_OSM_TILE_CACHE_DIR=osmcache \
    28  	EINTOPF_OSM_TILE_SERVER="https://tile.openstreetmap.org/{z}/{x}/{y}.png" \
    29  	EINTOPF_DEBUG=true \
    30  	./out/eintopf
    31  
    32  eintopf.dev.db:
    33  	go run test/createDevDB/main.go -dbpath eintopf.dev.db
    34  
    35  .PHONY: clean                 ## Removes all dev artifacts needed to run the dev server
    36  clean:
    37  	rm -rf index.bleve
    38  	rm -f eintopf.dev.db
    39  	rm -f auth-key-dev
    40  	rm -f auth-key-dev.pub
    41  
    42  .PHONY: generate              ## Generate mock stubs and swagger docs
    43  generate:
    44  	rm -rf pkg/mock
    45  	go generate ./...
    46  	sed -i 's/crud.FindFilters/group.FindFilters/g' internal/mock/group_service.go
    47  	sed -i 's/crud.FindFilters/group.FindFilters/g' internal/mock/group_store.go
    48  	sed -i 's/crud.FindFilters/place.FindFilters/g' internal/mock/place_service.go
    49  	sed -i 's/crud.FindFilters/place.FindFilters/g' internal/mock/place_store.go
    50  	sed -i 's/crud.FindFilters/revent.FindFilters/g' internal/mock/revent_service.go
    51  	go run scripts/gen/ts/searchfilter/main.go -modelPath service/eventsearch/eventdocument.yaml -path backstage/src/api/eventsearch_filter.ts
    52  	go run scripts/gen/ts/searchaggregation/main.go -modelPath service/eventsearch/eventdocument.yaml -path backstage/src/api/eventsearch_aggregation.ts
    53  	go run golang.org/x/tools/cmd/goimports@v0.18.0 -w .
    54  
    55  .PHONY: build                 ## Build the backstage and api
    56  build:
    57  	make build-backstage
    58  	make build-api
    59  
    60  .PHONY: build-api             ## Build the api (output is in ./out)
    61  build-api:
    62  	go build -o ./out/eintopf ./cmd/eintopf
    63  
    64  .PHONY: build-backstage             ## Build the backstage (output is in ./backstage/build)
    65  build-backstage:
    66  	cd backstage && yarn run build
    67  
    68  .PHONY: fmt
    69  fmt:
    70  	goimports
    71  	cd backstage && yarn lint --fix
    72  
    73  .PHONY: lint                  ## Run lint tests on the project
    74  lint:
    75  	cd backstage && yarn lint
    76  
    77  .PHONY: test                  ## Run api tests
    78  test: test-api
    79  
    80  .PHONY: test-api             ## Run api and backstage tests
    81  test-api:
    82  	go test -timeout 80s -cover ./...
    83  
    84  .PHONY: test-backstage      ## Run backstage tests
    85  test-backstage:
    86  	cd backstage && yarn run test
    87  
    88  .PHONY: prepare-e2e
    89  prepare-e2e:
    90  	rm -rf test/e2e/vol
    91  	mkdir test/e2e/vol
    92  	go run test/createDevDB/main.go -dbpath test/e2e/vol/eintopf.test.db -relativeTime && chmod 0666 test/e2e/vol/eintopf.test.db
    93  	cd test/e2e/vol && touch recovery_mail.tpl && chmod 0666 recovery_mail.tpl
    94  
    95  .PHONY: test-e2e              ## Run e2e tests using cypress
    96  test-e2e: prepare-e2e
    97  	cd test/e2e && docker-compose up --force-recreate --exit-code-from cypress --build
    98  
    99  .PHONY: test-e2e-i            ## Run e2e tests using cypress interactively
   100  test-e2e-i: prepare-e2e
   101  	cd test/e2e && ./interactive.sh
   102  
   103  TAG ?= latest
   104  
   105  # PLATFORMS = amd64 arm64
   106  .PHONY: image-build           ## Build the docker image locally
   107  image-build:
   108  	docker buildx build --platform=linux/amd64 -f cmd/eintopf/Dockerfile --tag codeberg.org/klasse-methode/eintopf:${TAG} ${EXTRA_ARGS} .
   109  
   110  image-push:                   ## Push the local docker image to codeberg
   111  	docker push codeberg.org/klasse-methode/eintopf:${TAG}
   112  
   113  
   114  .PHONY: download-dependencies ## Downloads api and backstage dependencies
   115  download-dependencies:
   116  	go mod download
   117  	cd backstage && yarn install
   118  
   119  .PHONY: assert-tools          ## Assert that all nececarry tools are installed
   120  assert-tools:
   121  	which go
   122  	which yarn
   123  	which openssl