Build with Magefile #104341

Merged
Sybren A. Stüvel merged 26 commits from magefile into main 2024-10-04 21:59:46 +02:00

Convert most of the code in Makefile to Magefile:

This makes it possible to build Flamenco without make (and the POSIX environment/commands it expect) by running:

$ 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
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 ```
Sybren A. Stüvel added 17 commits 2024-10-01 22:59:57 +02:00
Work in progress to replace the `Makefile` buildchain with
[Magefile](https://magefile.org/).
Generating Go code works, JS/Py not yet implemented.
# Conflicts:
#	go.mod
#	go.sum
Merge `origin/main` into `magefile`

Reviewed-on: #104308
Reviewed-by: Sybren A. Stüvel <sybren@blender.org>
This reverts commit b69640912d. That
should have been a branch merge, not a regular commit.
Instead of running govulncheck and staticcheck as different processes,
use them as Go library and call them directly.

This does require my staticcheck PR [#1597][1597], which has landed in
their `main` branch and should be part of the next release.

[1597]: https://github.com/dominikh/go-tools/pull/1597
Do not update the website via `make update-website`. Which version of
Flamenco is published on the website is managed manually, independently of
the version in the Git repo.
With the invocations via Mage, these aren't necessary.

This also removes the as-of-yet unused go-winres dependency.
Sybren A. Stüvel added 1 commit 2024-10-01 23:04:44 +02:00
Sybren A. Stüvel added 1 commit 2024-10-01 23:14:15 +02:00
Sybren A. Stüvel added 2 commits 2024-10-01 23:31:51 +02:00
Sybren A. Stüvel added 1 commit 2024-10-02 11:41:31 +02:00
Add a target that uses Yarn to install the NodeJS dependencies.
Sybren A. Stüvel changed title from Build with Magefile to WIP: Build with Magefile 2024-10-02 14:15:34 +02:00
Sybren A. Stüvel changed title from WIP: Build with Magefile to Build with Magefile 2024-10-02 14:28:37 +02:00
Sybren A. Stüvel added 2 commits 2024-10-03 20:29:48 +02:00
Sybren A. Stüvel added 5 commits 2024-10-03 21:15:27 +02:00
When finding Blender, Flamenco should be able to find it in platform-
specific default locations. This is mostly used for macOS, where Blender
is typically installed in `/Applications/Blender.app`.
On macOS, automatically find Blender when it is installed in the default
installation directory (`/Applications/Blender.app`)
Sybren A. Stüvel force-pushed magefile from b3b452dee5 to 9c5b32280c 2024-10-03 21:16:42 +02:00 Compare
Sybren A. Stüvel merged commit 5f37bcb629 into main 2024-10-04 21:59:46 +02:00
Sybren A. Stüvel deleted branch magefile 2024-10-04 21:59:47 +02:00
Sign in to join this conversation.
No description provided.