From d1ce7c60ee3eee721942a8025978ce40246cdc88 Mon Sep 17 00:00:00 2001 From: Isaac Halvorson Date: Tue, 2 Dec 2025 09:59:32 -0600 Subject: [PATCH] Use mise for bootstrapping and task running --- .github/workflows/build.yml | 15 ++++++++------- Makefile | 14 -------------- mise.toml | 20 ++++++++++++++++++++ scripts/build.bash | 29 +++++++++++++++++++++++++++++ scripts/build.sh | 13 ------------- 5 files changed, 57 insertions(+), 34 deletions(-) delete mode 100644 Makefile create mode 100644 mise.toml create mode 100755 scripts/build.bash delete mode 100755 scripts/build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad420cc..c5a5774 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,12 @@ name: Build on: - push: - branches: main pull_request: - branches: main + workflow_dispatch: + push: + branches: + - main + - release/** jobs: build: @@ -12,7 +14,6 @@ jobs: runs-on: macos-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build - run: make build + - uses: actions/checkout@v6 + - uses: jdx/mise-action@v3 + - run: mise run build diff --git a/Makefile b/Makefile deleted file mode 100644 index 18e2144..0000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Grabs the current directory and the path to this file for use in other scripts -mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -mkfile_dir := $(dir $(mkfile_path)) -project_dir := $(mkfile_dir) -scripts_dir := $(project_dir)scripts/ - -build: - @echo "Building project..." - @$(scripts_dir)build.sh -.PHONY: build - -clean: - rm -rf $(project_dir)DerivedData -.PHONY: clean diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..3433bfa --- /dev/null +++ b/mise.toml @@ -0,0 +1,20 @@ +[settings] +activate_aggressive = true +experimental = true + +[env] +PROJECT_ROOT = "{{config_root}}" + +[tools] +xcbeautify = "latest" +xcodes = "latest" + +[tasks.bootstrap] +run = "xcodes select 26.1.1" + +[tasks.build] +depends = ["bootstrap"] +run = "scripts/build.bash" + +[tasks.clean] +run = "rm -rf DerivedData" diff --git a/scripts/build.bash b/scripts/build.bash new file mode 100755 index 0000000..e6d97ae --- /dev/null +++ b/scripts/build.bash @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -o errexit # Exit on error +set -o nounset # Exit on unset variable +set -o pipefail # Exit on pipe failure + +# Output extra debug logging if `DEBUG` or `TRACE` are set to `true` or `RUNNER_DEBUG` is set to `1` +# (https://docs.github.com/en/actions/reference/workflows-and-actions/variables) +if [[ "${DEBUG:-}" == "true" || "${TRACE:-}" == true || "${RUNNER_DEBUG:-}" == "1" ]]; then + set -o xtrace # Trace the execution of the script (debug) +fi + +function main() { + xcrun xcodebuild build \ + -scheme "CenterMouse" \ + -derivedDataPath "${PROJECT_ROOT}/DerivedData" \ + CODE_SIGN_IDENTITY= | xcbeautify +} + +trap handle_exit EXIT +function handle_exit() { + declare -ri exit_code="$?" + if [[ "${exit_code}" -ne 0 ]]; then + declare -r script_name="${0##*/}" + echo -e "\n==> ${script_name} exited with code ${exit_code}" + fi +} + +main "$@" diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 50ac084..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -o pipefail - -if ! command -v xcbeautify &> /dev/null; then - brew install xcbeautify -fi - -xcrun xcodebuild clean build \ - -scheme "CenterMouse" \ - -derivedDataPath "DerivedData" \ - -clonedSourcePackagesDirPath "DerivedData/Packages" \ - CODE_SIGN_IDENTITY= | xcbeautify