From d3cb054eacee64932c496e97d20980526aa00cae Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 11:23:50 +0100 Subject: [PATCH 01/14] CI on branch test too --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aafa119..6ce0afa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ on: push: branches: - main + - test pull_request: jobs: From 1bb18647b2c5508b29622ec8f90180cd5ce09caa Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 11:58:38 +0100 Subject: [PATCH 02/14] Run on all archives (experimental) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ce0afa..ecf9746 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: build: runs-on: ubuntu-latest - if: ${{ github.repository == 'codewars/factor' }} + # if: ${{ github.repository == 'codewars/factor' }} steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v2 From abfca0962d0290be92ff626d387458cdf23b8849 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 14:46:23 +0100 Subject: [PATCH 03/14] Run postbuild --- .github/workflows/ci.yml | 3 +++ bin/info | 12 ++++++++++++ info/postbuild/postbuild.factor | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 bin/info create mode 100644 info/postbuild/postbuild.factor diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecf9746..98f26c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,9 @@ jobs: - name: Run Passing Example run: bin/run passing + - name: Create Postbuild Info + run: bin/info + - name: Report Image Size run: | echo "## Image Size" >> $GITHUB_STEP_SUMMARY diff --git a/bin/info b/bin/info new file mode 100644 index 0000000..5b0a429 --- /dev/null +++ b/bin/info @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eu + +W=/workspace/ +# Create a container +C=$(docker container create --rm -w $W ghcr.io/codewars/factor:latest factor -run=postbuild) + +# Copy files from the current directory +docker container cp info/. $C:$W + +# Run tests +docker container start --attach $C diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor new file mode 100644 index 0000000..70245de --- /dev/null +++ b/info/postbuild/postbuild.factor @@ -0,0 +1,2 @@ +USING kernel +IN: postbuild From 4d8bcad548fe1a45363a174a4f9d9b7d0f6ffb16 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 15:30:12 +0100 Subject: [PATCH 04/14] Change permission bits --- bin/info | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/info diff --git a/bin/info b/bin/info old mode 100644 new mode 100755 From 27aa48cc22f18844d421e71033302fdf336c6792 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 15:33:32 +0100 Subject: [PATCH 05/14] Prepare run action in Factor postbuild script --- info/postbuild/postbuild.factor | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index 70245de..b031a50 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -1,2 +1,8 @@ -USING kernel +! copyright 2024 nomennescio +USING: kernel IN: postbuild + +: run ( -- ) +; + +MAIN: run \ No newline at end of file From d7d75c65f379302d3e4b37c002d5e1a98abfd651 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 15:35:12 +0100 Subject: [PATCH 06/14] Fix typo --- info/postbuild/postbuild.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index b031a50..3455e7c 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -1,5 +1,5 @@ ! copyright 2024 nomennescio -USING: kernel +USING: kernel ; IN: postbuild : run ( -- ) From d0c37b64fae027d8da195cbcd807dd3794e06c77 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 15:52:08 +0100 Subject: [PATCH 07/14] Test different errors --- info/postbuild/postbuild.factor | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index 3455e7c..9417ddf 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -1,8 +1,19 @@ ! copyright 2024 nomennescio -USING: kernel ; +USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors ; IN: postbuild +: report-linkage-errors ( -- ) + ! all-errors get values errors. + "==== LINKAGE" print + linkage-errors get values errors. + "==== COMPILER" print + compiler-errors get values errors. + "==== ALL" print + all-errors get errors. +; + : run ( -- ) + report-linkage-errors ; MAIN: run \ No newline at end of file From 95d31e36a5cca0bb53f649f0ee05048598faa956 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:03:22 +0100 Subject: [PATCH 08/14] Filter on missing libraries only --- info/postbuild/postbuild.factor | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index 9417ddf..fad0f42 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -1,15 +1,15 @@ ! copyright 2024 nomennescio -USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors ; +USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors accessors sequences prettyprint ; IN: postbuild : report-linkage-errors ( -- ) ! all-errors get values errors. "==== LINKAGE" print - linkage-errors get values errors. - "==== COMPILER" print - compiler-errors get values errors. - "==== ALL" print - all-errors get errors. + linkage-errors get values [ error>> \ no-such-library eq? ] filter ... + ! "==== COMPILER" print + ! compiler-errors get values errors. + ! "==== ALL" print + ! all-errors get errors. ; : run ( -- ) From efe09d6c09c09747aed58c8fd3b36024c6cac7a5 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:06:01 +0100 Subject: [PATCH 09/14] Fix? --- info/postbuild/postbuild.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index fad0f42..9a08bb6 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -5,7 +5,7 @@ IN: postbuild : report-linkage-errors ( -- ) ! all-errors get values errors. "==== LINKAGE" print - linkage-errors get values [ error>> \ no-such-library eq? ] filter ... + linkage-errors get values [ error>> no-such-library? ] filter ... ! "==== COMPILER" print ! compiler-errors get values errors. ! "==== ALL" print From 9c86f1ac747512f20c0f911d99f2e40d5f527e5e Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:09:26 +0100 Subject: [PATCH 10/14] Unique missing libraries --- info/postbuild/postbuild.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index 9a08bb6..1bb98fc 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -1,11 +1,11 @@ ! copyright 2024 nomennescio -USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors accessors sequences prettyprint ; +USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors accessors sequences prettyprint sequences.extras sets ; IN: postbuild : report-linkage-errors ( -- ) ! all-errors get values errors. "==== LINKAGE" print - linkage-errors get values [ error>> no-such-library? ] filter ... + linkage-errors get values [ error>> no-such-library? ] [ error>> name>> ] filter-map members ... ! "==== COMPILER" print ! compiler-errors get values errors. ! "==== ALL" print From afc6844d2c1fc0feceecd060684613083e2874aa Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:13:25 +0100 Subject: [PATCH 11/14] Report missing libraries --- info/postbuild/postbuild.factor | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index 1bb98fc..b6427f3 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -3,8 +3,6 @@ USING: kernel io compiler.errors tools.errors assocs namespaces source-files.err IN: postbuild : report-linkage-errors ( -- ) - ! all-errors get values errors. - "==== LINKAGE" print linkage-errors get values [ error>> no-such-library? ] [ error>> name>> ] filter-map members ... ! "==== COMPILER" print ! compiler-errors get values errors. @@ -12,8 +10,15 @@ IN: postbuild ! all-errors get errors. ; +: report-missing-libraries ( -- ) + linkage-errors get values [ error>> no-such-library? ] [ error>> name>> ] filter-map members + [ "Missing libraries:" print + [ print ] each + ] unless-empty +; + : run ( -- ) - report-linkage-errors + report-missing-libraries ; MAIN: run \ No newline at end of file From e175aa7ca5625ccda593817ccfbd86d4a39cf7ee Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:20:36 +0100 Subject: [PATCH 12/14] Cleanup and report out --- .github/workflows/ci.yml | 2 +- info/postbuild/postbuild.factor | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98f26c6..0c3b1c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: run: bin/run passing - name: Create Postbuild Info - run: bin/info + run: bin/info >> $GITHUB_STEP_SUMMARY - name: Report Image Size run: | diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index b6427f3..805345b 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -2,17 +2,9 @@ USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors accessors sequences prettyprint sequences.extras sets ; IN: postbuild -: report-linkage-errors ( -- ) - linkage-errors get values [ error>> no-such-library? ] [ error>> name>> ] filter-map members ... - ! "==== COMPILER" print - ! compiler-errors get values errors. - ! "==== ALL" print - ! all-errors get errors. -; - : report-missing-libraries ( -- ) linkage-errors get values [ error>> no-such-library? ] [ error>> name>> ] filter-map members - [ "Missing libraries:" print + [ "## Missing libraries:" print [ print ] each ] unless-empty ; From 7f1be5285fca2eecfd72d21acb6ea625efbb9398 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:22:04 +0100 Subject: [PATCH 13/14] Reformat output --- info/postbuild/postbuild.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/postbuild/postbuild.factor b/info/postbuild/postbuild.factor index 805345b..c298351 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -4,7 +4,7 @@ IN: postbuild : report-missing-libraries ( -- ) linkage-errors get values [ error>> no-such-library? ] [ error>> name>> ] filter-map members - [ "## Missing libraries:" print + [ "## Missing libraries" print [ print ] each ] unless-empty ; From a9641248336d1522b3d67e73613ce1b831b22f02 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:25:31 +0100 Subject: [PATCH 14/14] Cleanup Github actions --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c3b1c9..4b38c9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,6 @@ on: jobs: build: runs-on: ubuntu-latest - # if: ${{ github.repository == 'codewars/factor' }} steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v2 @@ -28,7 +27,7 @@ jobs: - name: Run Passing Example run: bin/run passing - - name: Create Postbuild Info + - name: Report Postbuild Info run: bin/info >> $GITHUB_STEP_SUMMARY - name: Report Image Size