diff --git a/.github/workflows/shared/install-just.sh b/.github/workflows/shared/install-just.sh new file mode 100644 index 0000000..b51c616 --- /dev/null +++ b/.github/workflows/shared/install-just.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -eoux pipefail +ARCH=$(uname -m) +while [[ "${JUST_VERSION:-}" =~ null || -z "${JUST_VERSION:-}" ]] +do + JUST_VERSION=$(curl -L https://api.github.com/repos/casey/just/releases/latest | jq -r '.tag_name') +done +curl -sSLO https://github.com/casey/just/releases/download/"${JUST_VERSION}"/just-"${JUST_VERSION}"-"${ARCH}"-unknown-linux-musl.tar.gz +tar -zxvf just-"${JUST_VERSION}"-"${ARCH}"-unknown-linux-musl.tar.gz -C /tmp just +sudo mv /tmp/just /usr/local/bin/just +rm -f just-"${JUST_VERSION}"-"${ARCH}"-unknown-linux-musl.tar.gz diff --git a/.github/workflows/validate-just.yml b/.github/workflows/validate-just.yml new file mode 100644 index 0000000..0a17a88 --- /dev/null +++ b/.github/workflows/validate-just.yml @@ -0,0 +1,29 @@ +name: Validate Justfiles + +on: + pull_request: + paths: + - "Justfile" + - "**/*.just" + push: + branches: + - main + paths: + - "Justfile" + - "**/*.just" + +jobs: + validate-just: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Install Just + shell: bash + run: bash .github/workflows/shared/install-just.sh + + - name: Check Just Syntax + shell: bash + run: | + just check diff --git a/Justfile b/Justfile index 6d9f94e..96e717d 100644 --- a/Justfile +++ b/Justfile @@ -14,7 +14,7 @@ renovate dry-run="lookup" log-level="debug": echo "Warning: No Github token found, renovate will nag at you for this." echo "Set it with GITHUB_COM_TOKEN=(your token)" fi - LOG_LEVEL=${LOG_LEVEL:-debug} renovate --platform=local --dry-run={{dry-run}} + LOG_LEVEL=${LOG_LEVEL:-debug} renovate --platform=local --dry-run={{ dry-run }} echo "Updates can be found in a section of the logs called \"packageFiles with updates\"" build $spec *MOCK_ARGS: @@ -134,3 +134,17 @@ clean: sudo rm -ri $line done exit 0 + +# Check Just Syntax + +just := just_executable() + +[group('Just')] +check: + #!/usr/bin/bash + find . -type f -name "*.just" | while read -r file; do + echo "Checking syntax: $file" + {{ just }} --unstable --fmt --check -f $file + done + echo "Checking syntax: Justfile" + {{ just }} --unstable --fmt --check -f Justfile