# https://taskfile.dev #Called by the vnbuild system to produce builds for my website #https://www.vaughnnugent.com/resources/software version: "3" vars: BUILDS_URL: https://www.vaughnnugent.com/public/resources/software/builds SQLITE_OUT_DIR: "plugins/assets/VNLib.Plugins.Extensions.Loading.Sql.SQLite" WEBSERVER_VERSION: 'a54c9d0da36ee15b5a1b6852b843bc0a40694ce5' includes: install: taskfile: install.taskfile.yaml plugins: taskfile: plugins.taskfile.yaml container: dir: container #always run from the container directory taskfile: container/Taskfile.yaml vars: BUILDS_URL: '{{.BUILDS_URL}}' PACKAGE_FILE_NAME: "sb-alpine3.19-oci.tgz" #the name of the output package file tasks: build: cmds: #clean out dist dir before building - cmd: powershell -Command "rm -Recurse -Force ./dist" ignore_error: true - cmd: powershell -Command "mkdir lib -Force" ignore_error: true - task: plugins:all #remove runtime-shared libs before they are copied - task: prune-plugin-libs - task: install-webserver #runtimes must be pruned for specific targets - task: prune-runtimes #run container build last - task: container:build install-webserver: cmds: - cmd : powershell -Command "mkdir webserver -Force" ignore_error: true #clone the webserver (it's cross platform when using dotnet command so just grab the linux version) - task: install:install vars: PROJECT_NAME: 'VNLib.Webserver' MODULE_NAME: "VNLib.Webserver" FILE_NAME: "linux-x64-release.tgz" DIR: 'webserver/' VERSION: '{{.WEBSERVER_VERSION}}' #remove the executable since its not needed - cmd: cd webserver/ && powershell -Command "rm VNlib.WebServer" - task: parallel-envs parallel-envs: deps: - task: create-env vars: { TARGET_OS: 'windows-x86_64' } - task: create-env vars: { TARGET_OS: 'linux-x86_64' } - task: create-env vars: { TARGET_OS: 'osx-x86_64' } - task: create-env vars: { TARGET_OS: 'windows-arm' } - task: create-env vars: { TARGET_OS: 'linux-arm' } - task: create-env vars: { TARGET_OS: 'osx-arm' } postbuild_success: cmds: - cmd: powershell -Command "mkdir bin -Force" - task: pb-parallel #cleanup unnecessary build files that clog up the pipeline - for: [ build, plugins, dist, lib, webserver ] cmd: powershell -Command "rm -Recurse '{{.ITEM}}'" ignore_error: true - task: container:postbuild_success pb-parallel: internal: true deps: - task: pack vars: { TARGET_OS: 'windows-x86_64' } - task: pack vars: { TARGET_OS: 'linux-x86_64' } - task: pack vars: { TARGET_OS: 'osx-x86_64' } - task: pack vars: { TARGET_OS: 'windows-arm' } - task: pack vars: { TARGET_OS: 'linux-arm' } - task: pack vars: { TARGET_OS: 'osx-arm' } cmds: - echo "Packing complete" create-env: vars: BUILD_DIR: './build/{{.TARGET_OS}}' cmds: #create dir for env - cmd: powershell -Command "mkdir {{.BUILD_DIR}} -Force" ignore_error: true #copy build files for target os - for: [ plugins, dist, lib, config, webserver ] cmd: powershell -Command "cp -Recurse -Force {{.ITEM}} {{.BUILD_DIR}}" #copy release taskfile and rename it - cmd: powershell -Command "cp -Force release.taskfile.yaml {{.BUILD_DIR}}/Taskfile.yaml" pack: internal: true cmds: - cmd: powershell -Command "mkdir build/{{.TARGET_OS}}/ -Force" ignore_error: true - cd build/{{.TARGET_OS}} && tar -czf ../../bin/{{.TARGET_OS}}-release.tgz . prune-plugin-libs: cmds: - for: ['vnlib.utils.dll' , 'vnlib.net.http.dll', 'VNLib.Hashing.Portable.dll', 'VNLib.Plugins.Essentials.dll', 'VNLib.Plugins.dll', 'Serilog.dll', 'Serilog.Sinks.Console.dll', 'Serilog.Sinks.File.dll'] cmd: cd plugins && powershell 'Get-ChildItem -Path . -Recurse -File -Filter "{{.ITEM}}" | Remove-Item -Force' prune-runtimes: deps: #prune sqlite runtime native libraries that Im not targeting #windows - task: prune-files vars: ITEMS: 'browser-wasm,linux-arm,linux-arm64,linux-armel,linux-mips64,linux-musl-arm,linux-musl-arm64,linux-musl-x64,linux-ppc64le,linux-s390x,linux-x64,linux-x86,maccatalyst-arm64,maccatalyst-x64,osx-arm64,osx-x64,win-arm,win-arm64' DIR: 'windows-x86_64' #windows arm - task: prune-files vars: ITEMS: 'browser-wasm,linux-arm,linux-arm64,linux-armel,linux-mips64,linux-musl-arm,linux-musl-arm64,linux-musl-x64,linux-ppc64le,linux-s390x,linux-x64,linux-x86,maccatalyst-arm64,maccatalyst-x64,osx-arm64,osx-x64,win-x86,win-x64' DIR: 'windows-arm' #linux x64 - task: prune-files vars: ITEMS: 'browser-wasm,linux-arm,linux-arm64,linux-armel,linux-musl-arm,linux-musl-arm64,maccatalyst-arm64,maccatalyst-x64,osx-arm64,osx-x64,win-arm,win-arm64,win-x86,win-x64' DIR: 'linux-x86_64' #linux arm - task: prune-files vars: ITEMS: 'browser-wasm,linux-mips64,linux-musl-x64,linux-ppc64le,linux-s390x,linux-x64,linux-x86,maccatalyst-arm64,maccatalyst-x64,osx-arm64,osx-x64,win-arm,win-arm64,win-x86,win-x64' DIR: 'linux-arm' #osx x64 - task: prune-files vars: ITEMS: 'browser-wasm,linux-arm,linux-arm64,linux-armel,linux-mips64,linux-musl-arm,linux-musl-arm64,linux-musl-x64,linux-ppc64le,linux-s390x,linux-x64,linux-x86,maccatalyst-arm64,win-arm,win-arm64,win-x86,win-x64' DIR: 'osx-x86_64' #osx arm - task: prune-files vars: ITEMS: 'browser-wasm,linux-arm,linux-arm64,linux-armel,linux-mips64,linux-musl-arm,linux-musl-arm64,linux-musl-x64,linux-ppc64le,linux-s390x,linux-x64,linux-x86,maccatalyst-x64,osx-x64,win-arm,win-arm64,win-x86,win-x64' DIR: 'osx-arm' cmds: - echo "Pruning runtime files" prune-files: internal: true cmds: - for: { var: ITEMS, split: ','} cmd: cd build/{{.DIR}}/{{.SQLITE_OUT_DIR}}/runtimes && powershell -Command "rm {{.ITEM}} -Recurse -Force" ignore_error: true clean: ignore_error: true cmds: - for: [ build/, bin/, dist/, plugins/, lib/, webserver/ ] cmd: powershell -Command "rm -Recurse -Force '{{.ITEM}}'" - task: container:clean