From d36aa381c271c968a2d6544cd1f8e5f16eb16b67 Mon Sep 17 00:00:00 2001 From: Ian Leitch Date: Sat, 24 Aug 2024 13:16:03 +0200 Subject: [PATCH] Use mise for dev tooling --- .github/workflows/test.yml | 18 +++++++++++++----- .mise.toml | 3 +++ .mise/tasks/lint | 8 ++++++++ Makefile | 8 -------- scripts/lint/swiftformat.sh | 11 ----------- scripts/lint/swiftlint.sh | 11 ----------- 6 files changed, 24 insertions(+), 35 deletions(-) create mode 100644 .mise.toml create mode 100755 .mise/tasks/lint delete mode 100755 scripts/lint/swiftformat.sh delete mode 100755 scripts/lint/swiftlint.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0183298b..7136600b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,24 +5,32 @@ on: - master pull_request: {} env: + MISE_EXPERIMENTAL: 1 swift_package_resolve: swift package resolve swift_build: swift build swift_test: swift test periphery_scan: ./.build/debug/periphery scan --quiet --clean-build cache_version: 1 jobs: + lint: + runs-on: macos-14 + name: Lint + steps: + - uses: actions/checkout@master + - uses: jdx/mise-action@v2 + - run: mise run lint macOS: strategy: fail-fast: false matrix: - xcode: ["16.0", "15.4", "15.2"] + xcode: ["16.1", "15.4", "15.2"] include: - - xcode: "16.0" - macos: macOS-14 + - xcode: "16.1" + macos: macos-14 - xcode: "15.4" - macos: macOS-14 + macos: macos-14 - xcode: "15.2" - macos: macOS-14 + macos: macos-14 runs-on: ${{ matrix.macos }} name: macOS steps: diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 000000000..4042f0ef6 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,3 @@ +[tools] +swiftlint = "0.56.1" +swiftformat = "0.54.3" diff --git a/.mise/tasks/lint b/.mise/tasks/lint new file mode 100755 index 000000000..a9d02dfc1 --- /dev/null +++ b/.mise/tasks/lint @@ -0,0 +1,8 @@ +#!/bin/bash +# mise description="Lint the project" +set -euo pipefail + +cd $MISE_PROJECT_ROOT + +swiftformat --quiet --strict +swiftlint lint --quiet --strict diff --git a/Makefile b/Makefile index 540da7571..4d6e3a07c 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,3 @@ build_release: clean build_x86_64 build_arm64 @mkdir -p .release @lipo -create -output .release/periphery ${EXECUTABLE_X86_64} ${EXECUTABLE_ARM64} @strip -rSTX .release/periphery - -swiftformat: - @./scripts/lint/swiftformat.sh - -swiftlint: - @./scripts/lint/swiftlint.sh - -lint: swiftlint swiftformat \ No newline at end of file diff --git a/scripts/lint/swiftformat.sh b/scripts/lint/swiftformat.sh deleted file mode 100755 index 848ba6890..000000000 --- a/scripts/lint/swiftformat.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -VERSION="0.54.3" -INSTALLED_VERSION=$(swiftformat --version) - -if [[ "$INSTALLED_VERSION" != "$VERSION" ]]; then - echo "ERROR: SwiftFormat ${VERSION} is required, installed version is ${INSTALLED_VERSION}." - exit 1 -fi - -swiftformat --quiet . \ No newline at end of file diff --git a/scripts/lint/swiftlint.sh b/scripts/lint/swiftlint.sh deleted file mode 100755 index 7a47d0dc1..000000000 --- a/scripts/lint/swiftlint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -VERSION="0.56.1" -INSTALLED_VERSION=$(swiftlint --version) - -if [[ "$INSTALLED_VERSION" != "$VERSION" ]]; then - echo "ERROR: SwiftLint ${VERSION} is required, installed version is ${INSTALLED_VERSION}." - exit 1 -fi - -swiftlint lint --quiet \ No newline at end of file