Add two new mage commands:
- `mage format`: run `gofmt` on all the Go sources.
- `mage formatCheck`: run the formatter to check formatting issues. This
will output the diff to make the code format-compliant.
These commands are also available via `make format` resp. `make
format-check`.
Convert most of the code in `Makefile` to [Magefile](https://magefile.org/):
This makes it possible to build Flamenco without `make` (and the POSIX environment/commands it expect) by running:
```bash
$ go run mage.go webappInstallDeps # Only on the first build.
$ go run mage.go build
```
More efficient builds are possible with other commands, and some release-related commands still require `make`. At least the barrier to entry should be considerably lower (compared to having to install Make + Cygwin/MSYS2 on Windows).
Fix: #102633
This does not port the building of release packages, so it doesn't address #102671.
### Main Targets
| Target | Description |
|----------|---------------------------------------------------------------------------------|
| build | Build Flamenco Manager and Flamenco Worker, including the webapp and the add-on |
| check | Run unit tests, check for vulnerabilities, and run the linter |
| clean | Remove executables and other build output |
| generate | Generate code (OpenAPI and test mocks) |
### All Targets
Get these via `go run mage.go -l`:
```
Targets:
build Flamenco Manager and Flamenco Worker, including the webapp and the add-on
check Run unit tests, check for vulnerabilities, and run the linter
clean Remove executables and other build output
flamencoManager Build Flamenco Manager with the webapp and add-on ZIP embedded
flamencoManagerWithoutWebapp Only build the Flamenco Manager executable, do not rebuild the webapp
flamencoWorker Build the Flamenco Worker executable
generate code (OpenAPI and test mocks)
generateGo Generate Go code for Flamenco Manager and Worker
generateJS Generate JavaScript code for the webapp
generatePy Generate Python code for the add-on
govulncheck Check for known vulnerabilities.
staticcheck Analyse the source code.
test Run unit tests
version Show which version information would be embedded in executables
vet Run `go vet`
webappInstallDeps Use Yarn to install the webapp's NodeJS dependencies
webappStatic Build the webapp as static files that can be served
```
Co-authored-by: Mateus Abelli <mateusabelli@gmail.com>
Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104341
This reverts commit 44ffb09d7daa0e2a8c55750ef5da187a527f6478. Building
the extended version of Hugo requires CGo, which I don't want to have as
a build-time dependency for any part of Flamenco. So, unfortunately, no
WebP support.
Pass `-failfast` to the `go test` command, so that it immediately stops
on test failure. This prevents the need to scroll back to see the actual
error, at the expense of only seeing one failure at a time.
Add `MSYS2_ARG_CONV_EXCL="*"` to avoid MSYS2 changing the yarn build
`--base=/app/` argument. That's a URL path, not a filesystem path, and it
should be used as-is on every platform.
Replace GORM's auto-migration with Goose. The latter uses hand-written
SQL queries to apply database schema changes, which is safer and easier to
understand than what GORM is doing.
Add a bit more documentation about the lack of ffmpeg on macOS/arm64 builds
and include a text file in the download package for that platform to
signal where any ffmpeg binary should be placed.
These aren't linked from the download page yet, as they are missing an
FFmpeg binary. Still, having this build here at least allows people to
download it and put in their own (or configure that particular worker to
not run ffmpeg tasks).
These packages will not include FFmpeg at the moment, as there doesn't
seem to be a version that's built for that architecture and linked from
ffmpeg.org as an "officially approved" binary.
Add `make` targets `devserver-webapp` and `devserver-website` to run
respectively Yarn and Hugo.
This also slightly changes how Hugo is invoked, from using the `hugo` CLI
command to `go run github.com/gohugoio/hugo@v0.101.0`. This avoids the
need to actually install Hugo locally, and also will use the correct
version of Hugo if the locally-installed version happens to be different.