Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/VerifyChanges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ on:
branches: ["main"]

jobs:
lint:
name: Lint
runs-on: macos-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Lint
run: Tools/lint

test:
name: Test
runs-on: macos-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc

.rumdl_cache/
30 changes: 30 additions & 0 deletions .rumdl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# MD005 is off with it, since it flattens indented lists. MD029 is off because list numbers are
# content: rumdl splits lists whose markers are right-aligned (" 9.", "10.") and its fix renumbers
# the second half from 1. MD076 is off because the style guide puts nested lists and code blocks
# inside list items without blank lines between items.
[global]
disable = ["MD005", "MD029", "MD032", "MD033", "MD036", "MD025", "MD041", "MD046", "MD057", "MD060", "MD076"]
respect_gitignore = true

[MD004]
style = "dash"

[MD007]
indent = 4
start-indented = true
start-indent = 2
style = "fixed"

[MD012]
maximum = 2

[MD013]
line-length = 100
code-blocks = false
tables = false
headings = false
reflow = true

[MD022]
lines-above = [0, 2, 1, 1, 1, 1]
lines-below = 1
61 changes: 61 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Agent Guidelines

DevBuilds contains ready-to-use shell scripts for building, testing, and releasing apps and
packages with Apple’s Xcode tools, mainly on CI systems like GitHub Actions. Projects check out
DevBuilds and run the scripts in `Sources/`. The scripts need only Bash and Python 3, never Ruby or
another third-party runtime.


## Building and testing

- `python3 -m unittest discover -s Tests -v` runs the tests, which use the fixtures in
`Tests/Fixtures/` in place of Xcode’s tools.
- Changes to a script’s inputs, environment variables, or outputs affect every project that
uses it. Keep them backward compatible, or call out the
break in `CHANGELOG.md`.


## Writing style

- Follow the [Markdown Style Guide](Documentation/MarkdownStyleGuide.md) for all Markdown.
- **Use typographic quotes and apostrophes, not straight ones,** in all Markdown, all code
comments, and all user-facing messages:
- Apostrophes: ’ (U+2019), as in “it’s”
- Single quotes: ‘ (U+2018) and ’ (U+2019)
- Double quotes: “ (U+201C) and ” (U+201D)

Straight quotes (`'` and `"`) are still correct in code itself: string delimiters, code spans,
code blocks, identifiers, and configuration files.


## Attribution

Never credit an agent or other code generation tool. Don’t add `Co-Authored-By` trailers or
“Generated with” lines to commits or pull requests, and don’t name an agent in file headers,
comments, or documentation. The programmer who uses a tool is accountable for the changes it
helped make.


## Commits and pull requests

A commit message is a short summary of what the commit does, then a blank line and a bulleted list
of the changes, close to what a changelog would say. Messages are plain text with lines of 72
characters or fewer. A pull request uses its commit message: the title is the summary, and the
body is the bullets.

Add an entry to `CHANGELOG.md` for changes that affect projects using DevBuilds.


## Code

Follow the [Shell Style Guide](Documentation/ShellStyleGuide.md) before writing or reviewing
scripts.


## Formatting and linting

- `Tools/format` formats Markdown with rumdl, in place.
- `Tools/lint` checks it. Configuration is in `.rumdl.toml` (100-character lines).
- `Tools/install-git-hooks` installs a pre-push hook that runs `Tools/lint`.

Run `Tools/lint` before considering a change done.
58 changes: 31 additions & 27 deletions Documentation/MarkdownStyleGuide.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
---
description: Markdown formatting conventions for documentation in the Shopper iOS codebase
read-when: Writing or editing a Markdown doc here and unsure of line length, headers, or list style
---

# Markdown Style Guide

This document defines the Markdown formatting standards for documentation in the Shopper iOS
codebase.
This document defines the Markdown formatting standards for documentation in this project.


## General Formatting
Expand All @@ -17,21 +11,21 @@ Keep all lines under **100 characters**. Break long sentences and paragraphs at
to stay within this limit.

✅ Good:
The codebase uses a consistent approach to mocking based on the DevTesting framework’s
`Stub` type. All mocks follow standardized patterns.

Faucibus consectetur lacinia nostra eros conubia nibh inceptos hendrerit, ante blandit
vulputate imperdiet amet porttitor torquent mattis.
❌ Bad:
The codebase uses a consistent approach to mocking based on the DevTesting framework’s `Stub` type. All mocks follow standardized patterns that make them predictable, testable, and maintainable.
Faucibus consectetur lacinia nostra eros conubia nibh inceptos hendrerit, ante blandit vulputate imperdiet amet porttitor torquent mattis.


### Spacing

Use consistent spacing for visual hierarchy:

- **Between major sections**: 2 blank lines
- **After code blocks**: 1 blank line
- **Before subsections**: 1 blank line
- **After section headers**: 1 blank line
- **Between major sections**: 2 blank lines
- **After code blocks**: 1 blank line
- **Before subsections**: 1 blank line
- **After section headers**: 1 blank line

Example:

Expand Down Expand Up @@ -160,24 +154,34 @@ Use backticks for:

Use consistent terminology throughout documents:

- Prefer "function" over "method" when referring to Swift functions
- Use "type" instead of "class" when referring generically to classes/structs/enums
- Use "property" for stored and computed properties
- Prefer “function” over “method” when referring to Swift functions
- Use “type” instead of “class” when referring generically to classes/structs/enums
- Use “property” for stored and computed properties


## Typography

Use typographic quotes and apostrophes, not straight ones, in prose: ’ for apostrophes (“it’s”),
‘ and ’ for single quotes, and “ and ” for double quotes. Straight quotes remain correct inside code
spans and code blocks.

The same rule applies to code documentation (doc comments and standalone comments) and to
user-facing strings.


## File Structure Examples

Use indented text blocks for file structure diagrams:

Tests/
├── AppPlatformTests/
│ └── Testing Support/
│ ├── MockAppServices.swift
│ └── MockBootstrapper.swift
└── TelemetryTests/
└── Testing Support/
├── MockTelemetryDestination.swift
└── MockError.swift
├── Folder 1/
│ └── Folder 2/
│ ├── File1.swift
│ └── File2.swift
└── Folder 3/
└── Folder 4/
├── File3.swift
└── File4.swift


## Links and References
Expand All @@ -192,4 +196,4 @@ Use relative paths for internal documentation:

Reference specific locations using this pattern:

The main implementation is in `AppPlatform.swift:42-68`.
The main implementation is in `Stub.swift:42-68`.
3 changes: 2 additions & 1 deletion Documentation/ShellStyleGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ why a step is needed or why the shell behavior is surprising. Avoid narrating ob
- Separate a local declaration from command substitution so `local` does not hide the
command's exit status.

# Print the canonical path of an existing directory. Return nonzero if it is inaccessible.
# Print the canonical path of an existing directory. Return nonzero if it is inaccessible

resolve_directory() {
local directory="$1"

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DevBuilds contains ready-to-use scripts for building, testing, and releasing apps and packages using
Apple’s Xcode tools. The scripts are intended to provide projects with a simple way to run CI tasks
on remote systems like GitHub Actions. Importantly, there’s no need to install Ruby or some other
on remote systems like GitHub Actions. Importantly, there’s no need to install Ruby or some other
third-party runtime.

View our [changelog](CHANGELOG.md) to see what’s new.
Expand All @@ -15,12 +15,12 @@ Description forthcoming.

## Development Requirements

DevBuilds is intended to run on macOS with Xcode 16.3+.
DevBuilds is intended to run on macOS with Xcode 16.3+.


## Bugs and Feature Requests

Find a bug? Want a new feature? Create a GitHub issue and we’ll take a look.
Find a bug? Want a new feature? Create a GitHub issue and we’ll take a look.


## License
Expand Down
8 changes: 8 additions & 0 deletions Tools/format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Formats Markdown in place using the rules in .rumdl.toml.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"

exec "$SCRIPT_DIR/rumdl" fmt "$REPO_ROOT"
30 changes: 30 additions & 0 deletions Tools/install-git-hooks
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Installs a pre-push hook that runs Tools/lint, so formatting problems are caught before CI sees
# them. The hook goes in the repository’s common Git directory, so it applies to every worktree.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"

cd "$REPO_ROOT"
GIT_COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir)"
HOOKS_DIR="$GIT_COMMON_DIR/hooks"
mkdir -p "$HOOKS_DIR"

cat > "$HOOKS_DIR/pre-push" << 'HOOK'
#!/bin/bash

# Installed by Tools/install-git-hooks. Runs Tools/lint before pushing.
REPO_ROOT="$(git rev-parse --show-toplevel)"

echo "Running Tools/lint…"
if ! "$REPO_ROOT/Tools/lint"; then
echo "Lint failed. Run Tools/format, or push with --no-verify to skip this check."
exit 1
fi
HOOK

chmod +x "$HOOKS_DIR/pre-push"
echo "Installed a pre-push hook that runs Tools/lint."
8 changes: 8 additions & 0 deletions Tools/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Lints Markdown using the rules in .rumdl.toml.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"

exec "$SCRIPT_DIR/rumdl" check "$REPO_ROOT"
40 changes: 40 additions & 0 deletions Tools/rumdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Runs the pinned version of rumdl, installing it on first use. Pinning keeps local runs and CI on
# the same version, so a new rumdl release can’t change lint results until this version changes.
# Each version is installed once per user into a virtual environment in the user’s cache.

set -euo pipefail

RUMDL_VERSION="0.3.5"

INSTALL_ROOT="${XDG_CACHE_HOME:-$HOME/.cache}/devkit"
INSTALL_DIR="$INSTALL_ROOT/rumdl-$RUMDL_VERSION"
RUMDL="$INSTALL_DIR/bin/rumdl"

if [[ ! -x "$RUMDL" ]]; then
echo "Installing rumdl ${RUMDL_VERSION} into ${INSTALL_DIR}…" >&2
mkdir -p "$INSTALL_ROOT"

# Install into a temporary directory and move it into place, so a run that starts while
# another is installing never sees a partial installation.
staging_dir="$(mktemp -d "$INSTALL_ROOT/rumdl-staging.XXXXXX")"
trap 'rm -rf "$staging_dir"' EXIT
python3 -m venv "$staging_dir"
"$staging_dir/bin/pip" install --quiet --disable-pip-version-check "rumdl==$RUMDL_VERSION" >&2

# If another run finished first, keep its copy. exec below skips the EXIT trap, so clean up
# the staging directory here.
if [[ ! -e "$INSTALL_DIR" ]]; then
mv "$staging_dir" "$INSTALL_DIR"
fi
rm -rf "$staging_dir"
trap - EXIT

if [[ ! -x "$RUMDL" ]]; then
echo "Error: couldn’t install rumdl ${RUMDL_VERSION}" >&2
exit 1
fi
fi

exec "$RUMDL" "$@"
Loading