Skip to content

Commit 28b7cfc

Browse files
authored
Merge pull request #5 from xexyl/words
2 parents d5bf6ec + cd104d8 commit 28b7cfc

File tree

6 files changed

+98
-4
lines changed

6 files changed

+98
-4
lines changed

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Set update schedule for GitHub Actions
2+
#
3+
# See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
4+
5+
version: 2
6+
updates:
7+
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
# Check for updates to GitHub Actions every week
12+
interval: "weekly"

.github/workflows/test.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: C CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: make test
16+
run: make test

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
*.dSYM/
3+
.test.*words
4+
.sw[a-zA-Z0-9]
5+
.*.sw[a-zA-Z0-9]*

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
CHMOD= chmod
3434
CP= cp
35+
DIFF= diff
3536
INSTALL= install
3637
MV= mv
3738
RM= rm
@@ -70,6 +71,11 @@ sort: polite.english.words.txt
7071
LC_ALL=C ${SORT} -d -f polite.english.words.txt | ${UNIQ} > "$$TMP" ; \
7172
${MV} -f "$$TMP" polite.english.words.txt
7273

74+
# like sort but compares output with the sorted and current, for workflows on
75+
# GitHub
76+
test: test.sh
77+
@./test.sh
78+
7379
###################################
7480
# standard Makefile utility rules #
7581
###################################

polite.english.words.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -68374,7 +68374,6 @@ codicillary
6837468374
codicil's
6837568375
codicils
6837668376
codicology
68377-
codictatorship
6837868377
codifiability
6837968378
codification
6838068379
codification's
@@ -134548,6 +134547,7 @@ Funafuti's
134548134547
funambulant
134549134548
funambulate
134550134549
funambulated
134550+
funambulates
134551134551
funambulating
134552134552
funambulation
134553134553
funambulator
@@ -134556,8 +134556,10 @@ funambule
134556134556
funambulic
134557134557
funambulism
134558134558
funambulist
134559+
funambulists
134559134560
funambulo
134560134561
funambuloes
134562+
funambulus
134561134563
funaria
134562134564
funariaceae
134563134565
funariaceous
@@ -317108,9 +317110,6 @@ semidiaphanous
317108317110
semidiaphanously
317109317111
semidiaphanousness
317110317112
semidiatessaron
317111-
semidictatorial
317112-
semidictatorially
317113-
semidictatorialness
317114317113
semidifference
317115317114
semidigested
317116317115
semidigression

test.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
export WORDS="polite.english.words.txt"
4+
if [[ ! -f "$WORDS" ]]; then
5+
echo "$0: ERROR: file does not exist: $WORDS" 1>&2
6+
exit 1
7+
elif [[ ! -r "$WORDS" ]]; then
8+
echo "$0: ERROR: file is not readable: $WORDS" 1>&2
9+
exit 1
10+
elif [[ ! -w "$WORDS" ]]; then
11+
echo "$0: ERROR: file is not writable: $WORDS" 1>&2
12+
exit 1
13+
fi
14+
15+
# setup a working directory unless -w was given
16+
#
17+
TMP_WORDS=$(mktemp .test.XXXXXXXXXX.words)
18+
status="$?"
19+
if [[ $status -ne 0 ]]; then
20+
echo "$0: ERROR: mktemp .test.XXXXXXXXXX.words exit code: $status" 1>&2
21+
exit 2
22+
fi
23+
24+
# trap to remove temp words list
25+
#
26+
trap "rm -rf \$TMP_WORDS; exit" 1 2 3 15
27+
28+
# sort words list into temp list file
29+
#
30+
LC_ALL=C sort -d -f "$WORDS" | uniq > "$TMP_WORDS"
31+
status="$?"
32+
if [[ $status -ne 0 ]]; then
33+
echo "$0: ERROR: sort -d -f $WORDS | uniq > $TMP_WORDS failed: $status" 1>&2
34+
# make sure to temp words list no longer exists
35+
#
36+
rm -f "$TMP_WORDS"
37+
exit 1
38+
fi
39+
40+
if ! diff "$TMP_WORDS" "$WORDS"; then
41+
echo "$0: ERROR: words list not the same as the sorted list" 1>&2
42+
echo "$0: Tip: try make sort" 1>&2
43+
# make sure to temp words list no longer exists
44+
#
45+
rm -f "$TMP_WORDS"
46+
exit 1
47+
fi
48+
49+
# remove temp words list
50+
#
51+
rm -f "$TMP_WORDS"
52+
53+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
54+
#
55+
56+
exit 0

0 commit comments

Comments
 (0)