mirror of
https://github.com/opdavies/build-configs.git
synced 2025-02-02 05:47:32 +00:00
Add just and justfile
This commit is contained in:
parent
0d774daca0
commit
5029aab415
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
@ -20,9 +20,8 @@ jobs:
|
|||
with:
|
||||
nix_path: nixpkgs=channel:nixos-23.05
|
||||
|
||||
- run: ./run ci:test
|
||||
|
||||
- run: ./run build
|
||||
- run: nix develop --command just ci-test
|
||||
- run: nix develop --command just build
|
||||
|
||||
- run: |
|
||||
echo "DATE=$(date '+%Y-%m-%d-%H.%M.%S')" >> $GITHUB_ENV
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
perSystem = { config, self', inputs', pkgs, system, ... }: {
|
||||
devshells.default = {
|
||||
packages = with pkgs; [
|
||||
"just"
|
||||
"php81"
|
||||
"php81Packages.composer"
|
||||
];
|
||||
|
|
66
run → justfile
Executable file → Normal file
66
run → justfile
Executable file → Normal file
|
@ -1,29 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
_default:
|
||||
just --list
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
export PATH=$PATH:./bin:./vendor/bin:./vendor-bin/box/vendor/bin
|
||||
|
||||
# Delete any temporary or generated files.
|
||||
function clean {
|
||||
rm -fr dist/* tmp vendor vendor-bin/box/vendor
|
||||
touch dist/.keep var/.keep
|
||||
}
|
||||
|
||||
# Build the phar version of build-configs.
|
||||
function build {
|
||||
clean
|
||||
build:
|
||||
just clean
|
||||
|
||||
# Install dependencies.
|
||||
composer validate
|
||||
composer install --no-dev --prefer-dist --optimize-autoloader
|
||||
composer install --prefer-dist --optimize-autoloader --working-dir ./vendor-bin/box
|
||||
|
||||
nix develop --command composer dump-env prod
|
||||
composer dump-env prod
|
||||
|
||||
nix develop --command build-configs cache:clear
|
||||
nix develop --command build-configs cache:warmup
|
||||
./build-configs cache:clear
|
||||
./build-configs cache:warmup
|
||||
|
||||
# Generate the phar file.
|
||||
box compile --config box.json.dist
|
||||
|
@ -33,35 +22,25 @@ function build {
|
|||
tree dist/
|
||||
|
||||
# TODO: build a Nix derivation and add it to the store.
|
||||
}
|
||||
|
||||
function ci:test {
|
||||
clean:
|
||||
rm -fr dist/* tmp vendor vendor-bin/box/vendor
|
||||
touch dist/.keep var/.keep
|
||||
|
||||
ci-test:
|
||||
nix develop --command composer install
|
||||
nix develop --command ./run test:snapshots
|
||||
nix develop --command phpunit --testdox
|
||||
}
|
||||
|
||||
# Display a list of all available commands.
|
||||
function help {
|
||||
printf "%s <task> [args]\n\nTasks:\n" "${0}"
|
||||
test *args:
|
||||
phpunit {{ args }}
|
||||
|
||||
compgen -A function | grep -v "^_" | cat -n
|
||||
|
||||
printf "\nExtended help:\n Each task has comments for general usage\n"
|
||||
}
|
||||
|
||||
function test {
|
||||
phpunit "${@}"
|
||||
}
|
||||
|
||||
# Create a new snapshot for a configuration based on generated files.
|
||||
function test:create-snapshot {
|
||||
create-snapshot config:
|
||||
#!/usr/bin/env bash
|
||||
set -o nounset
|
||||
|
||||
config="${1}"
|
||||
|
||||
config_file="tests/snapshots/configs/${config}.yaml"
|
||||
output_path="tests/snapshots/output/${config}"
|
||||
config_file="tests/snapshots/configs/{{ config }}.yaml"
|
||||
output_path="tests/snapshots/output/{{ config }}"
|
||||
|
||||
cat "${config_file}"
|
||||
|
||||
|
@ -70,10 +49,9 @@ function test:create-snapshot {
|
|||
./bin/build-configs app:generate --config-file "${config_file}" --output-dir "${output_path}"
|
||||
|
||||
git status "${output_path}"
|
||||
}
|
||||
|
||||
# Generate a file and ensure it matches the expected version.
|
||||
function test:snapshots {
|
||||
run-snapshots:
|
||||
#!/usr/bin/env bash
|
||||
rm -rf .ignored/snapshots
|
||||
mkdir -p .ignored/snapshots
|
||||
|
||||
|
@ -107,7 +85,3 @@ function test:snapshots {
|
|||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
TIMEFORMAT=$'\nTask completed in %3lR'
|
||||
time "${@:-help}"
|
Loading…
Reference in a new issue