From de299494f41d0e2d02cb06a265ec2a8499e24925 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:30:43 +0100 Subject: [PATCH 1/2] Report Factor postbuild info --- .github/workflows/ci.yml | 5 ++++- bin/info | 12 ++++++++++++ info/postbuild/postbuild.factor | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 bin/info create mode 100644 info/postbuild/postbuild.factor diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aafa119..4b38c9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,12 @@ on: push: branches: - main + - test pull_request: jobs: build: runs-on: ubuntu-latest - if: ${{ github.repository == 'codewars/factor' }} steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v2 @@ -27,6 +27,9 @@ jobs: - name: Run Passing Example run: bin/run passing + - name: Report Postbuild Info + run: bin/info >> $GITHUB_STEP_SUMMARY + - name: Report Image Size run: | echo "## Image Size" >> $GITHUB_STEP_SUMMARY diff --git a/bin/info b/bin/info new file mode 100755 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..c298351 --- /dev/null +++ b/info/postbuild/postbuild.factor @@ -0,0 +1,16 @@ +! copyright 2024 nomennescio +USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors accessors sequences prettyprint sequences.extras sets ; +IN: postbuild + +: 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-missing-libraries +; + +MAIN: run \ No newline at end of file From 00eba8b38699bc4befbfdbadbd079e62f0c87438 Mon Sep 17 00:00:00 2001 From: nomennescio Date: Wed, 24 Jan 2024 16:33:05 +0100 Subject: [PATCH 2/2] Reformat --- 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 c298351..3f73426 100644 --- a/info/postbuild/postbuild.factor +++ b/info/postbuild/postbuild.factor @@ -1,5 +1,5 @@ ! copyright 2024 nomennescio -USING: kernel io compiler.errors tools.errors assocs namespaces source-files.errors accessors sequences prettyprint sequences.extras sets ; +USING: accessors assocs compiler.errors io kernel namespaces prettyprint sequences sequences.extras sets source-files.errors tools.errors ; IN: postbuild : report-missing-libraries ( -- )