|
| 1 | +[tools] |
| 2 | +docker-cli = "latest" |
| 3 | +rust = "1.88" |
| 4 | + |
| 5 | +[tasks.test] |
| 6 | +description = "Run all the tests with features. Requires docker" |
| 7 | +run = "cargo nextest run --all-features" |
| 8 | + |
| 9 | + |
| 10 | +[tasks.bump-deps] |
| 11 | +description = "Upgrade all libs versions for all packages" |
| 12 | +run = """ |
| 13 | + cargo upgrade --recursive true --incompatible allow |
| 14 | + cargo update --recursive |
| 15 | +""" |
| 16 | + |
| 17 | + |
| 18 | +[tasks.linter-fix] |
| 19 | +description = "Fix linter issues when possible and format code" |
| 20 | +run = """ |
| 21 | + cargo clippy --fix --all-features --locked --allow-dirty |
| 22 | + cargo fmt --all |
| 23 | +""" |
| 24 | + |
| 25 | +[tasks.docker-release] |
| 26 | +description = "Build and push wstunnel docker image" |
| 27 | +usage = ''' |
| 28 | +arg "image_tag" "tag of the image" |
| 29 | +''' |
| 30 | +run = """ |
| 31 | + docker buildx create --name builder --driver=kubernetes --platform=linux/arm64 '--driver-opt="nodeselector=kubernetes.io/arch=arm64","tolerations=key=kubernetes.io/hostname,value=server","requests.cpu=16","requests.memory=16G"' --node=build-arm64 |
| 32 | + docker buildx create --append --name builder --driver=kubernetes --platform=linux/amd64 '--driver-opt="nodeselector=kubernetes.io/arch=amd64","tolerations=key=kubernetes.io/hostname,value=toybox","requests.cpu=16","requests.memory=16G"' --node=build-amd64 |
| 33 | + docker buildx use builder |
| 34 | + docker buildx build \ |
| 35 | + --platform linux/arm/v7,linux/arm64,linux/amd64 \ |
| 36 | + --cache-from type=registry,ref=ghcr.io/erebe/wstunnel:cache \ |
| 37 | + --cache-to type=registry,mode=max,image-manifest=true,oci-mediatypes=true,ref=ghcr.io/erebe/wstunnel:cache \ |
| 38 | + -t ghcr.io/erebe/wstunnel:{{arg(name="image_tag")}} \ |
| 39 | + -t ghcr.io/erebe/wstunnel:latest \ |
| 40 | + --push . |
| 41 | + docker buildx rm builder |
| 42 | +""" |
| 43 | + |
| 44 | + |
| 45 | +[tasks.publish-release] |
| 46 | +description = "Push a new release of wstunnel" |
| 47 | +usage = ''' |
| 48 | +arg "version" "version of wstunnel to release" |
| 49 | +flag "-f --force" default="" |
| 50 | +''' |
| 51 | +run = """ |
| 52 | +if [ '{{flag(name="force")}}' = 'true' ]; then |
| 53 | + export FORCE="-f" |
| 54 | +fi |
| 55 | +
|
| 56 | +sed -i 's/^version = .*/version = "'$usage_version'"/g' wstunnel-cli/Cargo.toml wstunnel/Cargo.toml |
| 57 | +cargo fmt --all -- --check --color=always || (echo "Use cargo fmt to format your code"; exit 1) |
| 58 | +#cargo clippy --all --all-features -- -D warnings || (echo "Solve your clippy warnings to succeed"; exit 1) |
| 59 | +
|
| 60 | +git add wstunnel/Cargo.* wstunnel-cli/Cargo.* Cargo.* |
| 61 | +git commit -m 'Bump version v'$usage_version |
| 62 | +git tag ${{FORCE}} v$usage_version -m 'version v'$usage_version |
| 63 | +git push ${{FORCE}} |
| 64 | +git push ${{FORCE}} origin v$usage_version |
| 65 | +""" |
| 66 | + |
0 commit comments