-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun
More file actions
executable file
·64 lines (45 loc) · 1.68 KB
/
run
File metadata and controls
executable file
·64 lines (45 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -eo pipefail
function clean {
# Remove machine generates files
rm -rf test/output/*
touch test/output/.keep
}
function ci:install-deps {
# Install Continuous Integration (CI) dependencies
sudo apt-get install -y --no-install-recommends shellcheck
}
function ci:test {
# Execute Continuous Integration (CI) pipeline
shellcheck run
clean
cd test
file_1_input="input/static/hello/world/1.txt"
file_1_output="output/hello/world/1.txt"
file_2_output="output/hello/world/2.txt"
# Run esbuild.
node esbuild.config.js
# Ensure both output files exist.
[ -f "${file_1_output}" ] && [ -f "${file_2_output}" ]
# Get the last modified time in Unix time (epoch).
mtime_file_1_output_before="$(stat -c %Y "${file_1_output}")"
mtime_file_2_output_before="$(stat -c %Y "${file_2_output}")"
# Update one of the files.
echo "modified this file" >> "${file_1_input}"
# Generate a new set of static files by running esbuild again.
node esbuild.config.js
# Get the new last modified times.
mtime_file_1_output_after="$(stat -c %Y "${file_1_output}")"
mtime_file_2_output_after="$(stat -c %Y "${file_2_output}")"
# The first file's time should be different but not the second one.
[ "${mtime_file_1_output_before}" != "${mtime_file_1_output_after}" ]
[ "${mtime_file_2_output_before}" = "${mtime_file_2_output_after}" ]
}
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
# This idea is heavily inspired by: https://github.com/adriancooney/Taskfile
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"