Local testing
Prerequisites
Section titled “Prerequisites”sudo pacman -S --needed git curl go-yq pacman-contrib namcap# For tests and linting:sudo pacman -S --needed bats jq openssh shellcheck shfmt actionlintThe commands of the next four sections and of Draft a package run in your repository through aurtomator.sh, at the commit the calling workflows pin, so a local run uses the strategies and checks of CI, see The aurtomator.sh script.
A script takes the packages, .status/, .aurtomator.conf and README.md from the working directory, or from AURTOMATOR_DATA_DIR, which ./aurtomator.sh sets to your repository. AURTOMATOR_RUNNER, which ./aurtomator.sh sets to its own path, starts the commands that setup.sh and draft.sh print, as in ./aurtomator.sh setup verify.
Check a single package
Section titled “Check a single package”./aurtomator.sh check-update my-packageThe log goes to stderr, and a new version to stdout:
→ Checking my-package (strategy: github-release, current: 1.0.0)! my-package: update available 1.0.0 → 2.0.02.0.0An up-to-date package leaves stdout empty:
→ Checking my-package (strategy: github-release, current: 2.0.0)✓ my-package is up to date (2.0.0)Dry-run an update
Section titled “Dry-run an update”./aurtomator.sh update-pkg my-package 2.0.0 --dry-runIt runs the steps of Step-by-step up to the check of PKGBUILD and .SRCINFO, prints the diff of the PKGBUILD and pushes nothing. These steps run the PKGBUILD of the AUR on your machine, with your SSH key in reach of its code, so read the PKGBUILD first when someone else can push to the package.
Push an update
Section titled “Push an update”./aurtomator.sh update-pkg my-package 2.0.0It runs the whole update, git push to the AUR with your SSH key included.
Check all packages
Section titled “Check all packages”./aurtomator.sh check-all # check only./aurtomator.sh check-all --update # check and push updates./aurtomator.sh check-all --update --dry-run # check and dry-run updatesThe last line counts the packages:
→ Checked: 4, Updated: 2, Errors: 0Running BATS tests
Section titled “Running BATS tests”The tests and the linters check aurtomator itself and run in the root of a clone of aurtomator:
bats tests/ --recursive --timingbats tests/scripts.bats
# Coverage report in coverage/, as CI makes itbashcov -- tests/helpers/bashcov-bats.sh tests/ --recursivetests/helpers/setup.sh gives every test a temporary directory with links to the scripts and strategies and with tests/helpers/mock-curl.sh as the first curl in PATH. Tests that need git, ssh or gh add their own mocks there. The suite sends no request to the network and never touches a real AUR repository.
Linting locally
Section titled “Linting locally”shellcheck -x -S warning scripts/*.sh scripts/lib/*.sh strategies/*.sh tests/helpers/*.shshfmt -d -i 2 -ci scripts/*.sh scripts/lib/*.sh strategies/*.sh tests/*.bats tests/helpers/*.shactionlintshfmt -w in place of -d fixes the formatting. CI also checks the run: blocks of .github/actions/*/action.yml and aurtomator.sh, see Lint job.