Skip to content

Commit

Permalink
Migrate some tasks to Mise
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch committed Dec 14, 2024
1 parent 95b9b24 commit 77400f5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 26 deletions.
8 changes: 3 additions & 5 deletions .mise/tasks/benchmark
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#!/bin/bash
# mise description="Run scan benchmark"
set -eo pipefail

#USAGE flag "-b --bazel" help="Use binary built by Bazel"

set -eo pipefail

cmd=""

if [ "$usage_bazel" = "true" ]; then
echo "INFO: Using Bazel"
bazel build //:periphery
cmd='bazel-bin/Sources/Frontend scan --config /var/tmp/periphery_bazel/periphery.yml --generic-project-config bazel-bin/external/+generated+periphery_generated/rule/project_config.json'
else
make build_arm64
./.build/release/periphery scan --quiet
mise r build --arch arm64
cmd='./.build/release/periphery scan --quiet --skip-build'
fi

Expand Down
37 changes: 37 additions & 0 deletions .mise/tasks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
#USAGE flag "--arch <arch>" help="Build architecture (x86_64, arm64, release)"

set -eo pipefail

SWIFT_BUILD_FLAGS="--product periphery --configuration release --disable-sandbox --scratch-path .build"
EXECUTABLE_X86_64="$(swift build ${SWIFT_BUILD_FLAGS} --arch x86_64 --show-bin-path)/periphery"
EXECUTABLE_ARM64="$(swift build ${SWIFT_BUILD_FLAGS} --arch arm64 --show-bin-path)/periphery"

build_x86_64() {
swift build ${SWIFT_BUILD_FLAGS} --arch x86_64
}

build_arm64() {
swift build ${SWIFT_BUILD_FLAGS} --arch arm64
}

if [ "$usage_arch" = "x86_64" ]; then
echo "Building for x86_64"
build_x86_64
echo ${EXECUTABLE_X86_64}
elif [ "$usage_arch" = "arm64" ]; then
echo "Building for arm64"
build_arm64
echo ${EXECUTABLE_ARM64}
elif [ "$usage_arch" = "release" ]; then
echo "Building for release"
build_x86_64
build_arm64
mkdir -p .release
lipo -create -output .release/periphery ${EXECUTABLE_X86_64} ${EXECUTABLE_ARM64}
strip -rSTX .release/periphery
echo "$(realpath .release/periphery)"
else
echo "Invalid architecture. Use --arch <arch> where <arch> is x86_64, arm64 or release"
exit 1
fi
2 changes: 1 addition & 1 deletion .mise/tasks/lint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# mise description="Lint the project"

set -euo pipefail

cd $MISE_PROJECT_ROOT
Expand Down
2 changes: 1 addition & 1 deletion .mise/tasks/lint-ci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# mise description="Lint the project for CI"

set -euo pipefail

cd $MISE_PROJECT_ROOT
Expand Down
5 changes: 4 additions & 1 deletion scripts/scan → .mise/tasks/scan
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
set -e
#!/bin/bash

set -euo pipefail

swift build
time ./.build/debug/periphery scan "$@"
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cat scripts/artifactbundle_info.json.template | sed s/__VERSION__/${version}/ >
echo -e "\nUpdate CHANGELOG.md"
confirm "Continue?"

make build_release
mise r build --arch release

if [ ! -f .release/periphery ]; then
echo "ERROR: Missing release binary?"
Expand Down

0 comments on commit 77400f5

Please sign in to comment.