feat: don't compare pcmt.css in ci
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
* unstage pcmt.css, needs to be built separately * generate the stylesheet in ci and build the app with that * add better instructions to readme on how to build the app * add more justfile targets for convenience
This commit is contained in:
parent
ae5c4f1dd4
commit
ef6ef17715
36
.drone.yml
36
.drone.yml
@ -41,26 +41,16 @@ steps:
|
||||
# run Go mod tidy prior to committing
|
||||
- test -z "$(git diff-index HEAD :^package-lock.json)"
|
||||
|
||||
- name: frontend
|
||||
- name: go build
|
||||
image: docker.io/immawanderer/archlinux-go:linux-amd64
|
||||
depends_on: [pull]
|
||||
depends_on: [go mod tidy]
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
commands:
|
||||
- pacman -Sy && pacman -S --noconfirm --needed npm
|
||||
- npm i
|
||||
- npx tailwindcss -i ./assets/input/css/tailwind.css -o ./tmp/pcmt.css --minify
|
||||
# ignore whitespace changes.
|
||||
- diff -Nsb ./assets/public/css/pcmt.css ./tmp/pcmt.css || ( echo files differ; exit 1 )
|
||||
|
||||
- name: go build
|
||||
image: docker.io/immawanderer/archlinux-go:linux-amd64
|
||||
depends_on: [go mod tidy, frontend]
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
commands:
|
||||
# generate frontend assets
|
||||
- go generate -v .
|
||||
- go build -v .
|
||||
|
||||
- name: go test
|
||||
@ -115,26 +105,16 @@ steps:
|
||||
# run Go mod tidy prior to committing
|
||||
- test -z "$(git diff-index HEAD :^package-lock.json)"
|
||||
|
||||
- name: frontend
|
||||
- name: go build
|
||||
image: docker.io/library/golang:1.20.4-alpine3.17
|
||||
depends_on: [pull]
|
||||
depends_on: [go mod tidy]
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
commands:
|
||||
- apk update -q && apk add -q --no-cache npm
|
||||
- npm i
|
||||
- npx tailwindcss -i ./assets/input/css/tailwind.css -o ./tmp/pcmt.css --minify
|
||||
# ignore whitespace changes.
|
||||
- diff -Nsb ./assets/public/css/pcmt.css ./tmp/pcmt.css || ( echo files differ; exit 1 )
|
||||
|
||||
- name: go build
|
||||
image: docker.io/library/golang:1.20.4-alpine3.17
|
||||
depends_on: [go mod tidy, frontend]
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
commands:
|
||||
# generate frontend assets
|
||||
- go generate -v .
|
||||
- go build -v .
|
||||
|
||||
- name: go test
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,8 @@
|
||||
# main binary
|
||||
pcmt
|
||||
|
||||
/assets/public/css/pcmt.css
|
||||
|
||||
# dev config.
|
||||
/config.dhall
|
||||
|
||||
|
37
README.md
37
README.md
@ -92,6 +92,43 @@ config](exampleConfig.dhall).
|
||||
If you're new to Dhall, its [documentation](https://docs.dhall-lang.org/) page
|
||||
is a good resource to start at.
|
||||
|
||||
### 🔨 Building from sources
|
||||
|
||||
pre-requisites:
|
||||
* [`just`](https://github.com/casey/just)
|
||||
* [`npm`](https://docs.npmjs.com/cli/v9/)
|
||||
* [`go1.20`](https://go.dev/)
|
||||
* `git`
|
||||
|
||||
the application consists of *frontend* and *backend*. the *frontend* is
|
||||
basically a **generated** TailwindCSS stylesheet and it is not shipped as part
|
||||
of the development process. as such, it needs to be built from sources, same as
|
||||
the backend.
|
||||
|
||||
**step 0:** clone this repository with `git`
|
||||
|
||||
then build the *frontend* using `just tw` or `just frontend`
|
||||
|
||||
next, build the Go application using:
|
||||
```sh
|
||||
# debugging version.
|
||||
just build
|
||||
|
||||
# or with debugging information stripped.
|
||||
just buildrelease
|
||||
```
|
||||
|
||||
alternatively, build both *frontend* and *backend* in release modes using:
|
||||
`just prod`. the order of the steps is important as the application embeds the
|
||||
generated stylesheet.
|
||||
|
||||
if you plan to run the application in `LiveMode`, the stylesheet can be
|
||||
supplied when running the application; however, the binary will lack the way to
|
||||
fall back to the embedded asset so bear that in mind.
|
||||
|
||||
if you're curious, you can open the [`justfile`](justfile) to see the details
|
||||
of the build targets like `tw` and `buildrelease` used above.
|
||||
|
||||
|
||||
### LICENSE
|
||||
AGPL-3.0-only (see [LICENSE](LICENSE) for details).
|
||||
|
0
assets/public/css/.do-not-delete
Normal file
0
assets/public/css/.do-not-delete
Normal file
File diff suppressed because one or more lines are too long
15
justfile
15
justfile
@ -28,11 +28,22 @@ tw:
|
||||
npm i
|
||||
npx tailwindcss -i ./assets/input/css/tailwind.css -o ./assets/public/css/pcmt.css --minify
|
||||
|
||||
# build the application.
|
||||
# alias for tw.
|
||||
frontend: tw
|
||||
|
||||
# build the application with debugging information.
|
||||
build:
|
||||
go mod tidy
|
||||
go build -v -ldflags="-X main.version=$(git rev-parse --short HEAD)" .
|
||||
|
||||
# alias for build.
|
||||
builddebug: build
|
||||
|
||||
# build the application without debugging information.
|
||||
buildrelease:
|
||||
go mod tidy
|
||||
go build -v -trimpaths -ldflags="-s -w -X main.version=$(git rev-parse --short HEAD)" .
|
||||
|
||||
# run the application.
|
||||
run:
|
||||
./pcmt -devel
|
||||
@ -41,7 +52,7 @@ run:
|
||||
dev: build run
|
||||
|
||||
# prepare the app for production.
|
||||
prod: tw build
|
||||
prod: tw buildrelease
|
||||
|
||||
# generate code based on ent schemas.
|
||||
gen:
|
||||
|
Loading…
Reference in New Issue
Block a user