From e7d72e3e8807b87440547f1aa63bc1f6ee2db748 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 12:49:04 -0800 Subject: [PATCH 01/12] Add trivial CI --- .github/workflows/build.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..01101c7 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,21 @@ +name: "Run Tests" + +on: + pull_request: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-22.04 + name: Run Tests + steps: + - name: Download wake + run: wget https://github.com/sifive/wake/releases/download/v39.1.0/ubuntu-22-04-wake_39.1.0-1_amd64.deb + + - name: Install wake + run: sudo apt install ubuntu-22-04-wake_39.1.0-1_amd64.deb + + - name: Placeholder + run: wake -x 'Unit' From 0a689d3be09c6fb20fd8aadf9a97ed3a0166aa31 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:07:52 -0800 Subject: [PATCH 02/12] bump --- .github/workflows/build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 01101c7..44e2229 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,8 +14,11 @@ jobs: - name: Download wake run: wget https://github.com/sifive/wake/releases/download/v39.1.0/ubuntu-22-04-wake_39.1.0-1_amd64.deb + - name: ls + run: ls -lah . + - name: Install wake - run: sudo apt install ubuntu-22-04-wake_39.1.0-1_amd64.deb + run: sudo apt-get install ubuntu-22-04-wake_39.1.0-1_amd64.deb - name: Placeholder run: wake -x 'Unit' From bb63f091f5dcb0439a03b08d4f8958d77f2753b7 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:09:04 -0800 Subject: [PATCH 03/12] uri? --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 44e2229..a931a28 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: run: ls -lah . - name: Install wake - run: sudo apt-get install ubuntu-22-04-wake_39.1.0-1_amd64.deb + run: sudo apt-get install ./ubuntu-22-04-wake_39.1.0-1_amd64.deb - name: Placeholder run: wake -x 'Unit' From 605b2aba3579f3b70af467f77ad9befcfe6ea507 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:13:35 -0800 Subject: [PATCH 04/12] checkout and run simple --- .github/workflows/build.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a931a28..b50c01c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,6 +11,11 @@ jobs: runs-on: ubuntu-22.04 name: Run Tests steps: + - name: Clone wake-extras + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Download wake run: wget https://github.com/sifive/wake/releases/download/v39.1.0/ubuntu-22-04-wake_39.1.0-1_amd64.deb @@ -20,5 +25,8 @@ jobs: - name: Install wake run: sudo apt-get install ./ubuntu-22-04-wake_39.1.0-1_amd64.deb - - name: Placeholder - run: wake -x 'Unit' + - name: Initialize wake + run: wake --init . + + - name: Run basic test + run: wake --in query -x 'single 5' From 182f9850993cefdf89c6d1babff3ba511887a2b1 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:27:21 -0800 Subject: [PATCH 05/12] add missing function --- json.wake | 2 +- result.wake | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 result.wake diff --git a/json.wake b/json.wake index 0a77b6e..878ebdb 100644 --- a/json.wake +++ b/json.wake @@ -1,7 +1,7 @@ package json from wake import _ -from utils import prefixError +from result import prefixError from query import _ # Anyone who depends on json will also diff --git a/result.wake b/result.wake new file mode 100644 index 0000000..fd6e5fe --- /dev/null +++ b/result.wake @@ -0,0 +1,17 @@ +package result + +# When `result` is Fail, prefixes the internal error message with `prefix` +# +# Parameters: +# - `prefix`: The message to prepend to `result` +# - `result`: The Result which may be prepended to +# +# Examples: +# ``` +# prefixError "foo" (Pass 123) -> Pass 123 +# prefixError "foo" (Fail (Error "bar" stack)) => Fail (Error "foobar" stack) +# ``` +export def prefixError (prefix: String): (result: Result a Error) => Result a Error = match _ + Pass r -> Pass r + Fail (Error msg stack) -> Fail (Error "{prefix}{msg}" stack) + From fcdb5dfe942df1bbaed8eec906394a98ac532c97 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:29:55 -0800 Subject: [PATCH 06/12] check formatting --- .github/workflows/build.yaml | 3 +++ json.wake | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b50c01c..c991c6d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,5 +28,8 @@ jobs: - name: Initialize wake run: wake --init . + - name: Check formatting + run: wake-format --dry-run --auto + - name: Run basic test run: wake --in query -x 'single 5' diff --git a/json.wake b/json.wake index 878ebdb..2572f40 100644 --- a/json.wake +++ b/json.wake @@ -15,10 +15,8 @@ from query export def QueryError makeQueryError def lookup (selectFn: a => Boolean): (list: List (Pair a b)) => List b = def select (Pair key value) = - if selectFn key then - Some value - else - None + if selectFn key then Some value + else None mapPartial select From 0237e343204b13b1ce66789c779f0c2353439708 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:31:13 -0800 Subject: [PATCH 07/12] format --- json.wake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/json.wake b/json.wake index 2572f40..878ebdb 100644 --- a/json.wake +++ b/json.wake @@ -15,8 +15,10 @@ from query export def QueryError makeQueryError def lookup (selectFn: a => Boolean): (list: List (Pair a b)) => List b = def select (Pair key value) = - if selectFn key then Some value - else None + if selectFn key then + Some value + else + None mapPartial select From 1ff8546f2e7dd58f79b2462b57e45293d392d168 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 8 Nov 2023 13:33:40 -0800 Subject: [PATCH 08/12] cleanup --- .github/workflows/build.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c991c6d..ef8d414 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,9 +19,6 @@ jobs: - name: Download wake run: wget https://github.com/sifive/wake/releases/download/v39.1.0/ubuntu-22-04-wake_39.1.0-1_amd64.deb - - name: ls - run: ls -lah . - - name: Install wake run: sudo apt-get install ./ubuntu-22-04-wake_39.1.0-1_amd64.deb From 4c6c0f3a8591a76eee85465639908da46c22e9d7 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 9 Nov 2023 10:50:44 -0800 Subject: [PATCH 09/12] build slightly more robust testing framework --- .github/workflows/build.yaml | 4 ++-- tests/query.wake | 10 ++++++++++ tests/test.sh | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/query.wake create mode 100755 tests/test.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ef8d414..b36dead 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,5 +28,5 @@ jobs: - name: Check formatting run: wake-format --dry-run --auto - - name: Run basic test - run: wake --in query -x 'single 5' + - name: Run tests + run: ./tests/test.sh diff --git a/tests/query.wake b/tests/query.wake new file mode 100644 index 0000000..a40502b --- /dev/null +++ b/tests/query.wake @@ -0,0 +1,10 @@ +package tests + +from wake import _ +from query import _ + +export def runQueryTests _ = + require 4, Nil = single 4 + else failWithError "Unexpected value for single" + + Pass Unit diff --git a/tests/test.sh b/tests/test.sh new file mode 100755 index 0000000..69f96de --- /dev/null +++ b/tests/test.sh @@ -0,0 +1,5 @@ +#! /bin/bash + +set -e + +wake --in tests runQueryTests From 5bd22cfbda73ceb7f8f85bc171d39d84cb27307d Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 9 Nov 2023 10:52:50 -0800 Subject: [PATCH 10/12] improve CI output --- tests/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test.sh b/tests/test.sh index 69f96de..df404bb 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,5 +1,5 @@ #! /bin/bash -set -e +set -ex wake --in tests runQueryTests From acbb192f058a63deabf36d99af9bc17db5ef3bc4 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 9 Nov 2023 14:10:03 -0800 Subject: [PATCH 11/12] add typecheck --- .github/workflows/build.yaml | 3 +++ wake.db | Bin 0 -> 90112 bytes wake.log | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 wake.db create mode 100644 wake.log diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b36dead..3e283e2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -25,6 +25,9 @@ jobs: - name: Initialize wake run: wake --init . + - name: Typecheck wake + run: wake -x 'Unit' + - name: Check formatting run: wake-format --dry-run --auto diff --git a/wake.db b/wake.db new file mode 100644 index 0000000000000000000000000000000000000000..5b858d3d39eafae3224f77593176a5d8735ca9c5 GIT binary patch literal 90112 zcmeI)&u<)O8Nl(GwY|HE<7`sL9jwS=Dk0%f?WCbpJs=Pv1gRw|xFkRYXf@t_9Z$16 z>&(nHHK+%h_5j>Ca6p{70RI6JSGd3h2?^02D@8qU0C9l>&-2dAX2-jA8zBxEeMjD% zAMg9lyzl3I-ua=i{f(VlQD*$TQ8ElO|9R(v(`Yzf^nJ&1TJm{XKIL>#78Z*Y-R>64 z<-Ay}%v#QsZ@s+I{;6|mVbAIOsPp3a56*X2ez)@A+>6WqJoC-=U)w)#U2BKUKQH}l z=_iZ7TH0OsgJfhvpjHCmrKYzXxIc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qAbvRnKS zK|`Pa-Ohg;`C&o;0R#|0009ILKmY**5I_Kd8VWR;4M(5<7dy{8oj-Pd(Rp1Km=Hh! z0R#|0009ILKmY**5I{f$URYdonqBW_?Z14m)_?2Dm8%cJd*-QgiM6tX?qbRZS-g{@?`B){~qQtFFJ@dkEK28aJ z{+ECH&x8O12q1s}0tg_000IagfB*tD7C5VI Date: Thu, 9 Nov 2023 14:31:35 -0800 Subject: [PATCH 12/12] oops --- .gitignore | 2 ++ wake.db | Bin 90112 -> 0 bytes wake.log | 20 -------------------- 3 files changed, 2 insertions(+), 20 deletions(-) create mode 100644 .gitignore delete mode 100644 wake.db delete mode 100644 wake.log diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a237a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/**/wake.db* +/**/wake.log diff --git a/wake.db b/wake.db deleted file mode 100644 index 5b858d3d39eafae3224f77593176a5d8735ca9c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90112 zcmeI)&u<)O8Nl(GwY|HE<7`sL9jwS=Dk0%f?WCbpJs=Pv1gRw|xFkRYXf@t_9Z$16 z>&(nHHK+%h_5j>Ca6p{70RI6JSGd3h2?^02D@8qU0C9l>&-2dAX2-jA8zBxEeMjD% zAMg9lyzl3I-ua=i{f(VlQD*$TQ8ElO|9R(v(`Yzf^nJ&1TJm{XKIL>#78Z*Y-R>64 z<-Ay}%v#QsZ@s+I{;6|mVbAIOsPp3a56*X2ez)@A+>6WqJoC-=U)w)#U2BKUKQH}l z=_iZ7TH0OsgJfhvpjHCmrKYzXxIc*EzIk&T?}zEW>32ut>|mUwll8r5VA7{=yn6Hc z?VJ8fuYCFDxBW?4k=Gx^kG9$To3D>{yHP(l>aMoDAaIWlvv7A{CIxM#>e^ayh}+k{ zbnE8H-TBoGvTHwzGjrD@{y`EA!{pGvXAb>voQ z_Do{po=G)JTGm$E(KiDlr=DJz_QJlAeH?_@zCS%>=1tj6v8&+dvl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